Skip to content

Commit fa8b5f1

Browse files
authored
feat: get session info from extension (#24)
1 parent bcb5283 commit fa8b5f1

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/client.ts

+28
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,34 @@ export class ExtensionClient {
284284
return this.sendMessage("/signify/authorize/credential", { payload });
285285
};
286286

287+
/**
288+
* Sends a /signify/get-session-info message to the extension.
289+
* prereq:
290+
* once webapp has received an authorized result, a session is created on the extension
291+
*
292+
* Upon successfull session, this method is used to receive previously
293+
* selected signature conditioned to its session validity. If session is expired this would throw an error.
294+
* Otherwise, it returns AuthorizeResult
295+
*
296+
* @param payload The arguments to pass to the extension.
297+
* @returns {AuthorizeResult}
298+
*/
299+
getSessionInfo = async (payload?: AuthorizeArgs): Promise<AuthorizeResult> => {
300+
return this.sendMessage("/signify/get-session-info", { payload });
301+
};
302+
303+
/**
304+
* Sends a /signify/clear-session message to the extension.
305+
*
306+
* This method is used to clear session with extension if exist.
307+
*
308+
* @param payload The arguments to pass to the extension.
309+
* @returns {AuthorizeResult}
310+
*/
311+
clearSession = async (payload?: AuthorizeArgs): Promise<AuthorizeResult> => {
312+
return this.sendMessage("/signify/clear-session", { payload });
313+
};
314+
287315
/**
288316
* Configures the extension with the specified vendor.
289317
* @param payload The vendor configuration

0 commit comments

Comments
 (0)