@supabase/auth-js 2.73.0-rc.3 → 2.73.0-rc.5
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/main/GoTrueClient.d.ts +1 -1
- package/dist/main/GoTrueClient.d.ts.map +1 -1
- package/dist/main/GoTrueClient.js +43 -15
- package/dist/main/GoTrueClient.js.map +1 -1
- package/dist/main/lib/base64url.d.ts +3 -2
- package/dist/main/lib/base64url.d.ts.map +1 -1
- package/dist/main/lib/base64url.js.map +1 -1
- package/dist/main/lib/helpers.d.ts +2 -1
- package/dist/main/lib/helpers.d.ts.map +1 -1
- package/dist/main/lib/helpers.js.map +1 -1
- package/dist/main/lib/types.d.ts +140 -19
- package/dist/main/lib/types.d.ts.map +1 -1
- package/dist/main/lib/types.js +3 -2
- package/dist/main/lib/types.js.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/main/lib/webauthn.d.ts +274 -0
- package/dist/main/lib/webauthn.d.ts.map +1 -0
- package/dist/main/lib/webauthn.dom.d.ts +583 -0
- package/dist/main/lib/webauthn.dom.d.ts.map +1 -0
- package/dist/main/lib/webauthn.dom.js +4 -0
- package/dist/main/lib/webauthn.dom.js.map +1 -0
- package/dist/main/lib/webauthn.errors.d.ts +80 -0
- package/dist/main/lib/webauthn.errors.d.ts.map +1 -0
- package/dist/main/lib/webauthn.errors.js +265 -0
- package/dist/main/lib/webauthn.errors.js.map +1 -0
- package/dist/main/lib/webauthn.js +702 -0
- package/dist/main/lib/webauthn.js.map +1 -0
- package/dist/module/GoTrueClient.d.ts +1 -1
- package/dist/module/GoTrueClient.d.ts.map +1 -1
- package/dist/module/GoTrueClient.js +49 -21
- package/dist/module/GoTrueClient.js.map +1 -1
- package/dist/module/lib/base64url.d.ts +3 -2
- package/dist/module/lib/base64url.d.ts.map +1 -1
- package/dist/module/lib/base64url.js.map +1 -1
- package/dist/module/lib/helpers.d.ts +2 -1
- package/dist/module/lib/helpers.d.ts.map +1 -1
- package/dist/module/lib/helpers.js.map +1 -1
- package/dist/module/lib/types.d.ts +140 -19
- package/dist/module/lib/types.d.ts.map +1 -1
- package/dist/module/lib/types.js +2 -1
- package/dist/module/lib/types.js.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.js +1 -1
- package/dist/module/lib/webauthn.d.ts +274 -0
- package/dist/module/lib/webauthn.d.ts.map +1 -0
- package/dist/module/lib/webauthn.dom.d.ts +583 -0
- package/dist/module/lib/webauthn.dom.d.ts.map +1 -0
- package/dist/module/lib/webauthn.dom.js +3 -0
- package/dist/module/lib/webauthn.dom.js.map +1 -0
- package/dist/module/lib/webauthn.errors.d.ts +80 -0
- package/dist/module/lib/webauthn.errors.d.ts.map +1 -0
- package/dist/module/lib/webauthn.errors.js +257 -0
- package/dist/module/lib/webauthn.errors.js.map +1 -0
- package/dist/module/lib/webauthn.js +685 -0
- package/dist/module/lib/webauthn.js.map +1 -0
- package/package.json +1 -1
- package/src/GoTrueClient.ts +198 -68
- package/src/lib/base64url.ts +4 -2
- package/src/lib/helpers.ts +2 -1
- package/src/lib/types.ts +205 -26
- package/src/lib/version.ts +1 -1
- package/src/lib/webauthn.dom.ts +636 -0
- package/src/lib/webauthn.errors.ts +317 -0
- package/src/lib/webauthn.ts +929 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import GoTrueClient from '../GoTrueClient';
|
|
2
|
+
import { AuthError } from './errors';
|
|
3
|
+
import { AuthMFAEnrollWebauthnResponse, AuthMFAVerifyResponse, AuthMFAVerifyResponseData, MFAChallengeWebauthnParams, MFAEnrollWebauthnParams, MFAVerifyWebauthnParamFields, MFAVerifyWebauthnParams, RequestResult, StrictOmit } from './types';
|
|
4
|
+
import type { AuthenticationCredential, AuthenticationResponseJSON, PublicKeyCredentialCreationOptionsFuture, PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialRequestOptionsFuture, PublicKeyCredentialRequestOptionsJSON, RegistrationCredential, RegistrationResponseJSON } from './webauthn.dom';
|
|
5
|
+
import { identifyAuthenticationError, identifyRegistrationError, isWebAuthnError, WebAuthnError } from './webauthn.errors';
|
|
6
|
+
export { WebAuthnError, isWebAuthnError, identifyRegistrationError, identifyAuthenticationError };
|
|
7
|
+
export type { RegistrationResponseJSON, AuthenticationResponseJSON };
|
|
8
|
+
/**
|
|
9
|
+
* WebAuthn abort service to manage ceremony cancellation.
|
|
10
|
+
* Ensures only one WebAuthn ceremony is active at a time to prevent "operation already in progress" errors.
|
|
11
|
+
*
|
|
12
|
+
* @experimental This class is experimental and may change in future releases
|
|
13
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-automation-webdriver-capability W3C WebAuthn Spec - Aborting Ceremonies}
|
|
14
|
+
*/
|
|
15
|
+
export declare class WebAuthnAbortService {
|
|
16
|
+
private controller;
|
|
17
|
+
/**
|
|
18
|
+
* Create an abort signal for a new WebAuthn operation.
|
|
19
|
+
* Automatically cancels any existing operation.
|
|
20
|
+
*
|
|
21
|
+
* @returns {AbortSignal} Signal to pass to navigator.credentials.create() or .get()
|
|
22
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal MDN - AbortSignal}
|
|
23
|
+
*/
|
|
24
|
+
createNewAbortSignal(): AbortSignal;
|
|
25
|
+
/**
|
|
26
|
+
* Manually cancel the current WebAuthn operation.
|
|
27
|
+
* Useful for cleaning up when user cancels or navigates away.
|
|
28
|
+
*
|
|
29
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort MDN - AbortController.abort}
|
|
30
|
+
*/
|
|
31
|
+
cancelCeremony(): void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Singleton instance to ensure only one WebAuthn ceremony is active at a time.
|
|
35
|
+
* This prevents "operation already in progress" errors when retrying WebAuthn operations.
|
|
36
|
+
*
|
|
37
|
+
* @experimental This instance is experimental and may change in future releases
|
|
38
|
+
*/
|
|
39
|
+
export declare const webAuthnAbortService: WebAuthnAbortService;
|
|
40
|
+
/**
|
|
41
|
+
* Server response format for WebAuthn credential creation options.
|
|
42
|
+
* Uses W3C standard JSON format with base64url-encoded binary fields.
|
|
43
|
+
*/
|
|
44
|
+
export declare type ServerCredentialCreationOptions = PublicKeyCredentialCreationOptionsJSON;
|
|
45
|
+
/**
|
|
46
|
+
* Server response format for WebAuthn credential request options.
|
|
47
|
+
* Uses W3C standard JSON format with base64url-encoded binary fields.
|
|
48
|
+
*/
|
|
49
|
+
export declare type ServerCredentialRequestOptions = PublicKeyCredentialRequestOptionsJSON;
|
|
50
|
+
/**
|
|
51
|
+
* Convert base64url encoded strings in WebAuthn credential creation options to ArrayBuffers
|
|
52
|
+
* as required by the WebAuthn browser API.
|
|
53
|
+
* Supports both native WebAuthn Level 3 parseCreationOptionsFromJSON and manual fallback.
|
|
54
|
+
*
|
|
55
|
+
* @param {ServerCredentialCreationOptions} options - JSON options from server with base64url encoded fields
|
|
56
|
+
* @returns {PublicKeyCredentialCreationOptionsFuture} Options ready for navigator.credentials.create()
|
|
57
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-parseCreationOptionsFromJSON W3C WebAuthn Spec - parseCreationOptionsFromJSON}
|
|
58
|
+
*/
|
|
59
|
+
export declare function deserializeCredentialCreationOptions(options: ServerCredentialCreationOptions): PublicKeyCredentialCreationOptionsFuture;
|
|
60
|
+
/**
|
|
61
|
+
* Convert base64url encoded strings in WebAuthn credential request options to ArrayBuffers
|
|
62
|
+
* as required by the WebAuthn browser API.
|
|
63
|
+
* Supports both native WebAuthn Level 3 parseRequestOptionsFromJSON and manual fallback.
|
|
64
|
+
*
|
|
65
|
+
* @param {ServerCredentialRequestOptions} options - JSON options from server with base64url encoded fields
|
|
66
|
+
* @returns {PublicKeyCredentialRequestOptionsFuture} Options ready for navigator.credentials.get()
|
|
67
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-parseRequestOptionsFromJSON W3C WebAuthn Spec - parseRequestOptionsFromJSON}
|
|
68
|
+
*/
|
|
69
|
+
export declare function deserializeCredentialRequestOptions(options: ServerCredentialRequestOptions): PublicKeyCredentialRequestOptionsFuture;
|
|
70
|
+
/**
|
|
71
|
+
* Server format for credential response with base64url-encoded binary fields
|
|
72
|
+
* Can be either a registration or authentication response
|
|
73
|
+
*/
|
|
74
|
+
export declare type ServerCredentialResponse = RegistrationResponseJSON | AuthenticationResponseJSON;
|
|
75
|
+
/**
|
|
76
|
+
* Convert a registration/enrollment credential response to server format.
|
|
77
|
+
* Serializes binary fields to base64url for JSON transmission.
|
|
78
|
+
* Supports both native WebAuthn Level 3 toJSON and manual fallback.
|
|
79
|
+
*
|
|
80
|
+
* @param {RegistrationCredential} credential - Credential from navigator.credentials.create()
|
|
81
|
+
* @returns {RegistrationResponseJSON} JSON-serializable credential for server
|
|
82
|
+
* @see {@link https://w3c.github.io/webauthn/#dom-publickeycredential-tojson W3C WebAuthn Spec - toJSON}
|
|
83
|
+
*/
|
|
84
|
+
export declare function serializeCredentialCreationResponse(credential: RegistrationCredential): RegistrationResponseJSON;
|
|
85
|
+
/**
|
|
86
|
+
* Convert an authentication/verification credential response to server format.
|
|
87
|
+
* Serializes binary fields to base64url for JSON transmission.
|
|
88
|
+
* Supports both native WebAuthn Level 3 toJSON and manual fallback.
|
|
89
|
+
*
|
|
90
|
+
* @param {AuthenticationCredential} credential - Credential from navigator.credentials.get()
|
|
91
|
+
* @returns {AuthenticationResponseJSON} JSON-serializable credential for server
|
|
92
|
+
* @see {@link https://w3c.github.io/webauthn/#dom-publickeycredential-tojson W3C WebAuthn Spec - toJSON}
|
|
93
|
+
*/
|
|
94
|
+
export declare function serializeCredentialRequestResponse(credential: AuthenticationCredential): AuthenticationResponseJSON;
|
|
95
|
+
/**
|
|
96
|
+
* A simple test to determine if a hostname is a properly-formatted domain name.
|
|
97
|
+
* Considers localhost valid for development environments.
|
|
98
|
+
*
|
|
99
|
+
* A "valid domain" is defined here: https://url.spec.whatwg.org/#valid-domain
|
|
100
|
+
*
|
|
101
|
+
* Regex sourced from here:
|
|
102
|
+
* https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch08s15.html
|
|
103
|
+
*
|
|
104
|
+
* @param {string} hostname - The hostname to validate
|
|
105
|
+
* @returns {boolean} True if valid domain or localhost
|
|
106
|
+
* @see {@link https://url.spec.whatwg.org/#valid-domain WHATWG URL Spec - Valid Domain}
|
|
107
|
+
*/
|
|
108
|
+
export declare function isValidDomain(hostname: string): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Create a WebAuthn credential using the browser's credentials API.
|
|
111
|
+
* Wraps navigator.credentials.create() with error handling.
|
|
112
|
+
*
|
|
113
|
+
* @param {CredentialCreationOptions} options - Options including publicKey parameters
|
|
114
|
+
* @returns {Promise<RequestResult<RegistrationCredential, WebAuthnError>>} Created credential or error
|
|
115
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-createCredential W3C WebAuthn Spec - Create Credential}
|
|
116
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/create MDN - credentials.create}
|
|
117
|
+
*/
|
|
118
|
+
export declare function createCredential(options: StrictOmit<CredentialCreationOptions, 'publicKey'> & {
|
|
119
|
+
publicKey: PublicKeyCredentialCreationOptionsFuture;
|
|
120
|
+
}): Promise<RequestResult<RegistrationCredential, WebAuthnError>>;
|
|
121
|
+
/**
|
|
122
|
+
* Get a WebAuthn credential using the browser's credentials API.
|
|
123
|
+
* Wraps navigator.credentials.get() with error handling.
|
|
124
|
+
*
|
|
125
|
+
* @param {CredentialRequestOptions} options - Options including publicKey parameters
|
|
126
|
+
* @returns {Promise<RequestResult<AuthenticationCredential, WebAuthnError>>} Retrieved credential or error
|
|
127
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-getAssertion W3C WebAuthn Spec - Get Assertion}
|
|
128
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/get MDN - credentials.get}
|
|
129
|
+
*/
|
|
130
|
+
export declare function getCredential(options: StrictOmit<CredentialRequestOptions, 'publicKey'> & {
|
|
131
|
+
publicKey: PublicKeyCredentialRequestOptionsFuture;
|
|
132
|
+
}): Promise<RequestResult<AuthenticationCredential, WebAuthnError>>;
|
|
133
|
+
export declare const DEFAULT_CREATION_OPTIONS: Partial<PublicKeyCredentialCreationOptionsFuture>;
|
|
134
|
+
export declare const DEFAULT_REQUEST_OPTIONS: Partial<PublicKeyCredentialRequestOptionsFuture>;
|
|
135
|
+
/**
|
|
136
|
+
* Merges WebAuthn credential creation options with overrides.
|
|
137
|
+
* Sets sensible defaults for authenticator selection and extensions.
|
|
138
|
+
*
|
|
139
|
+
* @param {PublicKeyCredentialCreationOptionsFuture} baseOptions - The base options from the server
|
|
140
|
+
* @param {PublicKeyCredentialCreationOptionsFuture} overrides - Optional overrides to apply
|
|
141
|
+
* @param {string} friendlyName - Optional friendly name for the credential
|
|
142
|
+
* @returns {PublicKeyCredentialCreationOptionsFuture} Merged credential creation options
|
|
143
|
+
* @see {@link https://w3c.github.io/webauthn/#dictdef-authenticatorselectioncriteria W3C WebAuthn Spec - AuthenticatorSelectionCriteria}
|
|
144
|
+
*/
|
|
145
|
+
export declare function mergeCredentialCreationOptions(baseOptions: PublicKeyCredentialCreationOptionsFuture, overrides?: Partial<PublicKeyCredentialCreationOptionsFuture>): PublicKeyCredentialCreationOptionsFuture;
|
|
146
|
+
/**
|
|
147
|
+
* Merges WebAuthn credential request options with overrides.
|
|
148
|
+
* Sets sensible defaults for user verification and hints.
|
|
149
|
+
*
|
|
150
|
+
* @param {PublicKeyCredentialRequestOptionsFuture} baseOptions - The base options from the server
|
|
151
|
+
* @param {PublicKeyCredentialRequestOptionsFuture} overrides - Optional overrides to apply
|
|
152
|
+
* @returns {PublicKeyCredentialRequestOptionsFuture} Merged credential request options
|
|
153
|
+
* @see {@link https://w3c.github.io/webauthn/#dictdef-publickeycredentialrequestoptions W3C WebAuthn Spec - PublicKeyCredentialRequestOptions}
|
|
154
|
+
*/
|
|
155
|
+
export declare function mergeCredentialRequestOptions(baseOptions: PublicKeyCredentialRequestOptionsFuture, overrides?: Partial<PublicKeyCredentialRequestOptionsFuture>): PublicKeyCredentialRequestOptionsFuture;
|
|
156
|
+
/**
|
|
157
|
+
* WebAuthn API wrapper for Supabase Auth.
|
|
158
|
+
* Provides methods for enrolling, challenging, verifying, authenticating, and registering WebAuthn credentials.
|
|
159
|
+
*
|
|
160
|
+
* @experimental This API is experimental and may change in future releases
|
|
161
|
+
* @see {@link https://w3c.github.io/webauthn/ W3C WebAuthn Specification}
|
|
162
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API MDN - Web Authentication API}
|
|
163
|
+
*/
|
|
164
|
+
export declare class WebAuthnApi {
|
|
165
|
+
private client;
|
|
166
|
+
enroll: typeof WebAuthnApi.prototype._enroll;
|
|
167
|
+
challenge: typeof WebAuthnApi.prototype._challenge;
|
|
168
|
+
verify: typeof WebAuthnApi.prototype._verify;
|
|
169
|
+
authenticate: typeof WebAuthnApi.prototype._authenticate;
|
|
170
|
+
register: typeof WebAuthnApi.prototype._register;
|
|
171
|
+
constructor(client: GoTrueClient);
|
|
172
|
+
/**
|
|
173
|
+
* Enroll a new WebAuthn factor.
|
|
174
|
+
* Creates an unverified WebAuthn factor that must be verified with a credential.
|
|
175
|
+
*
|
|
176
|
+
* @experimental This method is experimental and may change in future releases
|
|
177
|
+
* @param {Omit<MFAEnrollWebauthnParams, 'factorType'>} params - Enrollment parameters (friendlyName required)
|
|
178
|
+
* @returns {Promise<AuthMFAEnrollWebauthnResponse>} Enrolled factor details or error
|
|
179
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-registering-a-new-credential W3C WebAuthn Spec - Registering a New Credential}
|
|
180
|
+
*/
|
|
181
|
+
_enroll(params: Omit<MFAEnrollWebauthnParams, 'factorType'>): Promise<AuthMFAEnrollWebauthnResponse>;
|
|
182
|
+
/**
|
|
183
|
+
* Challenge for WebAuthn credential creation or authentication.
|
|
184
|
+
* Combines server challenge with browser credential operations.
|
|
185
|
+
* Handles both registration (create) and authentication (request) flows.
|
|
186
|
+
*
|
|
187
|
+
* @experimental This method is experimental and may change in future releases
|
|
188
|
+
* @param {MFAChallengeWebauthnParams & { friendlyName?: string; signal?: AbortSignal }} params - Challenge parameters including factorId
|
|
189
|
+
* @param {Object} overrides - Allows you to override the parameters passed to navigator.credentials
|
|
190
|
+
* @param {PublicKeyCredentialCreationOptionsFuture} overrides.create - Override options for credential creation
|
|
191
|
+
* @param {PublicKeyCredentialRequestOptionsFuture} overrides.request - Override options for credential request
|
|
192
|
+
* @returns {Promise<RequestResult>} Challenge response with credential or error
|
|
193
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-credential-creation W3C WebAuthn Spec - Credential Creation}
|
|
194
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-verifying-assertion W3C WebAuthn Spec - Verifying Assertion}
|
|
195
|
+
*/
|
|
196
|
+
_challenge({ factorId, webauthn, friendlyName, signal, }: MFAChallengeWebauthnParams & {
|
|
197
|
+
friendlyName?: string;
|
|
198
|
+
signal?: AbortSignal;
|
|
199
|
+
}, overrides?: {
|
|
200
|
+
create?: Partial<PublicKeyCredentialCreationOptionsFuture>;
|
|
201
|
+
request?: never;
|
|
202
|
+
} | {
|
|
203
|
+
create?: never;
|
|
204
|
+
request?: Partial<PublicKeyCredentialRequestOptionsFuture>;
|
|
205
|
+
}): Promise<RequestResult<{
|
|
206
|
+
factorId: string;
|
|
207
|
+
challengeId: string;
|
|
208
|
+
} & {
|
|
209
|
+
webauthn: StrictOmit<MFAVerifyWebauthnParamFields<'create' | 'request'>['webauthn'], 'rpId' | 'rpOrigins'>;
|
|
210
|
+
}, WebAuthnError | AuthError>>;
|
|
211
|
+
/**
|
|
212
|
+
* Verify a WebAuthn credential with the server.
|
|
213
|
+
* Completes the WebAuthn ceremony by sending the credential to the server for verification.
|
|
214
|
+
*
|
|
215
|
+
* @experimental This method is experimental and may change in future releases
|
|
216
|
+
* @param {Object} params - Verification parameters
|
|
217
|
+
* @param {string} params.challengeId - ID of the challenge being verified
|
|
218
|
+
* @param {string} params.factorId - ID of the WebAuthn factor
|
|
219
|
+
* @param {MFAVerifyWebauthnParams<T>['webauthn']} params.webauthn - WebAuthn credential response
|
|
220
|
+
* @returns {Promise<AuthMFAVerifyResponse>} Verification result with session or error
|
|
221
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-verifying-assertion W3C WebAuthn Spec - Verifying an Authentication Assertion}
|
|
222
|
+
* */
|
|
223
|
+
_verify<T extends 'create' | 'request'>({ challengeId, factorId, webauthn, }: {
|
|
224
|
+
challengeId: string;
|
|
225
|
+
factorId: string;
|
|
226
|
+
webauthn: MFAVerifyWebauthnParams<T>['webauthn'];
|
|
227
|
+
}): Promise<AuthMFAVerifyResponse>;
|
|
228
|
+
/**
|
|
229
|
+
* Complete WebAuthn authentication flow.
|
|
230
|
+
* Performs challenge and verification in a single operation for existing credentials.
|
|
231
|
+
*
|
|
232
|
+
* @experimental This method is experimental and may change in future releases
|
|
233
|
+
* @param {Object} params - Authentication parameters
|
|
234
|
+
* @param {string} params.factorId - ID of the WebAuthn factor to authenticate with
|
|
235
|
+
* @param {Object} params.webauthn - WebAuthn configuration
|
|
236
|
+
* @param {string} params.webauthn.rpId - Relying Party ID (defaults to current hostname)
|
|
237
|
+
* @param {string[]} params.webauthn.rpOrigins - Allowed origins (defaults to current origin)
|
|
238
|
+
* @param {AbortSignal} params.webauthn.signal - Optional abort signal
|
|
239
|
+
* @param {PublicKeyCredentialRequestOptionsFuture} overrides - Override options for navigator.credentials.get
|
|
240
|
+
* @returns {Promise<RequestResult<AuthMFAVerifyResponseData, WebAuthnError | AuthError>>} Authentication result
|
|
241
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-authentication W3C WebAuthn Spec - Authentication Ceremony}
|
|
242
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredentialRequestOptions MDN - PublicKeyCredentialRequestOptions}
|
|
243
|
+
*/
|
|
244
|
+
_authenticate({ factorId, webauthn: { rpId, rpOrigins, signal, }, }: {
|
|
245
|
+
factorId: string;
|
|
246
|
+
webauthn: {
|
|
247
|
+
rpId?: string;
|
|
248
|
+
rpOrigins?: string[];
|
|
249
|
+
signal?: AbortSignal;
|
|
250
|
+
};
|
|
251
|
+
}, overrides?: PublicKeyCredentialRequestOptionsFuture): Promise<RequestResult<AuthMFAVerifyResponseData, WebAuthnError | AuthError>>;
|
|
252
|
+
/**
|
|
253
|
+
* Complete WebAuthn registration flow.
|
|
254
|
+
* Performs enrollment, challenge, and verification in a single operation for new credentials.
|
|
255
|
+
*
|
|
256
|
+
* @experimental This method is experimental and may change in future releases
|
|
257
|
+
* @param {Object} params - Registration parameters
|
|
258
|
+
* @param {string} params.friendlyName - User-friendly name for the credential
|
|
259
|
+
* @param {string} params.rpId - Relying Party ID (defaults to current hostname)
|
|
260
|
+
* @param {string[]} params.rpOrigins - Allowed origins (defaults to current origin)
|
|
261
|
+
* @param {AbortSignal} params.signal - Optional abort signal
|
|
262
|
+
* @param {PublicKeyCredentialCreationOptionsFuture} overrides - Override options for navigator.credentials.create
|
|
263
|
+
* @returns {Promise<RequestResult<AuthMFAVerifyResponseData, WebAuthnError | AuthError>>} Registration result
|
|
264
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-registering-a-new-credential W3C WebAuthn Spec - Registration Ceremony}
|
|
265
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredentialCreationOptions MDN - PublicKeyCredentialCreationOptions}
|
|
266
|
+
*/
|
|
267
|
+
_register({ friendlyName, rpId, rpOrigins, signal, }: {
|
|
268
|
+
friendlyName: string;
|
|
269
|
+
rpId?: string;
|
|
270
|
+
rpOrigins?: string[];
|
|
271
|
+
signal?: AbortSignal;
|
|
272
|
+
}, overrides?: Partial<PublicKeyCredentialCreationOptionsFuture>): Promise<RequestResult<AuthMFAVerifyResponseData, WebAuthnError | AuthError>>;
|
|
273
|
+
}
|
|
274
|
+
//# sourceMappingURL=webauthn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webauthn.d.ts","sourceRoot":"","sources":["../../../src/lib/webauthn.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,iBAAiB,CAAA;AAE1C,OAAO,EAAE,SAAS,EAAiC,MAAM,UAAU,CAAA;AACnE,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,EAC1B,uBAAuB,EACvB,4BAA4B,EAC5B,uBAAuB,EACvB,aAAa,EACb,UAAU,EACX,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAE1B,wCAAwC,EACxC,sCAAsC,EAEtC,uCAAuC,EACvC,qCAAqC,EACrC,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,eAAe,EACf,aAAa,EAEd,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,CAAA;AAEjG,YAAY,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,CAAA;AAEpE;;;;;;GAMG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,UAAU,CAA6B;IAE/C;;;;;;OAMG;IACH,oBAAoB,IAAI,WAAW;IAanC;;;;;OAKG;IACH,cAAc,IAAI,IAAI;CAQvB;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,sBAA6B,CAAA;AAE9D;;;GAGG;AACH,oBAAY,+BAA+B,GAAG,sCAAsC,CAAA;AAEpF;;;GAGG;AACH,oBAAY,8BAA8B,GAAG,qCAAqC,CAAA;AAElF;;;;;;;;GAQG;AACH,wBAAgB,oCAAoC,CAClD,OAAO,EAAE,+BAA+B,GACvC,wCAAwC,CA0D1C;AAED;;;;;;;;GAQG;A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