@authsignal/browser 1.12.7 → 1.13.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/digital-credential-api-client.d.ts +12 -0
- package/dist/api/types/digital-credential.d.ts +27 -0
- package/dist/api/types/shared.d.ts +7 -3
- package/dist/authsignal.d.ts +4 -1
- package/dist/digital-credential.d.ts +43 -0
- package/dist/email-magic-link.d.ts +3 -1
- package/dist/email.d.ts +3 -1
- package/dist/helpers.d.ts +18 -4
- package/dist/index.d.ts +3 -0
- package/dist/index.js +25509 -94
- package/dist/index.min.js +64 -1
- package/dist/passkey.d.ts +3 -1
- package/dist/push.d.ts +3 -1
- package/dist/qr-code/rest-qr-handler.d.ts +3 -1
- package/dist/qr-code/websocket-qr-handler.d.ts +3 -1
- package/dist/qr-code.d.ts +3 -1
- package/dist/security-key.d.ts +3 -1
- package/dist/sms.d.ts +3 -1
- package/dist/token-cache.d.ts +6 -2
- package/dist/totp.d.ts +3 -1
- package/dist/types.d.ts +15 -5
- package/dist/utils.d.ts +1 -0
- package/dist/whatsapp.d.ts +3 -1
- package/package.json +7 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ErrorResponse } from "./types/passkey";
|
|
2
|
+
import { ApiClientOptions, ChallengeResponse } from "./types/shared";
|
|
3
|
+
import { PresentationOptionsRequest, PresentationOptionsResponse, VerifyPresentationRequest, VerifyPresentationResponse } from "./types/digital-credential";
|
|
4
|
+
export declare class DigitalCredentialApiClient {
|
|
5
|
+
tenantId: string;
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
onTokenExpired?: () => void;
|
|
8
|
+
constructor({ baseUrl, tenantId, onTokenExpired }: ApiClientOptions);
|
|
9
|
+
presentationOptions({ action, challengeId, anonymous, token, documentTypes, claims, }: PresentationOptionsRequest): Promise<PresentationOptionsResponse | ErrorResponse>;
|
|
10
|
+
verifyPresentation({ token, data, challengeId, redirectUrl, }: VerifyPresentationRequest): Promise<VerifyPresentationResponse | ErrorResponse>;
|
|
11
|
+
challenge(action: string): Promise<ChallengeResponse | ErrorResponse>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type PresentationOptionsRequest = {
|
|
2
|
+
action?: string;
|
|
3
|
+
token?: string;
|
|
4
|
+
anonymous?: boolean;
|
|
5
|
+
challengeId?: string;
|
|
6
|
+
documentTypes?: string[];
|
|
7
|
+
claims?: string[][];
|
|
8
|
+
};
|
|
9
|
+
export type PresentationOptionsResponse = {
|
|
10
|
+
challengeId: string;
|
|
11
|
+
dcapiOptions: any;
|
|
12
|
+
};
|
|
13
|
+
export type VerifyPresentationRequest = {
|
|
14
|
+
token?: string;
|
|
15
|
+
data: any;
|
|
16
|
+
challengeId: string;
|
|
17
|
+
redirectUrl?: string;
|
|
18
|
+
};
|
|
19
|
+
export type VerifyPresentationResponse = {
|
|
20
|
+
isVerified: boolean;
|
|
21
|
+
accessToken?: string;
|
|
22
|
+
username?: string;
|
|
23
|
+
userId?: string;
|
|
24
|
+
url?: string;
|
|
25
|
+
requireUserVerification?: boolean;
|
|
26
|
+
claims?: Record<string, string>;
|
|
27
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CredentialDeviceType } from "@simplewebauthn/browser";
|
|
2
|
+
import { ErrorCode } from "../../types";
|
|
2
3
|
export type ApiClientOptions = {
|
|
3
4
|
baseUrl: string;
|
|
4
5
|
tenantId: string;
|
|
@@ -21,9 +22,12 @@ export type VerifyResponse = {
|
|
|
21
22
|
userAuthenticator?: Authenticator;
|
|
22
23
|
};
|
|
23
24
|
export type ErrorResponse = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated Use errorCode and errorDescription instead
|
|
27
|
+
*/
|
|
28
|
+
error?: string;
|
|
29
|
+
errorCode?: ErrorCode;
|
|
30
|
+
errorDescription?: string | undefined;
|
|
27
31
|
};
|
|
28
32
|
export declare enum VerificationMethod {
|
|
29
33
|
SMS = "SMS",
|
package/dist/authsignal.d.ts
CHANGED
|
@@ -8,11 +8,13 @@ import { SecurityKey } from "./security-key";
|
|
|
8
8
|
import { QrCode } from "./qr-code";
|
|
9
9
|
import { Push } from "./push";
|
|
10
10
|
import { Whatsapp } from "./whatsapp";
|
|
11
|
+
import { DigitalCredential } from "./digital-credential";
|
|
11
12
|
export declare class Authsignal {
|
|
12
13
|
anonymousId: string;
|
|
13
14
|
profilingId: string;
|
|
14
15
|
cookieDomain: string;
|
|
15
16
|
anonymousIdCookieName: string;
|
|
17
|
+
enableLogging: boolean;
|
|
16
18
|
passkey: Passkey;
|
|
17
19
|
totp: Totp;
|
|
18
20
|
email: Email;
|
|
@@ -22,7 +24,8 @@ export declare class Authsignal {
|
|
|
22
24
|
qrCode: QrCode;
|
|
23
25
|
push: Push;
|
|
24
26
|
whatsapp: Whatsapp;
|
|
25
|
-
|
|
27
|
+
digitalCredential: DigitalCredential;
|
|
28
|
+
constructor({ cookieDomain, cookieName, baseUrl, tenantId, onTokenExpired, enableLogging, }: AuthsignalOptions);
|
|
26
29
|
setToken(token: string): void;
|
|
27
30
|
launch(url: string, options?: {
|
|
28
31
|
mode?: "redirect";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { DigitalCredentialApiClient } from "./api/digital-credential-api-client";
|
|
2
|
+
import { AuthsignalResponse } from "./types";
|
|
3
|
+
type DigitalCredentialOptions = {
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
tenantId: string;
|
|
6
|
+
onTokenExpired?: () => void;
|
|
7
|
+
enableLogging: boolean;
|
|
8
|
+
};
|
|
9
|
+
type VerifyParams = {
|
|
10
|
+
action?: string;
|
|
11
|
+
token?: string;
|
|
12
|
+
redirectUrl?: string;
|
|
13
|
+
};
|
|
14
|
+
type VerifyResponse = {
|
|
15
|
+
isVerified: boolean;
|
|
16
|
+
token?: string;
|
|
17
|
+
username?: string;
|
|
18
|
+
userId?: string;
|
|
19
|
+
url?: string;
|
|
20
|
+
requireUserVerification?: boolean;
|
|
21
|
+
claims?: Record<string, string>;
|
|
22
|
+
};
|
|
23
|
+
type VerifyClaimsParams = {
|
|
24
|
+
action?: string;
|
|
25
|
+
documentTypes?: string[];
|
|
26
|
+
claims?: string[][];
|
|
27
|
+
redirectUrl?: string;
|
|
28
|
+
};
|
|
29
|
+
type VerifyClaimsResponse = {
|
|
30
|
+
isVerified: boolean;
|
|
31
|
+
claims?: Record<string, string>;
|
|
32
|
+
url?: string;
|
|
33
|
+
requireUserVerification?: boolean;
|
|
34
|
+
};
|
|
35
|
+
export declare class DigitalCredential {
|
|
36
|
+
api: DigitalCredentialApiClient;
|
|
37
|
+
private cache;
|
|
38
|
+
private enableLogging;
|
|
39
|
+
constructor({ baseUrl, tenantId, onTokenExpired, enableLogging }: DigitalCredentialOptions);
|
|
40
|
+
verify(params?: VerifyParams): Promise<AuthsignalResponse<VerifyResponse>>;
|
|
41
|
+
verifyClaims(params?: VerifyClaimsParams): Promise<AuthsignalResponse<VerifyClaimsResponse>>;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -4,6 +4,7 @@ type EmailMagicLinkOptions = {
|
|
|
4
4
|
baseUrl: string;
|
|
5
5
|
tenantId: string;
|
|
6
6
|
onTokenExpired?: () => void;
|
|
7
|
+
enableLogging: boolean;
|
|
7
8
|
};
|
|
8
9
|
type EnrollParams = {
|
|
9
10
|
email: string;
|
|
@@ -11,7 +12,8 @@ type EnrollParams = {
|
|
|
11
12
|
export declare class EmailMagicLink {
|
|
12
13
|
private api;
|
|
13
14
|
private cache;
|
|
14
|
-
|
|
15
|
+
private enableLogging;
|
|
16
|
+
constructor({ baseUrl, tenantId, onTokenExpired, enableLogging }: EmailMagicLinkOptions);
|
|
15
17
|
enroll({ email }: EnrollParams): Promise<AuthsignalResponse<EnrollResponse>>;
|
|
16
18
|
challenge(): Promise<AuthsignalResponse<ChallengeResponse>>;
|
|
17
19
|
checkVerificationStatus(): Promise<AuthsignalResponse<VerifyResponse>>;
|
package/dist/email.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ type EmailOptions = {
|
|
|
4
4
|
baseUrl: string;
|
|
5
5
|
tenantId: string;
|
|
6
6
|
onTokenExpired?: () => void;
|
|
7
|
+
enableLogging: boolean;
|
|
7
8
|
};
|
|
8
9
|
type EnrollParams = {
|
|
9
10
|
email: string;
|
|
@@ -14,7 +15,8 @@ type VerifyParams = {
|
|
|
14
15
|
export declare class Email {
|
|
15
16
|
private api;
|
|
16
17
|
private cache;
|
|
17
|
-
|
|
18
|
+
private enableLogging;
|
|
19
|
+
constructor({ baseUrl, tenantId, onTokenExpired, enableLogging }: EmailOptions);
|
|
18
20
|
enroll({ email }: EnrollParams): Promise<AuthsignalResponse<EnrollResponse>>;
|
|
19
21
|
challenge(): Promise<AuthsignalResponse<ChallengeResponse>>;
|
|
20
22
|
verify({ code }: VerifyParams): Promise<AuthsignalResponse<VerifyResponse>>;
|
package/dist/helpers.d.ts
CHANGED
|
@@ -9,15 +9,29 @@ type CookieOptions = {
|
|
|
9
9
|
export declare function setCookie({ name, value, expire, domain, secure }: CookieOptions): void;
|
|
10
10
|
export declare function getCookieDomain(): string;
|
|
11
11
|
export declare function getCookie(name: string): string | null;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
type HandleErrorResponseParams = {
|
|
13
|
+
errorResponse: ErrorResponse;
|
|
14
|
+
enableLogging: boolean;
|
|
14
15
|
};
|
|
15
|
-
export declare function
|
|
16
|
-
error: string;
|
|
16
|
+
export declare function handleErrorResponse({ errorResponse, enableLogging }: HandleErrorResponseParams): {
|
|
17
|
+
error: string | undefined;
|
|
18
|
+
errorCode: import("./types").ErrorCode | undefined;
|
|
19
|
+
errorDescription: string | undefined;
|
|
20
|
+
};
|
|
21
|
+
type HandleApiResponseParams<T> = {
|
|
22
|
+
response: ErrorResponse | T;
|
|
23
|
+
enableLogging: boolean;
|
|
24
|
+
};
|
|
25
|
+
export declare function handleApiResponse<T>({ response, enableLogging }: HandleApiResponseParams<T>): {
|
|
26
|
+
error: string | undefined;
|
|
27
|
+
errorCode: import("./types").ErrorCode | undefined;
|
|
28
|
+
errorDescription: string | undefined;
|
|
17
29
|
data?: undefined;
|
|
18
30
|
} | {
|
|
19
31
|
data: T;
|
|
20
32
|
error?: undefined;
|
|
33
|
+
errorCode?: undefined;
|
|
34
|
+
errorDescription?: undefined;
|
|
21
35
|
};
|
|
22
36
|
export declare function handleWebAuthnError(error: unknown): void;
|
|
23
37
|
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export * from "./authsignal";
|
|
2
2
|
export * from "./types";
|
|
3
|
+
export { DigitalCredential } from "./digital-credential";
|
|
3
4
|
export type { Authenticator, VerificationMethod, EnrollResponse, ChallengeResponse } from "./api/types/shared";
|
|
4
5
|
export type { EnrollTotpResponse } from "./api/types/totp";
|
|
5
6
|
export type { QrCodeChallengeResponse, QrCodeVerifyResponse } from "./api/types/qr-code";
|
|
6
7
|
export type { PushChallengeResponse, PushVerifyResponse } from "./api/types/push";
|
|
7
8
|
export type { WebSocketQrCodeOptions, WebSocketQrCodeResponse, ChallengeState } from "./api/types/websocket";
|
|
8
9
|
export { Whatsapp } from "./whatsapp";
|
|
10
|
+
export type { PresentationOptionsRequest, PresentationOptionsResponse, VerifyPresentationRequest, VerifyPresentationResponse, } from "./api/types/digital-credential";
|
|
11
|
+
export { browserSupportsDigitalCredential } from "./utils";
|