ox 0.12.3 → 0.13.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/CHANGELOG.md +17 -0
- package/_cjs/core/P256.js +1 -1
- package/_cjs/core/P256.js.map +1 -1
- package/_cjs/core/WebAuthnP256.js +15 -256
- package/_cjs/core/WebAuthnP256.js.map +1 -1
- package/_cjs/core/WebCryptoP256.js +3 -1
- package/_cjs/core/WebCryptoP256.js.map +1 -1
- package/_cjs/core/internal/webauthn.js +5 -13
- package/_cjs/core/internal/webauthn.js.map +1 -1
- package/_cjs/index.docs.js +1 -0
- package/_cjs/index.docs.js.map +1 -1
- package/_cjs/tempo/TxEnvelopeTempo.js +19 -1
- package/_cjs/tempo/TxEnvelopeTempo.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_cjs/webauthn/Authentication.js +246 -0
- package/_cjs/webauthn/Authentication.js.map +1 -0
- package/_cjs/webauthn/Authenticator.js +55 -0
- package/_cjs/webauthn/Authenticator.js.map +1 -0
- package/_cjs/webauthn/Credential.js +53 -0
- package/_cjs/webauthn/Credential.js.map +1 -0
- package/_cjs/webauthn/Registration.js +349 -0
- package/_cjs/webauthn/Registration.js.map +1 -0
- package/_cjs/webauthn/Types.js +3 -0
- package/_cjs/webauthn/Types.js.map +1 -0
- package/_cjs/webauthn/index.js +9 -0
- package/_cjs/webauthn/index.js.map +1 -0
- package/_cjs/webauthn/internal/utils.js +53 -0
- package/_cjs/webauthn/internal/utils.js.map +1 -0
- package/_esm/core/P256.js +1 -1
- package/_esm/core/P256.js.map +1 -1
- package/_esm/core/WebAuthnP256.js +13 -261
- package/_esm/core/WebAuthnP256.js.map +1 -1
- package/_esm/core/WebCryptoP256.js +4 -1
- package/_esm/core/WebCryptoP256.js.map +1 -1
- package/_esm/core/internal/webauthn.js +5 -13
- package/_esm/core/internal/webauthn.js.map +1 -1
- package/_esm/erc8021/index.js +2 -2
- package/_esm/index.docs.js +1 -0
- package/_esm/index.docs.js.map +1 -1
- package/_esm/tempo/TransactionReceipt.js +1 -1
- package/_esm/tempo/TransactionRequest.js +1 -1
- package/_esm/tempo/TxEnvelopeTempo.js +20 -1
- package/_esm/tempo/TxEnvelopeTempo.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_esm/webauthn/Authentication.js +453 -0
- package/_esm/webauthn/Authentication.js.map +1 -0
- package/_esm/webauthn/Authenticator.js +176 -0
- package/_esm/webauthn/Authenticator.js.map +1 -0
- package/_esm/webauthn/Credential.js +95 -0
- package/_esm/webauthn/Credential.js.map +1 -0
- package/_esm/webauthn/Registration.js +512 -0
- package/_esm/webauthn/Registration.js.map +1 -0
- package/_esm/webauthn/Types.js +2 -0
- package/_esm/webauthn/Types.js.map +1 -0
- package/_esm/webauthn/index.js +31 -0
- package/_esm/webauthn/index.js.map +1 -0
- package/_esm/webauthn/internal/utils.js +52 -0
- package/_esm/webauthn/internal/utils.js.map +1 -0
- package/_types/core/WebAuthnP256.d.ts +33 -208
- package/_types/core/WebAuthnP256.d.ts.map +1 -1
- package/_types/core/WebCryptoP256.d.ts +2 -0
- package/_types/core/WebCryptoP256.d.ts.map +1 -1
- package/_types/core/internal/webauthn.d.ts +2 -110
- package/_types/core/internal/webauthn.d.ts.map +1 -1
- package/_types/erc8021/index.d.ts +2 -2
- package/_types/index.docs.d.ts +1 -0
- package/_types/index.docs.d.ts.map +1 -1
- package/_types/tempo/Transaction.d.ts +2 -2
- package/_types/tempo/TransactionReceipt.d.ts +2 -2
- package/_types/tempo/TransactionRequest.d.ts +2 -2
- package/_types/tempo/TxEnvelopeTempo.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/_types/webauthn/Authentication.d.ts +324 -0
- package/_types/webauthn/Authentication.d.ts.map +1 -0
- package/_types/webauthn/Authenticator.d.ts +182 -0
- package/_types/webauthn/Authenticator.d.ts.map +1 -0
- package/_types/webauthn/Credential.d.ts +77 -0
- package/_types/webauthn/Credential.d.ts.map +1 -0
- package/_types/webauthn/Registration.d.ts +308 -0
- package/_types/webauthn/Registration.d.ts.map +1 -0
- package/_types/webauthn/Types.d.ts +106 -0
- package/_types/webauthn/Types.d.ts.map +1 -0
- package/_types/webauthn/index.d.ts +33 -0
- package/_types/webauthn/index.d.ts.map +1 -0
- package/_types/webauthn/internal/utils.d.ts +17 -0
- package/_types/webauthn/internal/utils.d.ts.map +1 -0
- package/core/P256.ts +1 -1
- package/core/WebAuthnP256.ts +37 -582
- package/core/WebCryptoP256.ts +6 -1
- package/core/internal/webauthn.ts +6 -165
- package/erc8021/index.ts +2 -2
- package/index.docs.ts +1 -0
- package/package.json +31 -1
- package/tempo/Transaction.ts +2 -2
- package/tempo/TransactionReceipt.ts +2 -2
- package/tempo/TransactionRequest.ts +2 -2
- package/tempo/TxEnvelopeTempo.test.ts +6 -0
- package/tempo/TxEnvelopeTempo.ts +22 -2
- package/version.ts +1 -1
- package/webauthn/Authentication/package.json +6 -0
- package/webauthn/Authentication.ts +673 -0
- package/webauthn/Authenticator/package.json +6 -0
- package/webauthn/Authenticator.ts +259 -0
- package/webauthn/Credential/package.json +6 -0
- package/webauthn/Credential.ts +146 -0
- package/webauthn/Registration/package.json +6 -0
- package/webauthn/Registration.ts +805 -0
- package/webauthn/Types/package.json +6 -0
- package/webauthn/Types.ts +158 -0
- package/webauthn/index.ts +38 -0
- package/webauthn/internal/utils.ts +63 -0
- package/webauthn/package.json +6 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import * as Base64 from '../core/Base64.js';
|
|
2
|
+
import * as Bytes from '../core/Bytes.js';
|
|
3
|
+
import * as Cbor from '../core/Cbor.js';
|
|
4
|
+
import * as CoseKey from '../core/CoseKey.js';
|
|
5
|
+
import * as Errors from '../core/Errors.js';
|
|
6
|
+
import * as Hash from '../core/Hash.js';
|
|
7
|
+
import * as Hex from '../core/Hex.js';
|
|
8
|
+
import type { OneOf } from '../core/internal/types.js';
|
|
9
|
+
import * as internal from '../core/internal/webauthn.js';
|
|
10
|
+
import * as P256 from '../core/P256.js';
|
|
11
|
+
import * as PublicKey from '../core/PublicKey.js';
|
|
12
|
+
import * as Signature from '../core/Signature.js';
|
|
13
|
+
import type * as Credential_ from './Credential.js';
|
|
14
|
+
import type * as Types from './Types.js';
|
|
15
|
+
export declare const createChallenge: Uint8Array;
|
|
16
|
+
/** Response from a WebAuthn registration ceremony. */
|
|
17
|
+
export type Response<serialized extends boolean = false> = {
|
|
18
|
+
credential: Credential_.Credential<serialized>;
|
|
19
|
+
counter: number;
|
|
20
|
+
userVerified?: true | undefined;
|
|
21
|
+
backedUp?: boolean | undefined;
|
|
22
|
+
deviceType?: 'multiDevice' | 'singleDevice' | undefined;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new WebAuthn P256 Credential, which can be stored and later used for signing.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts twoslash
|
|
29
|
+
* import { Registration } from 'ox/webauthn'
|
|
30
|
+
*
|
|
31
|
+
* const credential = await Registration.create({ name: 'Example' }) // [!code focus]
|
|
32
|
+
* // @log: {
|
|
33
|
+
* // @log: id: 'oZ48...',
|
|
34
|
+
* // @log: publicKey: { x: 51421...5123n, y: 12345...6789n },
|
|
35
|
+
* // @log: raw: PublicKeyCredential {},
|
|
36
|
+
* // @log: }
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @param options - Credential creation options.
|
|
40
|
+
* @returns A WebAuthn P256 credential.
|
|
41
|
+
*/
|
|
42
|
+
export declare function create(options: create.Options): Promise<Credential_.Credential>;
|
|
43
|
+
export declare namespace create {
|
|
44
|
+
type Options = OneOf<(getOptions.Options & {
|
|
45
|
+
/**
|
|
46
|
+
* Credential creation function. Useful for environments that do not support
|
|
47
|
+
* the WebAuthn API natively (i.e. React Native or testing environments).
|
|
48
|
+
*
|
|
49
|
+
* @default window.navigator.credentials.create
|
|
50
|
+
*/
|
|
51
|
+
createFn?: ((options?: Types.CredentialCreationOptions | undefined) => Promise<Types.Credential | null>) | undefined;
|
|
52
|
+
}) | Types.CredentialCreationOptions>;
|
|
53
|
+
type ErrorType = getOptions.ErrorType | internal.parseCredentialPublicKey.ErrorType | Errors.GlobalErrorType;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Returns the creation options for a P256 WebAuthn Credential to be used with
|
|
57
|
+
* the Web Authentication API.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts twoslash
|
|
61
|
+
* import { Registration } from 'ox/webauthn'
|
|
62
|
+
*
|
|
63
|
+
* const options = Registration.getOptions({ name: 'Example' })
|
|
64
|
+
*
|
|
65
|
+
* const credential = await window.navigator.credentials.create(options)
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @param options - Options.
|
|
69
|
+
* @returns The credential creation options.
|
|
70
|
+
*/
|
|
71
|
+
export declare function getOptions(options: getOptions.Options): Types.CredentialCreationOptions;
|
|
72
|
+
export declare namespace getOptions {
|
|
73
|
+
type Options = {
|
|
74
|
+
/**
|
|
75
|
+
* A string specifying the relying party's preference for how the attestation statement
|
|
76
|
+
* (i.e., provision of verifiable evidence of the authenticity of the authenticator and its data)
|
|
77
|
+
* is conveyed during credential creation.
|
|
78
|
+
*/
|
|
79
|
+
attestation?: Types.PublicKeyCredentialCreationOptions['attestation'] | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* An object whose properties are criteria used to filter out the potential authenticators
|
|
82
|
+
* for the credential creation operation.
|
|
83
|
+
*/
|
|
84
|
+
authenticatorSelection?: Types.PublicKeyCredentialCreationOptions['authenticatorSelection'] | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* An `ArrayBuffer`, `TypedArray`, or `DataView` used as a cryptographic challenge.
|
|
87
|
+
*/
|
|
88
|
+
challenge?: Hex.Hex | Types.PublicKeyCredentialCreationOptions['challenge'] | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* List of credential IDs to exclude from the creation. This property can be used
|
|
91
|
+
* to prevent creation of a credential if it already exists.
|
|
92
|
+
*/
|
|
93
|
+
excludeCredentialIds?: readonly string[] | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* List of Web Authentication API credentials to use during creation or authentication.
|
|
96
|
+
*/
|
|
97
|
+
extensions?: Types.PublicKeyCredentialCreationOptions['extensions'] | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* An object describing the relying party that requested the credential creation
|
|
100
|
+
*/
|
|
101
|
+
rp?: {
|
|
102
|
+
id: string;
|
|
103
|
+
name: string;
|
|
104
|
+
} | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* A numerical hint, in milliseconds, which indicates the time the calling web app is willing to wait for the creation operation to complete.
|
|
107
|
+
*/
|
|
108
|
+
timeout?: Types.PublicKeyCredentialCreationOptions['timeout'] | undefined;
|
|
109
|
+
} & OneOf<{
|
|
110
|
+
/** Name for the credential (user.name). */
|
|
111
|
+
name: string;
|
|
112
|
+
user?: {
|
|
113
|
+
displayName?: string;
|
|
114
|
+
id?: Types.BufferSource;
|
|
115
|
+
name: string;
|
|
116
|
+
} | undefined;
|
|
117
|
+
} | {
|
|
118
|
+
name?: string | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* An object describing the user account for which the credential is generated.
|
|
121
|
+
*/
|
|
122
|
+
user: {
|
|
123
|
+
displayName?: string;
|
|
124
|
+
id?: Types.BufferSource;
|
|
125
|
+
name: string;
|
|
126
|
+
};
|
|
127
|
+
}>;
|
|
128
|
+
type ErrorType = Base64.toBytes.ErrorType | Hash.keccak256.ErrorType | Bytes.fromString.ErrorType | Errors.GlobalErrorType;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Serializes a registration response into a JSON-serializable
|
|
132
|
+
* format, converting `ArrayBuffer` fields to base64url strings
|
|
133
|
+
* and the public key to a hex string.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts twoslash
|
|
137
|
+
* import { Registration } from 'ox/webauthn'
|
|
138
|
+
*
|
|
139
|
+
* const credential = await Registration.create({ name: 'Example' })
|
|
140
|
+
* const response = Registration.verify({
|
|
141
|
+
* credential,
|
|
142
|
+
* challenge: '0x...',
|
|
143
|
+
* origin: 'https://example.com',
|
|
144
|
+
* rpId: 'example.com',
|
|
145
|
+
* })
|
|
146
|
+
*
|
|
147
|
+
* const serialized = Registration.serializeResponse(response) // [!code focus]
|
|
148
|
+
*
|
|
149
|
+
* // `serialized` is JSON-serializable — send it to a server, store it, etc.
|
|
150
|
+
* const json = JSON.stringify(serialized)
|
|
151
|
+
* ```
|
|
152
|
+
*
|
|
153
|
+
* @param response - The registration response to serialize.
|
|
154
|
+
* @returns The serialized registration response.
|
|
155
|
+
*/
|
|
156
|
+
export declare function serializeResponse(response: Response): Response<true>;
|
|
157
|
+
export declare namespace serializeResponse {
|
|
158
|
+
type ErrorType = Base64.fromBytes.ErrorType | PublicKey.toHex.ErrorType | Errors.GlobalErrorType;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Serializes credential creation options into a JSON-serializable
|
|
162
|
+
* format, converting `BufferSource` fields to base64url strings.
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```ts twoslash
|
|
166
|
+
* import { Registration } from 'ox/webauthn'
|
|
167
|
+
*
|
|
168
|
+
* const options = Registration.getOptions({ name: 'Example' })
|
|
169
|
+
*
|
|
170
|
+
* const serialized = Registration.serializeOptions(options) // [!code focus]
|
|
171
|
+
*
|
|
172
|
+
* // `serialized` is JSON-serializable — send it to a server, store it, etc.
|
|
173
|
+
* const json = JSON.stringify(serialized)
|
|
174
|
+
* ```
|
|
175
|
+
*
|
|
176
|
+
* @param options - The credential creation options to serialize.
|
|
177
|
+
* @returns The serialized credential creation options.
|
|
178
|
+
*/
|
|
179
|
+
export declare function serializeOptions(options: Types.CredentialCreationOptions): Types.CredentialCreationOptions<true>;
|
|
180
|
+
export declare namespace serializeOptions {
|
|
181
|
+
type ErrorType = Base64.fromBytes.ErrorType | Errors.GlobalErrorType;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Deserializes credential creation options that can be passed to
|
|
185
|
+
* `navigator.credentials.create()`.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```ts twoslash
|
|
189
|
+
* import { Registration } from 'ox/webauthn'
|
|
190
|
+
*
|
|
191
|
+
* const options = Registration.getOptions({ name: 'Example' })
|
|
192
|
+
* const serialized = Registration.serializeOptions(options)
|
|
193
|
+
*
|
|
194
|
+
* // ... send to server and back ...
|
|
195
|
+
*
|
|
196
|
+
* const deserialized = Registration.deserializeOptions(serialized) // [!code focus]
|
|
197
|
+
* const credential = await window.navigator.credentials.create(deserialized)
|
|
198
|
+
* ```
|
|
199
|
+
*
|
|
200
|
+
* @param options - The serialized credential creation options.
|
|
201
|
+
* @returns The deserialized credential creation options.
|
|
202
|
+
*/
|
|
203
|
+
export declare function deserializeOptions(options: Types.CredentialCreationOptions<true>): Types.CredentialCreationOptions;
|
|
204
|
+
export declare namespace deserializeOptions {
|
|
205
|
+
type ErrorType = Base64.toBytes.ErrorType | Errors.GlobalErrorType;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Deserializes a serialized registration response.
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```ts twoslash
|
|
212
|
+
* import { Registration } from 'ox/webauthn'
|
|
213
|
+
*
|
|
214
|
+
* const response = Registration.deserializeResponse({ // [!code focus]
|
|
215
|
+
* credential: { // [!code focus]
|
|
216
|
+
* attestationObject: 'o2NmbXRkbm9uZQ...', // [!code focus]
|
|
217
|
+
* clientDataJSON: 'eyJ0eXBlIjoid2Vi...', // [!code focus]
|
|
218
|
+
* id: 'm1-bMPuAqpWhCxHZQZTT6e-lSPntQbh3opIoGe7g4Qs', // [!code focus]
|
|
219
|
+
* publicKey: '0x04ab891400...', // [!code focus]
|
|
220
|
+
* raw: { id: '...', type: 'public-key', authenticatorAttachment: 'platform', rawId: '...', response: { clientDataJSON: 'eyJ0eXBlIjoid2Vi...' } }, // [!code focus]
|
|
221
|
+
* }, // [!code focus]
|
|
222
|
+
* counter: 0, // [!code focus]
|
|
223
|
+
* }) // [!code focus]
|
|
224
|
+
* ```
|
|
225
|
+
*
|
|
226
|
+
* @param response - The serialized registration response.
|
|
227
|
+
* @returns The deserialized registration response.
|
|
228
|
+
*/
|
|
229
|
+
export declare function deserializeResponse(response: Response<true>): Response;
|
|
230
|
+
export declare namespace deserializeResponse {
|
|
231
|
+
type ErrorType = Base64.toBytes.ErrorType | PublicKey.from.ErrorType | Errors.GlobalErrorType;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Verifies a WebAuthn registration (credential creation) response. Validates the
|
|
235
|
+
* `clientDataJSON`, `attestationObject`, authenticator flags, challenge, origin, and
|
|
236
|
+
* relying party ID, then extracts the credential ID and public key.
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* ```ts twoslash
|
|
240
|
+
* import { Registration } from 'ox/webauthn'
|
|
241
|
+
*
|
|
242
|
+
* const credential = await Registration.create({ name: 'Example' })
|
|
243
|
+
*
|
|
244
|
+
* const result = Registration.verify({ // [!code focus]
|
|
245
|
+
* credential, // [!code focus]
|
|
246
|
+
* challenge: '0x69abb4b5a0de4bc62a2a201f8d25bae9', // [!code focus]
|
|
247
|
+
* origin: 'https://example.com', // [!code focus]
|
|
248
|
+
* rpId: 'example.com', // [!code focus]
|
|
249
|
+
* }) // [!code focus]
|
|
250
|
+
* // @log: {
|
|
251
|
+
* // @log: credential: {
|
|
252
|
+
* // @log: id: 'oZ48...',
|
|
253
|
+
* // @log: publicKey: { prefix: 4, x: 51421...5123n, y: 12345...6789n },
|
|
254
|
+
* // @log: },
|
|
255
|
+
* // @log: counter: 0,
|
|
256
|
+
* // @log: userVerified: true,
|
|
257
|
+
* // @log: }
|
|
258
|
+
* ```
|
|
259
|
+
*
|
|
260
|
+
* @param options - Verification options.
|
|
261
|
+
* @returns The verified registration result.
|
|
262
|
+
*/
|
|
263
|
+
export declare function verify(options: verify.Options): verify.ReturnType;
|
|
264
|
+
export declare namespace verify {
|
|
265
|
+
type Options = {
|
|
266
|
+
/**
|
|
267
|
+
* Attestation verification mode.
|
|
268
|
+
* - `'required'` (default): attestation signature must be present and valid (`packed` self-attestation).
|
|
269
|
+
* - `'none'`: accept `fmt: "none"` attestation (no cryptographic binding of authData to clientDataJSON).
|
|
270
|
+
*
|
|
271
|
+
* @default 'required'
|
|
272
|
+
*/
|
|
273
|
+
attestation?: 'required' | 'none' | undefined;
|
|
274
|
+
/** The credential response from `Registration.create()`. */
|
|
275
|
+
credential: {
|
|
276
|
+
attestationObject: Credential_.Credential['attestationObject'];
|
|
277
|
+
clientDataJSON: Credential_.Credential['clientDataJSON'];
|
|
278
|
+
id?: Credential_.Credential['id'] | undefined;
|
|
279
|
+
raw?: Credential_.Credential['raw'] | undefined;
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* Challenge to verify. Either the raw hex/bytes originally generated, or a
|
|
283
|
+
* function that receives the base64url challenge string and returns whether
|
|
284
|
+
* it is valid (for async/DB lookups).
|
|
285
|
+
*/
|
|
286
|
+
challenge: Hex.Hex | Uint8Array | ((challenge: string) => boolean);
|
|
287
|
+
/** Expected origin(s) (e.g. `"https://example.com"`). */
|
|
288
|
+
origin: string | string[];
|
|
289
|
+
/** Relying party ID (e.g. `"example.com"`). */
|
|
290
|
+
rpId: string;
|
|
291
|
+
/** The user verification requirement. @default 'required' */
|
|
292
|
+
userVerification?: Types.UserVerificationRequirement | undefined;
|
|
293
|
+
};
|
|
294
|
+
type ReturnType = Response;
|
|
295
|
+
type ErrorType = Base64.toBytes.ErrorType | Base64.fromBytes.ErrorType | Bytes.fromHex.ErrorType | Bytes.isEqual.ErrorType | Cbor.decode.ErrorType | CoseKey.toPublicKey.ErrorType | Hash.sha256.ErrorType | P256.verify.ErrorType | Signature.fromDerBytes.ErrorType | VerifyError | Errors.GlobalErrorType;
|
|
296
|
+
}
|
|
297
|
+
/** Thrown when WebAuthn registration verification fails. */
|
|
298
|
+
export declare class VerifyError extends Errors.BaseError {
|
|
299
|
+
readonly name = "Registration.VerifyError";
|
|
300
|
+
}
|
|
301
|
+
/** Thrown when a WebAuthn P256 credential creation fails. */
|
|
302
|
+
export declare class CreateFailedError extends Errors.BaseError<Error> {
|
|
303
|
+
readonly name = "Registration.CreateFailedError";
|
|
304
|
+
constructor({ cause }?: {
|
|
305
|
+
cause?: Error | undefined;
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
//# sourceMappingURL=Registration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Registration.d.ts","sourceRoot":"","sources":["../../webauthn/Registration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AACzC,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AACvC,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAA;AACxD,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,KAAK,WAAW,MAAM,iBAAiB,CAAA;AASnD,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAA;AAExC,eAAO,MAAM,eAAe,YAE1B,CAAA;AAEF,sDAAsD;AACtD,MAAM,MAAM,QAAQ,CAAC,UAAU,SAAS,OAAO,GAAG,KAAK,IAAI;IACzD,UAAU,EAAE,WAAW,C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AAC7D,qBAAa,iBAAkB,SAAQ,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;IAC5D,SAAkB,IAAI,oCAAmC;gBAE7C,EAAE,KAAK,EAAE,GAAE;QAAE,KAAK,CAAC,EAAE,KAAK,GAAG,SAAS,CAAA;KAAO;CAK1D"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type * as Hex from '../core/Hex.js';
|
|
2
|
+
export type AttestationConveyancePreference = 'direct' | 'enterprise' | 'indirect' | 'none';
|
|
3
|
+
export type AuthenticatorAttachment = 'cross-platform' | 'platform';
|
|
4
|
+
export type AuthenticatorTransport = 'ble' | 'hybrid' | 'internal' | 'nfc' | 'usb';
|
|
5
|
+
export type COSEAlgorithmIdentifier = number;
|
|
6
|
+
export type CredentialMediationRequirement = 'conditional' | 'optional' | 'required' | 'silent';
|
|
7
|
+
export type PublicKeyCredentialType = 'public-key';
|
|
8
|
+
export type ResidentKeyRequirement = 'discouraged' | 'preferred' | 'required';
|
|
9
|
+
export type UserVerificationRequirement = 'discouraged' | 'preferred' | 'required';
|
|
10
|
+
export type LargeBlobSupport = {
|
|
11
|
+
support: 'required' | 'preferred';
|
|
12
|
+
};
|
|
13
|
+
export type BufferSource = ArrayBufferView | ArrayBuffer;
|
|
14
|
+
export type PrfExtension = Record<'eval', Record<'first', Uint8Array>>;
|
|
15
|
+
export interface AuthenticationExtensionsClientInputs<serialized extends boolean = false> {
|
|
16
|
+
appid?: string;
|
|
17
|
+
credProps?: boolean;
|
|
18
|
+
hmacCreateSecret?: boolean;
|
|
19
|
+
minPinLength?: boolean;
|
|
20
|
+
prf?: serialized extends true ? {
|
|
21
|
+
eval: {
|
|
22
|
+
first: string;
|
|
23
|
+
};
|
|
24
|
+
} : PrfExtension;
|
|
25
|
+
largeBlob?: LargeBlobSupport;
|
|
26
|
+
}
|
|
27
|
+
export interface AuthenticatorSelectionCriteria {
|
|
28
|
+
authenticatorAttachment?: AuthenticatorAttachment;
|
|
29
|
+
requireResidentKey?: boolean;
|
|
30
|
+
residentKey?: ResidentKeyRequirement;
|
|
31
|
+
userVerification?: UserVerificationRequirement;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Available only in secure contexts.
|
|
35
|
+
*
|
|
36
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAttestationResponse)
|
|
37
|
+
*/
|
|
38
|
+
export interface AuthenticatorAttestationResponse<serialized extends boolean = false> extends AuthenticatorResponse<serialized> {
|
|
39
|
+
readonly attestationObject: serialized extends true ? string : ArrayBuffer;
|
|
40
|
+
getAuthenticatorData(): ArrayBuffer;
|
|
41
|
+
getPublicKey(): ArrayBuffer | null;
|
|
42
|
+
getPublicKeyAlgorithm(): COSEAlgorithmIdentifier;
|
|
43
|
+
getTransports(): string[];
|
|
44
|
+
}
|
|
45
|
+
export interface AuthenticatorResponse<serialized extends boolean = false> {
|
|
46
|
+
readonly clientDataJSON: serialized extends true ? string : ArrayBuffer;
|
|
47
|
+
}
|
|
48
|
+
export interface Credential {
|
|
49
|
+
readonly id: string;
|
|
50
|
+
readonly type: string;
|
|
51
|
+
}
|
|
52
|
+
export interface CredentialCreationOptions<serialized extends boolean = false> {
|
|
53
|
+
publicKey?: PublicKeyCredentialCreationOptions<serialized>;
|
|
54
|
+
signal?: AbortSignal;
|
|
55
|
+
}
|
|
56
|
+
export interface CredentialRequestOptions<serialized extends boolean = false> {
|
|
57
|
+
mediation?: CredentialMediationRequirement;
|
|
58
|
+
publicKey?: PublicKeyCredentialRequestOptions<serialized>;
|
|
59
|
+
signal?: AbortSignal;
|
|
60
|
+
}
|
|
61
|
+
export type PublicKeyCredential<serialized extends boolean = false> = Credential & {
|
|
62
|
+
readonly authenticatorAttachment: string | null;
|
|
63
|
+
readonly rawId: serialized extends true ? string : ArrayBuffer;
|
|
64
|
+
readonly response: AuthenticatorResponse<serialized>;
|
|
65
|
+
} & (serialized extends true ? {} : {
|
|
66
|
+
getClientExtensionResults(): AuthenticationExtensionsClientOutputs;
|
|
67
|
+
});
|
|
68
|
+
export interface PublicKeyCredentialCreationOptions<serialized extends boolean = false> {
|
|
69
|
+
attestation?: AttestationConveyancePreference;
|
|
70
|
+
authenticatorSelection?: AuthenticatorSelectionCriteria;
|
|
71
|
+
challenge: serialized extends true ? Hex.Hex : BufferSource;
|
|
72
|
+
excludeCredentials?: PublicKeyCredentialDescriptor<serialized>[];
|
|
73
|
+
extensions?: AuthenticationExtensionsClientInputs<serialized>;
|
|
74
|
+
pubKeyCredParams: PublicKeyCredentialParameters[];
|
|
75
|
+
rp: PublicKeyCredentialRpEntity;
|
|
76
|
+
timeout?: number;
|
|
77
|
+
user: PublicKeyCredentialUserEntity<serialized>;
|
|
78
|
+
}
|
|
79
|
+
export interface PublicKeyCredentialDescriptor<serialized extends boolean = false> {
|
|
80
|
+
id: serialized extends true ? string : BufferSource;
|
|
81
|
+
transports?: AuthenticatorTransport[];
|
|
82
|
+
type: PublicKeyCredentialType;
|
|
83
|
+
}
|
|
84
|
+
export interface PublicKeyCredentialEntity {
|
|
85
|
+
name: string;
|
|
86
|
+
}
|
|
87
|
+
export interface PublicKeyCredentialParameters {
|
|
88
|
+
alg: COSEAlgorithmIdentifier;
|
|
89
|
+
type: PublicKeyCredentialType;
|
|
90
|
+
}
|
|
91
|
+
export interface PublicKeyCredentialRequestOptions<serialized extends boolean = false> {
|
|
92
|
+
allowCredentials?: PublicKeyCredentialDescriptor<serialized>[];
|
|
93
|
+
challenge: serialized extends true ? Hex.Hex : BufferSource;
|
|
94
|
+
extensions?: AuthenticationExtensionsClientInputs<serialized>;
|
|
95
|
+
rpId?: string;
|
|
96
|
+
timeout?: number;
|
|
97
|
+
userVerification?: UserVerificationRequirement;
|
|
98
|
+
}
|
|
99
|
+
export interface PublicKeyCredentialRpEntity extends PublicKeyCredentialEntity {
|
|
100
|
+
id: string;
|
|
101
|
+
}
|
|
102
|
+
export interface PublicKeyCredentialUserEntity<serialized extends boolean = false> extends PublicKeyCredentialEntity {
|
|
103
|
+
displayName: string;
|
|
104
|
+
id: serialized extends true ? string : BufferSource;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=Types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../webauthn/Types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,gBAAgB,CAAA;AAE1C,MAAM,MAAM,+BAA+B,GACvC,QAAQ,GACR,YAAY,GACZ,UAAU,GACV,MAAM,CAAA;AAEV,MAAM,MAAM,uBAAuB,GAAG,gBAAgB,GAAG,UAAU,CAAA;AAEnE,MAAM,MAAM,sBAAsB,GAC9B,KAAK,GACL,QAAQ,GACR,UAAU,GACV,KAAK,GACL,KAAK,CAAA;AAET,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAA;AAE5C,MAAM,MAAM,8BAA8B,GACtC,aAAa,GACb,UAAU,GACV,UAAU,GACV,QAAQ,CAAA;AAEZ,MAAM,MAAM,uBAAuB,GAAG,YAAY,CAAA;AAElD,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAA;AAE7E,MAAM,MAAM,2BAA2B,GACnC,aAAa,GACb,WAAW,GACX,UAAU,CAAA;AAEd,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,UAAU,GAAG,WAAW,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG,WAAW,CAAA;AAExD,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAA;AAEtE,MAAM,WAAW,oCAAoC,CACnD,UAAU,SAAS,OAAO,GAAG,KAAK;IAElC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,YAAY,CAAC,EAA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,CAAA;CAC9B;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,6BAA6B;IAC5C,GAAG,EAAE,uBAAuB,CAAA;IAC5B,IAAI,EAAE,uBAAuB,CAAA;CAC9B;AAED,MAAM,WAAW,iCAAiC,CAChD,UAAU,SAAS,OAAO,GAAG,KAAK;IAElC,gBAAgB,CAAC,EAAE,6BAA6B,CAAC,UAAU,CAAC,EAAE,CAAA;IAC9D,SAAS,EAAE,UAAU,SAAS,IAAI,GAAG,GAAG,CAAC,GAAG,GAAG,YAAY,CAAA;IAC3D,UAAU,CAAC,EAAE,oCAAoC,CAAC,UAAU,CAAC,CAAA;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gBAAgB,CAAC,EAAE,2BAA2B,CAAA;CAC/C;AAED,MAAM,WAAW,2BAA4B,SAAQ,yBAAyB;IAC5E,EAAE,EAAE,MAAM,CAAA;CACX;AAED,MAAM,WAAW,6BAA6B,CAC5C,UAAU,SAAS,OAAO,GAAG,KAAK,CAClC,SAAQ,yBAAyB;IACjC,WAAW,EAAE,MAAM,CAAA;IACnB,EAAE,EAAE,UAAU,SAAS,IAAI,GAAG,MAAM,GAAG,YAAY,CAAA;CACpD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** @entrypointCategory WebAuthn */
|
|
2
|
+
export type {};
|
|
3
|
+
/**
|
|
4
|
+
* Utility functions and types for WebAuthn authentication ceremonies (signing and verification).
|
|
5
|
+
*
|
|
6
|
+
* @category WebAuthn
|
|
7
|
+
*/
|
|
8
|
+
export * as Authentication from './Authentication.js';
|
|
9
|
+
/**
|
|
10
|
+
* Utility functions for constructing and parsing authenticator data and client data JSON.
|
|
11
|
+
*
|
|
12
|
+
* @category WebAuthn
|
|
13
|
+
*/
|
|
14
|
+
export * as Authenticator from './Authenticator.js';
|
|
15
|
+
/**
|
|
16
|
+
* Utility functions and types for WebAuthn P256 credentials.
|
|
17
|
+
*
|
|
18
|
+
* @category WebAuthn
|
|
19
|
+
*/
|
|
20
|
+
export * as Credential from './Credential.js';
|
|
21
|
+
/**
|
|
22
|
+
* Utility functions and types for WebAuthn registration ceremonies (credential creation and verification).
|
|
23
|
+
*
|
|
24
|
+
* @category WebAuthn
|
|
25
|
+
*/
|
|
26
|
+
export * as Registration from './Registration.js';
|
|
27
|
+
/**
|
|
28
|
+
* WebAuthn type definitions.
|
|
29
|
+
*
|
|
30
|
+
* @category WebAuthn
|
|
31
|
+
*/
|
|
32
|
+
export * as Types from './Types.js';
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../webauthn/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC,YAAY,EAAE,CAAA;AAEd;;;;GAIG;AACH,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AAErD;;;;GAIG;AACH,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AAEnD;;;;GAIG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C;;;;GAIG;AACH,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AAEjD;;;;GAIG;AACH,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type * as Types from '../Types.js';
|
|
2
|
+
/** @internal */
|
|
3
|
+
export declare const base64UrlOptions: {
|
|
4
|
+
readonly url: true;
|
|
5
|
+
readonly pad: false;
|
|
6
|
+
};
|
|
7
|
+
/** @internal */
|
|
8
|
+
export declare const responseKeys: readonly ["attestationObject", "authenticatorData", "clientDataJSON", "signature", "userHandle"];
|
|
9
|
+
/** @internal */
|
|
10
|
+
export declare function bytesToArrayBuffer(bytes: Uint8Array): ArrayBuffer;
|
|
11
|
+
/** @internal */
|
|
12
|
+
export declare function bufferSourceToBytes(source: Types.BufferSource): Uint8Array;
|
|
13
|
+
/** @internal */
|
|
14
|
+
export declare function serializeExtensions(extensions: Types.AuthenticationExtensionsClientInputs): Types.AuthenticationExtensionsClientInputs<true>;
|
|
15
|
+
/** @internal */
|
|
16
|
+
export declare function deserializeExtensions(extensions: Types.AuthenticationExtensionsClientInputs<true>): Types.AuthenticationExtensionsClientInputs;
|
|
17
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../webauthn/internal/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAA;AAEzC,gBAAgB;AAChB,eAAO,MAAM,gBAAgB;;;CAAqC,CAAA;AAElE,gBAAgB;AAChB,eAAO,MAAM,YAAY,kGAMf,CAAA;AAEV,gBAAgB;AAChB,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,CAKjE;AAED,gBAAgB;AAChB,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,YAAY,GAAG,UAAU,CAI1E;AAED,gBAAgB;AAChB,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,KAAK,CAAC,oCAAoC,GACrD,KAAK,CAAC,oCAAoC,CAAC,IAAI,CAAC,CAYlD;AAED,gBAAgB;AAChB,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,KAAK,CAAC,oCAAoC,CAAC,IAAI,CAAC,GAC3D,KAAK,CAAC,oCAAoC,CAY5C"}
|
package/core/P256.ts
CHANGED
|
@@ -336,7 +336,7 @@ export function verify(options: verify.Options): boolean {
|
|
|
336
336
|
signature,
|
|
337
337
|
payload instanceof Uint8Array ? payload : Bytes.fromHex(payload),
|
|
338
338
|
PublicKey.toHex(publicKey).substring(2),
|
|
339
|
-
...(hash ?
|
|
339
|
+
{ lowS: true, ...(hash ? { prehash: true } : {}) },
|
|
340
340
|
)
|
|
341
341
|
}
|
|
342
342
|
|