Skip to content

Commit f0f1107

Browse files
committed
Added new API commands for account switching
1 parent 6e2b5bd commit f0f1107

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

keeperapi/src/auth.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export type LoginPayload = {
8080
resumeSessionOnly?: boolean
8181
givenSessionToken?: string
8282
ecOnly?: boolean
83+
fromSessionToken?: Uint8Array | null
8384
}
8485

8586
export enum UserType {
@@ -276,6 +277,7 @@ export class Auth {
276277
resumeSessionOnly = false,
277278
givenSessionToken = undefined,
278279
ecOnly = false,
280+
fromSessionToken = undefined
279281
}: Partial<LoginPayload>
280282
) {
281283
this._username = username || this.options.sessionStorage?.lastUsername || ''
@@ -321,7 +323,8 @@ export class Auth {
321323
messageSessionUid: this.messageSessionUid,
322324
loginMethod: loginMethod,
323325
cloneCode: await this.options.sessionStorage?.getCloneCode(this.options.host as KeeperEnvironment, this._username),
324-
v2TwoFactorToken: v2TwoFactorToken
326+
v2TwoFactorToken: v2TwoFactorToken,
327+
fromSessionToken,
325328
})
326329
if (loginType !== LoginType.NORMAL && !!loginType) {
327330
startLoginRequest.loginType = loginType

keeperapi/src/restMessages.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,12 @@ export const ssoServiceProviderRequestMessage = (data: Authentication.ISsoServic
395395
export const ssoCloudValidationRequestMessage = (data: SsoCloud.ISsoCloudConfigurationValidationRequest, url: string): RestMessage<SsoCloud.ISsoCloudConfigurationValidationRequest, SsoCloud.ISsoCloudConfigurationValidationResponse> =>
396396
createMessage(data, url, SsoCloud.SsoCloudConfigurationValidationRequest, SsoCloud.SsoCloudConfigurationValidationResponse)
397397

398+
export const switchAccountListAuthenticated = () => createOutMessage('/authentication/switch_account_list_authenticated', Authentication.SwitchListResponse)
399+
400+
export const switchAccountListRemoved = (data: Authentication.LoginAsUserRequest): RestInMessage<Authentication.ILoginAsUserRequest> => createInMessage(data, '/authentication/switch_account_list_remove', Authentication.LoginAsUserRequest)
401+
402+
export const switchAccountFromAuthenticated = (data: Authentication.LoginAsUserRequest) => createMessage(data, '/authentication/switch_account_from_authenticated', Authentication.LoginAsUserRequest, Authentication.LoginResponse)
403+
398404

399405
/* -- Keeper Automator -- */
400406

0 commit comments

Comments
 (0)