@accounts/client
Advanced tools
Comparing version 0.29.0 to 0.30.0-alpha.1
@@ -1,2 +0,2 @@ | ||
import { LoginResult, Tokens, ImpersonationResult, User } from '@accounts/types'; | ||
import { Tokens, ImpersonationResult, User, AuthenticationResult } from '@accounts/types'; | ||
import { TransportInterface } from './transport-interface'; | ||
@@ -32,3 +32,3 @@ import { AccountsClientOptions } from './types'; | ||
[key: string]: any; | ||
}): Promise<LoginResult>; | ||
}): Promise<AuthenticationResult>; | ||
/** | ||
@@ -61,3 +61,8 @@ * Refresh the user session | ||
logout(): Promise<void>; | ||
mfaChallenge(mfaToken: string, authenticatorId: string): Promise<any>; | ||
mfaAssociate(type: string, params?: any): Promise<any>; | ||
mfaAssociateByMfaToken(mfaToken: string, type: string, params?: any): Promise<any>; | ||
authenticators(): Promise<import("@accounts/types").Authenticator[]>; | ||
authenticatorsByMfaToken(mfaToken: string): Promise<import("@accounts/types").Authenticator[]>; | ||
private getTokenKey; | ||
} |
@@ -119,6 +119,8 @@ "use strict"; | ||
response = _a.sent(); | ||
if (!('tokens' in response)) return [3 /*break*/, 3]; | ||
return [4 /*yield*/, this.setTokens(response.tokens)]; | ||
case 2: | ||
_a.sent(); | ||
return [2 /*return*/, response]; | ||
_a.label = 3; | ||
case 3: return [2 /*return*/, response]; | ||
} | ||
@@ -265,2 +267,17 @@ }); | ||
}; | ||
AccountsClient.prototype.mfaChallenge = function (mfaToken, authenticatorId) { | ||
return this.transport.mfaChallenge(mfaToken, authenticatorId); | ||
}; | ||
AccountsClient.prototype.mfaAssociate = function (type, params) { | ||
return this.transport.mfaAssociate(type, params); | ||
}; | ||
AccountsClient.prototype.mfaAssociateByMfaToken = function (mfaToken, type, params) { | ||
return this.transport.mfaAssociateByMfaToken(mfaToken, type, params); | ||
}; | ||
AccountsClient.prototype.authenticators = function () { | ||
return this.transport.authenticators(); | ||
}; | ||
AccountsClient.prototype.authenticatorsByMfaToken = function (mfaToken) { | ||
return this.transport.authenticatorsByMfaToken(mfaToken); | ||
}; | ||
AccountsClient.prototype.getTokenKey = function (tokenName) { | ||
@@ -267,0 +284,0 @@ return this.options.tokenStoragePrefix + ":" + tokenName; |
@@ -1,4 +0,4 @@ | ||
import { LoginResult, ImpersonationUserIdentity, ImpersonationResult, CreateUser, User, CreateUserResult } from '@accounts/types'; | ||
import { LoginResult, ImpersonationUserIdentity, ImpersonationResult, CreateUser, User, CreateUserResult, Authenticator, AuthenticationResult } from '@accounts/types'; | ||
import { AccountsClient } from './accounts-client'; | ||
export interface TransportInterface { | ||
export interface TransportInterface extends TransportMfaInterface { | ||
client: AccountsClient; | ||
@@ -11,3 +11,3 @@ createUser(user: CreateUser): Promise<CreateUserResult>; | ||
[key: string]: string | object; | ||
}): Promise<LoginResult>; | ||
}): Promise<AuthenticationResult>; | ||
logout(): Promise<void>; | ||
@@ -24,1 +24,9 @@ getUser(): Promise<User>; | ||
} | ||
interface TransportMfaInterface { | ||
authenticators(): Promise<Authenticator[]>; | ||
authenticatorsByMfaToken(mfaToken?: string): Promise<Authenticator[]>; | ||
mfaAssociate(type: string, params?: any): Promise<any>; | ||
mfaAssociateByMfaToken(mfaToken: string, type: string, params?: any): Promise<any>; | ||
mfaChallenge(mfaToken: string, authenticatorId: string): Promise<any>; | ||
} | ||
export {}; |
{ | ||
"name": "@accounts/client", | ||
"version": "0.29.0", | ||
"version": "0.30.0-alpha.1", | ||
"description": "Fullstack authentication and accounts-management", | ||
@@ -50,7 +50,7 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@types/jest": "25.2.3", | ||
"@types/jest": "26.0.9", | ||
"@types/jwt-decode": "2.2.1", | ||
"@types/node": "14.0.14", | ||
"jest": "26.0.1", | ||
"jest-localstorage-mock": "2.4.2", | ||
"@types/node": "14.0.27", | ||
"jest": "26.3.0", | ||
"jest-localstorage-mock": "2.4.3", | ||
"jsonwebtoken": "8.5.1", | ||
@@ -61,7 +61,7 @@ "localstorage-polyfill": "1.0.1", | ||
"dependencies": { | ||
"@accounts/types": "^0.29.0", | ||
"@accounts/types": "^0.30.0-alpha.1", | ||
"jwt-decode": "2.2.0", | ||
"tslib": "2.0.0" | ||
"tslib": "2.0.1" | ||
}, | ||
"gitHead": "fefb328a5388404f7f3c725db666321313e2b6ce" | ||
"gitHead": "eb9750193707aecb771b63d29540a8b6c316ebe0" | ||
} |
@@ -1,2 +0,2 @@ | ||
import { LoginResult, Tokens, ImpersonationResult, User } from '@accounts/types'; | ||
import { Tokens, ImpersonationResult, User, AuthenticationResult } from '@accounts/types'; | ||
import { TransportInterface } from './transport-interface'; | ||
@@ -105,5 +105,7 @@ import { TokenStorage, AccountsClientOptions } from './types'; | ||
credentials: { [key: string]: any } | ||
): Promise<LoginResult> { | ||
): Promise<AuthenticationResult> { | ||
const response = await this.transport.loginWithService(service, credentials); | ||
await this.setTokens(response.tokens); | ||
if ('tokens' in response) { | ||
await this.setTokens(response.tokens); | ||
} | ||
return response; | ||
@@ -202,2 +204,22 @@ } | ||
public mfaChallenge(mfaToken: string, authenticatorId: string) { | ||
return this.transport.mfaChallenge(mfaToken, authenticatorId); | ||
} | ||
public mfaAssociate(type: string, params?: any) { | ||
return this.transport.mfaAssociate(type, params); | ||
} | ||
public mfaAssociateByMfaToken(mfaToken: string, type: string, params?: any) { | ||
return this.transport.mfaAssociateByMfaToken(mfaToken, type, params); | ||
} | ||
public authenticators() { | ||
return this.transport.authenticators(); | ||
} | ||
public authenticatorsByMfaToken(mfaToken: string) { | ||
return this.transport.authenticatorsByMfaToken(mfaToken); | ||
} | ||
private getTokenKey(tokenName: TokenKey): string { | ||
@@ -204,0 +226,0 @@ return `${this.options.tokenStoragePrefix}:${tokenName}`; |
@@ -8,6 +8,8 @@ import { | ||
CreateUserResult, | ||
Authenticator, | ||
AuthenticationResult, | ||
} from '@accounts/types'; | ||
import { AccountsClient } from './accounts-client'; | ||
export interface TransportInterface { | ||
export interface TransportInterface extends TransportMfaInterface { | ||
client: AccountsClient; | ||
@@ -26,3 +28,3 @@ createUser(user: CreateUser): Promise<CreateUserResult>; | ||
} | ||
): Promise<LoginResult>; | ||
): Promise<AuthenticationResult>; | ||
logout(): Promise<void>; | ||
@@ -39,1 +41,9 @@ getUser(): Promise<User>; | ||
} | ||
interface TransportMfaInterface { | ||
authenticators(): Promise<Authenticator[]>; | ||
authenticatorsByMfaToken(mfaToken?: string): Promise<Authenticator[]>; | ||
mfaAssociate(type: string, params?: any): Promise<any>; | ||
mfaAssociateByMfaToken(mfaToken: string, type: string, params?: any): Promise<any>; | ||
mfaChallenge(mfaToken: string, authenticatorId: string): Promise<any>; | ||
} |
Sorry, the diff of this file is not supported yet
38818
737
+ Added@accounts/types@0.30.0(transitive)
+ Addedtslib@2.0.1(transitive)
- Removed@accounts/types@0.29.0(transitive)
Updatedtslib@2.0.1