ox 1.1.2 → 1.3.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 +61 -0
- package/dist/core/AbiFunction.d.ts +1 -1
- package/dist/core/AbiFunction.d.ts.map +1 -1
- package/dist/core/AbiFunction.js +6 -2
- package/dist/core/AbiFunction.js.map +1 -1
- package/dist/core/AbiParameters.d.ts +1 -1
- package/dist/core/AbiParameters.d.ts.map +1 -1
- package/dist/core/AbiParameters.js +1 -13
- package/dist/core/AbiParameters.js.map +1 -1
- package/dist/core/AesGcm.d.ts +36 -1
- package/dist/core/AesGcm.d.ts.map +1 -1
- package/dist/core/AesGcm.js +44 -0
- package/dist/core/AesGcm.js.map +1 -1
- package/dist/core/Ed25519.d.ts +46 -1
- package/dist/core/Ed25519.d.ts.map +1 -1
- package/dist/core/Ed25519.js +43 -0
- package/dist/core/Ed25519.js.map +1 -1
- package/dist/core/Engine.d.ts +1 -1
- package/dist/core/Engine.d.ts.map +1 -1
- package/dist/core/Engine.js.map +1 -1
- package/dist/core/Hash.d.ts +200 -1
- package/dist/core/Hash.d.ts.map +1 -1
- package/dist/core/Hash.js +207 -0
- package/dist/core/Hash.js.map +1 -1
- package/dist/core/Hex.d.ts.map +1 -1
- package/dist/core/Hex.js +1 -4
- package/dist/core/Hex.js.map +1 -1
- package/dist/core/Rlp.d.ts +32 -0
- package/dist/core/Rlp.d.ts.map +1 -1
- package/dist/core/Rlp.js +146 -0
- package/dist/core/Rlp.js.map +1 -1
- package/dist/core/Secp256k1.d.ts +46 -1
- package/dist/core/Secp256k1.d.ts.map +1 -1
- package/dist/core/Secp256k1.js +48 -0
- package/dist/core/Secp256k1.js.map +1 -1
- package/dist/core/WebAuthn.d.ts +224 -0
- package/dist/core/WebAuthn.d.ts.map +1 -0
- package/dist/core/WebAuthn.js +343 -0
- package/dist/core/WebAuthn.js.map +1 -0
- package/dist/core/WebAuthnP256.d.ts +46 -50
- package/dist/core/WebAuthnP256.d.ts.map +1 -1
- package/dist/core/WebAuthnP256.js +44 -50
- package/dist/core/WebAuthnP256.js.map +1 -1
- package/dist/core/internal/abiParameters.d.ts +7 -87
- package/dist/core/internal/abiParameters.d.ts.map +1 -1
- package/dist/core/internal/abiParameters.js +339 -194
- package/dist/core/internal/abiParameters.js.map +1 -1
- package/dist/core/internal/engine.d.ts +35 -2
- package/dist/core/internal/engine.d.ts.map +1 -1
- package/dist/core/internal/engine.js +12 -1
- package/dist/core/internal/engine.js.map +1 -1
- package/dist/core/internal/hash.d.ts +10 -0
- package/dist/core/internal/hash.d.ts.map +1 -1
- package/dist/core/internal/hash.js +26 -1
- package/dist/core/internal/hash.js.map +1 -1
- package/dist/index.d.ts +23 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -14
- package/dist/index.js.map +1 -1
- package/dist/node/Engine.d.ts +1 -1
- package/dist/node/Engine.d.ts.map +1 -1
- package/dist/node/Engine.js.map +1 -1
- package/dist/node/Hash.d.ts +6 -4
- package/dist/node/Hash.d.ts.map +1 -1
- package/dist/node/Hash.js +35 -3
- package/dist/node/Hash.js.map +1 -1
- package/dist/tempo/AuthorizationTempo.d.ts +6 -6
- package/dist/tempo/AuthorizationTempo.js +6 -6
- package/dist/tempo/KeyAuthorization.d.ts +3 -8
- package/dist/tempo/KeyAuthorization.d.ts.map +1 -1
- package/dist/tempo/KeyAuthorization.js +3 -8
- package/dist/tempo/KeyAuthorization.js.map +1 -1
- package/dist/tempo/SignatureEnvelope.d.ts +8 -8
- package/dist/tempo/SignatureEnvelope.js +8 -8
- package/dist/trusted-setups/Paths.d.ts +1 -0
- package/dist/trusted-setups/Paths.d.ts.map +1 -1
- package/dist/trusted-setups/Paths.js +1 -0
- package/dist/trusted-setups/Paths.js.map +1 -1
- package/dist/trusted-setups/Setups.d.ts +35 -0
- package/dist/trusted-setups/Setups.d.ts.map +1 -0
- package/dist/trusted-setups/Setups.js +29 -0
- package/dist/trusted-setups/Setups.js.map +1 -0
- package/dist/trusted-setups/index.d.ts +20 -0
- package/dist/trusted-setups/index.d.ts.map +1 -1
- package/dist/trusted-setups/index.js +20 -0
- package/dist/trusted-setups/index.js.map +1 -1
- package/dist/trusted-setups/internal/paths.d.ts.map +1 -1
- package/dist/trusted-setups/internal/paths.js +1 -1
- package/dist/trusted-setups/internal/paths.js.map +1 -1
- package/dist/trusted-setups/internal/setups/mainnet.d.ts +7 -0
- package/dist/trusted-setups/internal/setups/mainnet.d.ts.map +1 -0
- package/dist/trusted-setups/internal/setups/mainnet.js +11 -0
- package/dist/trusted-setups/internal/setups/mainnet.js.map +1 -0
- package/dist/wasm/Engine.d.ts +4 -3
- package/dist/wasm/Engine.d.ts.map +1 -1
- package/dist/wasm/Engine.js +5 -5
- package/dist/wasm/Engine.js.map +1 -1
- package/dist/wasm/Hash.d.ts +1 -1
- package/dist/wasm/Hash.d.ts.map +1 -1
- package/dist/wasm/Hash.js +5 -0
- package/dist/wasm/Hash.js.map +1 -1
- package/dist/wasm/Keystore.d.ts +23 -9
- package/dist/wasm/Keystore.d.ts.map +1 -1
- package/dist/wasm/Keystore.js +30 -13
- package/dist/wasm/Keystore.js.map +1 -1
- package/dist/wasm/Kzg.d.ts +112 -0
- package/dist/wasm/Kzg.d.ts.map +1 -0
- package/dist/wasm/Kzg.js +333 -0
- package/dist/wasm/Kzg.js.map +1 -0
- package/dist/wasm/Secp256k1.d.ts +55 -0
- package/dist/wasm/Secp256k1.d.ts.map +1 -0
- package/dist/wasm/Secp256k1.js +181 -0
- package/dist/wasm/Secp256k1.js.map +1 -0
- package/dist/wasm/index.d.ts +44 -1
- package/dist/wasm/index.d.ts.map +1 -1
- package/dist/wasm/index.js +44 -1
- package/dist/wasm/index.js.map +1 -1
- package/dist/wasm/internal/blake3.d.ts +10 -1
- package/dist/wasm/internal/blake3.d.ts.map +1 -1
- package/dist/wasm/internal/blake3.js +12 -1
- package/dist/wasm/internal/blake3.js.map +1 -1
- package/dist/wasm/internal/blake3.wasm.d.ts +3 -1
- package/dist/wasm/internal/blake3.wasm.d.ts.map +1 -1
- package/dist/wasm/internal/blake3.wasm.js +3 -1
- package/dist/wasm/internal/blake3.wasm.js.map +1 -1
- package/dist/wasm/internal/hash.d.ts +9 -0
- package/dist/wasm/internal/hash.d.ts.map +1 -1
- package/dist/wasm/internal/hash.js +13 -1
- package/dist/wasm/internal/hash.js.map +1 -1
- package/dist/wasm/internal/hashState.d.ts +25 -0
- package/dist/wasm/internal/hashState.d.ts.map +1 -0
- package/dist/wasm/internal/hashState.js +105 -0
- package/dist/wasm/internal/hashState.js.map +1 -0
- package/dist/wasm/internal/hashes.d.ts +12 -1
- package/dist/wasm/internal/hashes.d.ts.map +1 -1
- package/dist/wasm/internal/hashes.js +18 -1
- package/dist/wasm/internal/hashes.js.map +1 -1
- package/dist/wasm/internal/hashes.wasm.d.ts +11 -3
- package/dist/wasm/internal/hashes.wasm.d.ts.map +1 -1
- package/dist/wasm/internal/hashes.wasm.js +11 -3
- package/dist/wasm/internal/hashes.wasm.js.map +1 -1
- package/dist/wasm/internal/instantiate.d.ts +12 -0
- package/dist/wasm/internal/instantiate.d.ts.map +1 -1
- package/dist/wasm/internal/instantiate.js +23 -7
- package/dist/wasm/internal/instantiate.js.map +1 -1
- package/dist/wasm/internal/keystore.d.ts +10 -0
- package/dist/wasm/internal/keystore.d.ts.map +1 -0
- package/dist/wasm/internal/keystore.js +10 -0
- package/dist/wasm/internal/keystore.js.map +1 -0
- package/dist/wasm/internal/kzg.d.ts +17 -0
- package/dist/wasm/internal/kzg.d.ts.map +1 -0
- package/dist/wasm/internal/kzg.js +8 -0
- package/dist/wasm/internal/kzg.js.map +1 -0
- package/dist/wasm/internal/kzg.wasm.d.ts +3 -0
- package/dist/wasm/internal/kzg.wasm.d.ts.map +1 -0
- package/dist/wasm/internal/kzg.wasm.js +10 -0
- package/dist/wasm/internal/kzg.wasm.js.map +1 -0
- package/dist/wasm/internal/scrypt.d.ts +16 -0
- package/dist/wasm/internal/scrypt.d.ts.map +1 -0
- package/dist/wasm/internal/scrypt.js +78 -0
- package/dist/wasm/internal/scrypt.js.map +1 -0
- package/dist/wasm/internal/scrypt.wasm.d.ts +7 -0
- package/dist/wasm/internal/scrypt.wasm.d.ts.map +1 -0
- package/dist/wasm/internal/scrypt.wasm.js +14 -0
- package/dist/wasm/internal/scrypt.wasm.js.map +1 -0
- package/dist/wasm/internal/secp256k1.d.ts +16 -0
- package/dist/wasm/internal/secp256k1.d.ts.map +1 -0
- package/dist/wasm/internal/secp256k1.js +20 -0
- package/dist/wasm/internal/secp256k1.js.map +1 -0
- package/dist/wasm/internal/secp256k1.wasm.d.ts +3 -0
- package/dist/wasm/internal/secp256k1.wasm.d.ts.map +1 -0
- package/dist/wasm/internal/secp256k1.wasm.js +10 -0
- package/dist/wasm/internal/secp256k1.wasm.js.map +1 -0
- package/dist/webauthn/Authentication.d.ts +2 -0
- package/dist/webauthn/Authentication.d.ts.map +1 -1
- package/dist/webauthn/Authentication.js +2 -1
- package/dist/webauthn/Authentication.js.map +1 -1
- package/dist/webauthn/Registration.d.ts.map +1 -1
- package/dist/webauthn/Registration.js +2 -1
- package/dist/webauthn/Registration.js.map +1 -1
- package/dist/webauthn/Types.d.ts +27 -6
- package/dist/webauthn/Types.d.ts.map +1 -1
- package/dist/webauthn/internal/utils.d.ts.map +1 -1
- package/dist/webauthn/internal/utils.js +35 -9
- package/dist/webauthn/internal/utils.js.map +1 -1
- package/dist/zod/TypedData.d.ts +2 -2
- package/package.json +27 -2
- package/src/benchmarks/Ox.bench.ts +6 -0
- package/src/benchmarks/OxNode.bench.ts +8 -0
- package/src/benchmarks/OxV0.bench.ts +4 -0
- package/src/benchmarks/OxWasm.bench.ts +22 -0
- package/src/core/AbiFunction.ts +5 -5
- package/src/core/AbiParameters.ts +8 -20
- package/src/core/AesGcm.ts +86 -1
- package/src/core/Ed25519.ts +87 -1
- package/src/core/Engine.ts +1 -0
- package/src/core/Hash.ts +321 -1
- package/src/core/Hex.ts +1 -4
- package/src/core/Rlp.ts +172 -5
- package/src/core/Secp256k1.ts +92 -1
- package/src/core/WebAuthn.ts +579 -0
- package/src/core/WebAuthnP256.ts +47 -50
- package/src/core/_test/AbiFunction.test.ts +9 -0
- package/src/core/_test/AbiParameters.differential.fuzz.ts +156 -0
- package/src/core/_test/AbiParameters.encode.test.ts +22 -0
- package/src/core/_test/AbiParameters.fuzz.ts +4 -0
- package/src/core/_test/AesGcm.test.ts +76 -0
- package/src/core/_test/Block.test.ts +9 -2
- package/src/core/_test/Ed25519.test-d.ts +13 -1
- package/src/core/_test/Ed25519.test.ts +120 -1
- package/src/core/_test/Engine.test-d.ts +9 -0
- package/src/core/_test/Engine.test.ts +1 -1
- package/src/core/_test/Hash.test-d.ts +41 -0
- package/src/core/_test/Hash.test.ts +278 -1
- package/src/core/_test/Hash.vectors.test.ts +1 -2
- package/src/core/_test/Hex.test.ts +2 -0
- package/src/core/_test/Rlp.test-d.ts +18 -0
- package/src/core/_test/Rlp.test.ts +109 -0
- package/src/core/_test/Secp256k1.test-d.ts +14 -0
- package/src/core/_test/Secp256k1.test.ts +91 -1
- package/src/core/_test/Transaction.test.ts +11 -2
- package/src/core/_test/WebAuthn.test-d.ts +142 -0
- package/src/core/_test/WebAuthn.test.ts +766 -0
- package/src/core/_test/index.test.ts +1 -0
- package/src/core/internal/abiParameters.ts +466 -326
- package/src/core/internal/engine.ts +47 -2
- package/src/core/internal/hash.ts +53 -1
- package/src/index.ts +24 -14
- package/src/node/Engine.ts +1 -0
- package/src/node/Hash.ts +43 -6
- package/src/node/_test/Engine.test-d.ts +1 -0
- package/src/node/_test/Engine.test.ts +2 -0
- package/src/node/_test/Hash.test-d.ts +11 -0
- package/src/node/_test/Hash.test.ts +46 -0
- package/src/tempo/AuthorizationTempo.ts +6 -6
- package/src/tempo/KeyAuthorization.ts +3 -8
- package/src/tempo/SignatureEnvelope.ts +8 -8
- package/src/trusted-setups/Paths.ts +1 -0
- package/src/trusted-setups/README.md +39 -0
- package/src/trusted-setups/Setups.ts +46 -0
- package/src/trusted-setups/_test/Paths.test.ts +16 -0
- package/src/trusted-setups/_test/Setups.test-d.ts +7 -0
- package/src/trusted-setups/_test/Setups.test.ts +43 -0
- package/src/trusted-setups/_test/index.test.ts +1 -0
- package/src/trusted-setups/index.ts +21 -0
- package/src/trusted-setups/internal/paths.ts +4 -1
- package/src/trusted-setups/internal/setups/mainnet.source.json +7 -0
- package/src/trusted-setups/internal/setups/mainnet.ts +16 -0
- package/src/version.ts +1 -1
- package/src/wasm/Engine.ts +9 -6
- package/src/wasm/Hash.ts +10 -0
- package/src/wasm/Keystore.bench.ts +26 -0
- package/src/wasm/Keystore.ts +32 -14
- package/src/wasm/Kzg.bench.ts +63 -0
- package/src/wasm/Kzg.ts +518 -0
- package/src/wasm/Secp256k1.bench.ts +79 -0
- package/src/wasm/Secp256k1.ts +248 -0
- package/src/wasm/_test/Engine.test-d.ts +2 -0
- package/src/wasm/_test/Engine.test.ts +5 -0
- package/src/wasm/_test/Hash.browser.test.ts +31 -0
- package/src/wasm/_test/Hash.test-d.ts +17 -0
- package/src/wasm/_test/Hash.test.ts +252 -3
- package/src/wasm/_test/Keystore.browser.test.ts +31 -0
- package/src/wasm/_test/Keystore.fuzz.ts +50 -0
- package/src/wasm/_test/Keystore.test-d.ts +10 -1
- package/src/wasm/_test/Keystore.test.ts +289 -4
- package/src/wasm/_test/Kzg.test-d.ts +19 -0
- package/src/wasm/_test/Kzg.test.ts +220 -0
- package/src/wasm/_test/Runtime.test.ts +9 -0
- package/src/wasm/_test/Secp256k1.test-d.ts +35 -0
- package/src/wasm/_test/Secp256k1.test.ts +354 -0
- package/src/wasm/index.ts +46 -1
- package/src/wasm/internal/blake3.ts +23 -2
- package/src/wasm/internal/blake3.wasm.ts +4 -1
- package/src/wasm/internal/hash.ts +27 -1
- package/src/wasm/internal/hashState.ts +154 -0
- package/src/wasm/internal/hashes.ts +56 -15
- package/src/wasm/internal/hashes.wasm.ts +15 -3
- package/src/wasm/internal/instantiate.ts +29 -9
- package/src/wasm/internal/keystore.ts +19 -0
- package/src/wasm/internal/kzg.ts +50 -0
- package/src/wasm/internal/kzg.wasm.ts +11 -0
- package/src/wasm/internal/scrypt.ts +131 -0
- package/src/wasm/internal/scrypt.wasm.ts +17 -0
- package/src/wasm/internal/secp256k1.ts +62 -0
- package/src/wasm/internal/secp256k1.wasm.ts +11 -0
- package/src/webauthn/Authentication.ts +4 -0
- package/src/webauthn/Registration.ts +2 -0
- package/src/webauthn/Types.ts +32 -2
- package/src/webauthn/_test/Authentication.test.ts +123 -1
- package/src/webauthn/_test/Registration.test.ts +26 -6
- package/src/webauthn/_test/WebAuthn.browser.test.ts +28 -0
- package/src/webauthn/internal/utils.ts +41 -8
- package/wasm/vendor/c-kzg-4844/LICENSE +201 -0
- package/wasm/vendor/c-kzg-4844/blst/LICENSE +201 -0
- package/src/trusted-setups/internal/setups/mainnet.txt +0 -4163
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import * as Bytes from './Bytes.js';
|
|
2
|
+
import * as Errors from './Errors.js';
|
|
3
|
+
import * as Hex from './Hex.js';
|
|
4
|
+
import type { UnionOmit } from './internal/types.js';
|
|
5
|
+
import * as Authentication from '../webauthn/Authentication.js';
|
|
6
|
+
import type * as Credential from '../webauthn/Credential.js';
|
|
7
|
+
import * as Registration from '../webauthn/Registration.js';
|
|
8
|
+
import type * as Types from '../webauthn/Types.js';
|
|
9
|
+
export * from './WebAuthnP256.js';
|
|
10
|
+
/** Configuration for evaluating a WebAuthn credential-bound PRF. */
|
|
11
|
+
export type Prf = true | {
|
|
12
|
+
/**
|
|
13
|
+
* Application-owned PRF input.
|
|
14
|
+
*
|
|
15
|
+
* Use the same input to reproduce an output. Store unpredictable inputs
|
|
16
|
+
* with the credential metadata.
|
|
17
|
+
*/
|
|
18
|
+
input: Bytes.Bytes;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Creates a WebAuthn credential and optionally returns its credential-bound
|
|
22
|
+
* PRF output.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts twoslash
|
|
26
|
+
* import { Secp256k1, WebAuthn } from 'ox'
|
|
27
|
+
*
|
|
28
|
+
* const credential = await WebAuthn.createCredential({
|
|
29
|
+
* name: 'Example',
|
|
30
|
+
* prf: true
|
|
31
|
+
* })
|
|
32
|
+
* const privateKey = Secp256k1.fromPrf(credential.prf)
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* `prf: true` uses the stable input `ox.webauthn.prf.v1`. Pass
|
|
36
|
+
* `{ input }` to use an application-owned input instead.
|
|
37
|
+
*
|
|
38
|
+
* When credential creation enables PRF but does not return an output, this
|
|
39
|
+
* function performs a follow-up assertion. The user may be prompted twice.
|
|
40
|
+
*
|
|
41
|
+
* If PRF evaluation fails after registration, the thrown error retains the
|
|
42
|
+
* created credential on its `credential` property.
|
|
43
|
+
*
|
|
44
|
+
* :::warning
|
|
45
|
+
*
|
|
46
|
+
* PRF output is secret application-held key material. Native
|
|
47
|
+
* `credential.raw.toJSON()` output includes extension results, so do not
|
|
48
|
+
* serialize or send the raw credential.
|
|
49
|
+
*
|
|
50
|
+
* PRF-derived keys are software keys. Code on any origin allowed to use the
|
|
51
|
+
* same RP ID can request the same output after user verification.
|
|
52
|
+
*
|
|
53
|
+
* :::
|
|
54
|
+
*
|
|
55
|
+
* @param options - Credential creation and PRF options.
|
|
56
|
+
* @returns The credential, with a copied PRF output when requested.
|
|
57
|
+
*/
|
|
58
|
+
export declare function createCredential<const options extends createCredential.Options | createCredential.PrfOptions>(options: options): Promise<createCredential.ReturnType<options>>;
|
|
59
|
+
export declare namespace createCredential {
|
|
60
|
+
/** Options for ordinary WebAuthn P256 credential creation. */
|
|
61
|
+
type Options = Registration.create.Options & {
|
|
62
|
+
/** Reserved for credential creation with PRF output. */
|
|
63
|
+
prf?: never;
|
|
64
|
+
};
|
|
65
|
+
/** Options for WebAuthn credential creation with required PRF output. */
|
|
66
|
+
type PrfOptions = UnionOmit<Registration.getOptions.Options, 'authenticatorSelection' | 'challenge' | 'extensions'> & {
|
|
67
|
+
/**
|
|
68
|
+
* Criteria used to select an authenticator. User verification is always required.
|
|
69
|
+
*/
|
|
70
|
+
authenticatorSelection?: Omit<NonNullable<Registration.getOptions.Options['authenticatorSelection']>, 'userVerification'> | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Cryptographic challenge. Defaults to a random 32-byte value.
|
|
73
|
+
*
|
|
74
|
+
* Supply and verify a server-generated challenge when registration is
|
|
75
|
+
* also used to authenticate a user to a server.
|
|
76
|
+
*/
|
|
77
|
+
challenge?: Registration.getOptions.Options['challenge'] | undefined;
|
|
78
|
+
/** Function that creates the WebAuthn credential. */
|
|
79
|
+
createFn?: ((options?: Types.CredentialCreationOptions) => Promise<Types.Credential | null>) | undefined;
|
|
80
|
+
/** Additional WebAuthn extensions. The `prf` extension is managed by this function. */
|
|
81
|
+
extensions?: Omit<Types.AuthenticationExtensionsClientInputs, 'prf'> | undefined;
|
|
82
|
+
/** Function used for a follow-up PRF assertion when creation does not return an output. */
|
|
83
|
+
getFn?: ((options?: Types.CredentialRequestOptions) => Promise<Types.Credential | null>) | undefined;
|
|
84
|
+
/** Credential-bound PRF configuration. */
|
|
85
|
+
prf: Prf;
|
|
86
|
+
/** Raw credential options cannot be combined with managed PRF evaluation. */
|
|
87
|
+
publicKey?: never;
|
|
88
|
+
};
|
|
89
|
+
/** Created WebAuthn credential with its credential-bound PRF output. */
|
|
90
|
+
type PrfReturnType = Credential.Credential & {
|
|
91
|
+
/** Copied 32-byte credential-bound PRF output. */
|
|
92
|
+
prf: Bytes.Bytes;
|
|
93
|
+
};
|
|
94
|
+
/** Return type for a WebAuthn credential creation request. */
|
|
95
|
+
type ReturnType<options extends Options | PrfOptions> = options extends PrfOptions ? PrfReturnType : Credential.Credential;
|
|
96
|
+
type ErrorType = InvalidExtensionError | InvalidOptionsError | InvalidPrfOutputError | PrfEvaluationFailedError | PrfNotSupportedError | Registration.create.ErrorType | Errors.GlobalErrorType;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Requests a WebAuthn credential and returns its credential-bound PRF output.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts twoslash
|
|
103
|
+
* import { Secp256k1, WebAuthn } from 'ox'
|
|
104
|
+
*
|
|
105
|
+
* const { prf } = await WebAuthn.getCredential({
|
|
106
|
+
* credentialId: 'oZ48...',
|
|
107
|
+
* prf: true
|
|
108
|
+
* })
|
|
109
|
+
* const privateKey = Secp256k1.fromPrf(prf)
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* `prf: true` uses the stable input `ox.webauthn.prf.v1`. Pass
|
|
113
|
+
* `{ input }` to use an application-owned input instead.
|
|
114
|
+
*
|
|
115
|
+
* When more than one credential can be selected, check `result.id`
|
|
116
|
+
* before using the PRF output.
|
|
117
|
+
*
|
|
118
|
+
* :::warning
|
|
119
|
+
*
|
|
120
|
+
* PRF output is secret application-held key material. Native
|
|
121
|
+
* `response.raw.toJSON()` output includes extension results, so do not
|
|
122
|
+
* serialize or send the raw response.
|
|
123
|
+
*
|
|
124
|
+
* :::
|
|
125
|
+
*
|
|
126
|
+
* @param options - Credential request and PRF options.
|
|
127
|
+
* @returns The requested credential and a copied 32-byte PRF output.
|
|
128
|
+
*/
|
|
129
|
+
export declare function getCredential(options: getCredential.Options): Promise<getCredential.ReturnType>;
|
|
130
|
+
export declare namespace getCredential {
|
|
131
|
+
type Options = UnionOmit<Authentication.getOptions.Options, 'challenge' | 'extensions' | 'userVerification'> & {
|
|
132
|
+
/**
|
|
133
|
+
* Challenge to sign. Defaults to a random 32-byte value.
|
|
134
|
+
*
|
|
135
|
+
* Supply and verify a server-generated challenge when the assertion is
|
|
136
|
+
* also used to authenticate a user to a server.
|
|
137
|
+
*/
|
|
138
|
+
challenge?: Hex.Hex | undefined;
|
|
139
|
+
/** Additional WebAuthn extensions. The `prf` extension is managed by this function. */
|
|
140
|
+
extensions?: Omit<Types.AuthenticationExtensionsClientInputs, 'prf'> | undefined;
|
|
141
|
+
/** Function that requests the WebAuthn credential. */
|
|
142
|
+
getFn?: ((options?: Types.CredentialRequestOptions) => Promise<Types.Credential | null>) | undefined;
|
|
143
|
+
/** Credential-bound PRF configuration. */
|
|
144
|
+
prf: Prf;
|
|
145
|
+
/** Raw credential options cannot be combined with managed PRF evaluation. */
|
|
146
|
+
publicKey?: never;
|
|
147
|
+
};
|
|
148
|
+
/** Result from a WebAuthn credential request. */
|
|
149
|
+
type Response = {
|
|
150
|
+
/** Credential identifier. */
|
|
151
|
+
id: string;
|
|
152
|
+
/** Native WebAuthn credential. */
|
|
153
|
+
raw: Types.PublicKeyCredential;
|
|
154
|
+
};
|
|
155
|
+
type ReturnType = Response & {
|
|
156
|
+
/** Copied 32-byte credential-bound PRF output. */
|
|
157
|
+
prf: Bytes.Bytes;
|
|
158
|
+
};
|
|
159
|
+
type ErrorType = Authentication.getOptions.ErrorType | GetCredentialFailedError | InvalidExtensionError | InvalidOptionsError | InvalidPrfOutputError | PrfEvaluationFailedError | PrfUnavailableError | Errors.GlobalErrorType;
|
|
160
|
+
}
|
|
161
|
+
type PrfResultContext = {
|
|
162
|
+
credential?: Credential.Credential | undefined;
|
|
163
|
+
response?: getCredential.Response | undefined;
|
|
164
|
+
};
|
|
165
|
+
/** Thrown when a caller supplies the managed `prf` extension. */
|
|
166
|
+
export declare class InvalidExtensionError extends Errors.BaseError {
|
|
167
|
+
readonly name = "WebAuthn.InvalidExtensionError";
|
|
168
|
+
constructor();
|
|
169
|
+
}
|
|
170
|
+
/** Thrown when raw credential options are combined with managed PRF evaluation. */
|
|
171
|
+
export declare class InvalidOptionsError extends Errors.BaseError {
|
|
172
|
+
readonly name = "WebAuthn.InvalidOptionsError";
|
|
173
|
+
constructor();
|
|
174
|
+
}
|
|
175
|
+
/** Thrown when a WebAuthn PRF result is not a valid 32-byte output. */
|
|
176
|
+
export declare class InvalidPrfOutputError extends Errors.BaseError {
|
|
177
|
+
/** Credential that returned the invalid PRF output, when created in this operation. */
|
|
178
|
+
readonly credential?: Credential.Credential | undefined;
|
|
179
|
+
/** Authentication response that returned the invalid PRF output, when available. */
|
|
180
|
+
readonly response?: getCredential.Response | undefined;
|
|
181
|
+
readonly name = "WebAuthn.InvalidPrfOutputError";
|
|
182
|
+
constructor({ credential, response, size, }: PrfResultContext & {
|
|
183
|
+
size?: number | undefined;
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/** Thrown when a created credential does not support PRF evaluation. */
|
|
187
|
+
export declare class PrfNotSupportedError extends Errors.BaseError {
|
|
188
|
+
/** Credential that was created before PRF support was determined. */
|
|
189
|
+
readonly credential: Credential.Credential;
|
|
190
|
+
readonly name = "WebAuthn.PrfNotSupportedError";
|
|
191
|
+
constructor({ credential }: {
|
|
192
|
+
credential: Credential.Credential;
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
/** Thrown when a credential assertion does not return a PRF output. */
|
|
196
|
+
export declare class PrfUnavailableError extends Errors.BaseError {
|
|
197
|
+
/** Authentication response that did not contain a PRF output. */
|
|
198
|
+
readonly response: getCredential.Response;
|
|
199
|
+
readonly name = "WebAuthn.PrfUnavailableError";
|
|
200
|
+
constructor({ response }: {
|
|
201
|
+
response: getCredential.Response;
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
/** Thrown when WebAuthn PRF evaluation fails after a credential ceremony. */
|
|
205
|
+
export declare class PrfEvaluationFailedError extends Errors.BaseError<Error> {
|
|
206
|
+
/** Credential that was created before PRF evaluation failed, when available. */
|
|
207
|
+
readonly credential?: Credential.Credential | undefined;
|
|
208
|
+
/** Authentication response produced before PRF evaluation failed, when available. */
|
|
209
|
+
readonly response?: getCredential.Response | undefined;
|
|
210
|
+
readonly name = "WebAuthn.PrfEvaluationFailedError";
|
|
211
|
+
constructor({ cause, credential, response, }: {
|
|
212
|
+
cause: Error;
|
|
213
|
+
credential?: Credential.Credential | undefined;
|
|
214
|
+
response?: getCredential.Response | undefined;
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
/** Thrown when a WebAuthn credential request fails. */
|
|
218
|
+
export declare class GetCredentialFailedError extends Errors.BaseError<Error> {
|
|
219
|
+
readonly name = "WebAuthn.GetCredentialFailedError";
|
|
220
|
+
constructor({ cause }?: {
|
|
221
|
+
cause?: Error | undefined;
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
//# sourceMappingURL=WebAuthn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebAuthn.d.ts","sourceRoot":"","sources":["../../src/core/WebAuthn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEpD,OAAO,KAAK,cAAc,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,KAAK,UAAU,MAAM,2BAA2B,CAAA;AAC5D,OAAO,KAAK,YAAY,MAAM,6BAA6B,CAAA;AAC3D,OAAO,KAAK,KAAK,KAAK,MAAM,sBAAsB,CAAA;AAElD,cAAc,mBAAmB,CAAA;AAIjC,oEAAoE;AACpE,MAAM,MAAM,GAAG,GACX,IAAI,GACJ;IACE;;;;;OAKG;IACH,KAAK,EAAE,KAAK,CAAC,KAAK,CAAA;CACnB,CAAA;AAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,CAAC,OAAO,SAAS,gBAAgB,CAAC,OAAO,GAAG,gBAAgB,CAAC,UAAU,EAC5E,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAyFjE;AAED,MAAM,CAAC,OAAO,WAAW,gB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AAA;KAAE;CAIlE;AAED,uEAAuE;AACvE,qBAAa,mBAAoB,SAAQ,MAAM,CAAC,SAAS;IACvD,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,QAAQ,CAAA;IAEzC,SAAkB,IAAI,kCAAiC;gBAE3C,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,aAAa,CAAC,QAAQ,CAAA;KAAE;CAI/D;AAED,6EAA6E;AAC7E,qBAAa,wBAAyB,SAAQ,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;IACnE,gFAAgF;IAChF,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC,UAAU,GAAG,SAAS,CAAA;IAEvD,qFAAqF;IACrF,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,QAAQ,GAAG,SAAS,CAAA;IAEtD,SAAkB,IAAI,uCAAsC;gBAEhD,EACV,KAAK,EACL,UAAU,EACV,QAAQ,GACT,EAAE;QACD,KAAK,EAAE,KAAK,CAAA;QACZ,UAAU,CAAC,EAAE,UAAU,CAAC,UAAU,GAAG,SAAS,CAAA;QAC9C,QAAQ,CAAC,EAAE,aAAa,CAAC,QAAQ,GAAG,SAAS,CAAA;KAC9C;CAYF;AAED,uDAAuD;AACvD,qBAAa,wBAAyB,SAAQ,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;IACnE,SAAkB,IAAI,uCAAsC;gBAEhD,EAAE,KAAK,EAAE,GAAE;QAAE,KAAK,CAAC,EAAE,KAAK,GAAG,SAAS,CAAA;KAAO;CAK1D"}
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import * as Bytes from './Bytes.js';
|
|
2
|
+
import * as Errors from './Errors.js';
|
|
3
|
+
import * as Hex from './Hex.js';
|
|
4
|
+
import * as WebAuthnP256 from './WebAuthnP256.js';
|
|
5
|
+
import * as Authentication from '../webauthn/Authentication.js';
|
|
6
|
+
import * as Registration from '../webauthn/Registration.js';
|
|
7
|
+
export * from './WebAuthnP256.js';
|
|
8
|
+
const defaultPrfInput = Bytes.fromString('ox.webauthn.prf.v1');
|
|
9
|
+
/**
|
|
10
|
+
* Creates a WebAuthn credential and optionally returns its credential-bound
|
|
11
|
+
* PRF output.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts twoslash
|
|
15
|
+
* import { Secp256k1, WebAuthn } from 'ox'
|
|
16
|
+
*
|
|
17
|
+
* const credential = await WebAuthn.createCredential({
|
|
18
|
+
* name: 'Example',
|
|
19
|
+
* prf: true
|
|
20
|
+
* })
|
|
21
|
+
* const privateKey = Secp256k1.fromPrf(credential.prf)
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* `prf: true` uses the stable input `ox.webauthn.prf.v1`. Pass
|
|
25
|
+
* `{ input }` to use an application-owned input instead.
|
|
26
|
+
*
|
|
27
|
+
* When credential creation enables PRF but does not return an output, this
|
|
28
|
+
* function performs a follow-up assertion. The user may be prompted twice.
|
|
29
|
+
*
|
|
30
|
+
* If PRF evaluation fails after registration, the thrown error retains the
|
|
31
|
+
* created credential on its `credential` property.
|
|
32
|
+
*
|
|
33
|
+
* :::warning
|
|
34
|
+
*
|
|
35
|
+
* PRF output is secret application-held key material. Native
|
|
36
|
+
* `credential.raw.toJSON()` output includes extension results, so do not
|
|
37
|
+
* serialize or send the raw credential.
|
|
38
|
+
*
|
|
39
|
+
* PRF-derived keys are software keys. Code on any origin allowed to use the
|
|
40
|
+
* same RP ID can request the same output after user verification.
|
|
41
|
+
*
|
|
42
|
+
* :::
|
|
43
|
+
*
|
|
44
|
+
* @param options - Credential creation and PRF options.
|
|
45
|
+
* @returns The credential, with a copied PRF output when requested.
|
|
46
|
+
*/
|
|
47
|
+
export async function createCredential(options) {
|
|
48
|
+
if (!('prf' in options) || options.prf === undefined)
|
|
49
|
+
return WebAuthnP256.createCredential(options);
|
|
50
|
+
if ('publicKey' in options)
|
|
51
|
+
throw new InvalidOptionsError();
|
|
52
|
+
const rpId = options.rp?.id;
|
|
53
|
+
const { authenticatorSelection = {
|
|
54
|
+
requireResidentKey: true,
|
|
55
|
+
residentKey: 'required',
|
|
56
|
+
}, challenge = Hex.random(32), createFn, extensions, getFn, prf, timeout, ...rest } = options;
|
|
57
|
+
assertExtensions(extensions);
|
|
58
|
+
const input = getPrfInput(prf);
|
|
59
|
+
const credential = await Registration.create({
|
|
60
|
+
...rest,
|
|
61
|
+
authenticatorSelection: {
|
|
62
|
+
...authenticatorSelection,
|
|
63
|
+
userVerification: 'required',
|
|
64
|
+
},
|
|
65
|
+
challenge,
|
|
66
|
+
...(createFn && { createFn }),
|
|
67
|
+
extensions: {
|
|
68
|
+
...extensions,
|
|
69
|
+
prf: {
|
|
70
|
+
eval: {
|
|
71
|
+
first: input,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
...(timeout !== undefined && { timeout }),
|
|
76
|
+
});
|
|
77
|
+
const result = (() => {
|
|
78
|
+
try {
|
|
79
|
+
return credential.raw.getClientExtensionResults().prf;
|
|
80
|
+
}
|
|
81
|
+
catch (cause) {
|
|
82
|
+
throw new PrfEvaluationFailedError({
|
|
83
|
+
cause: cause,
|
|
84
|
+
credential,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
})();
|
|
88
|
+
const output = result?.results?.first;
|
|
89
|
+
if (output !== undefined)
|
|
90
|
+
return {
|
|
91
|
+
...credential,
|
|
92
|
+
prf: parsePrfOutput(output, {
|
|
93
|
+
credential,
|
|
94
|
+
}),
|
|
95
|
+
};
|
|
96
|
+
if (result?.enabled !== true)
|
|
97
|
+
throw new PrfNotSupportedError({
|
|
98
|
+
credential,
|
|
99
|
+
});
|
|
100
|
+
try {
|
|
101
|
+
const result = await getCredential({
|
|
102
|
+
credentialId: credential.id,
|
|
103
|
+
...(getFn && { getFn }),
|
|
104
|
+
prf: {
|
|
105
|
+
input,
|
|
106
|
+
},
|
|
107
|
+
...(rpId && { rpId }),
|
|
108
|
+
...(timeout !== undefined && { timeout }),
|
|
109
|
+
});
|
|
110
|
+
if (result.id !== credential.id)
|
|
111
|
+
throw new Error(`Expected credential "${credential.id}", but received "${result.id}".`);
|
|
112
|
+
return {
|
|
113
|
+
...credential,
|
|
114
|
+
prf: result.prf,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
catch (cause) {
|
|
118
|
+
throw new PrfEvaluationFailedError({
|
|
119
|
+
cause: cause,
|
|
120
|
+
credential,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Requests a WebAuthn credential and returns its credential-bound PRF output.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts twoslash
|
|
129
|
+
* import { Secp256k1, WebAuthn } from 'ox'
|
|
130
|
+
*
|
|
131
|
+
* const { prf } = await WebAuthn.getCredential({
|
|
132
|
+
* credentialId: 'oZ48...',
|
|
133
|
+
* prf: true
|
|
134
|
+
* })
|
|
135
|
+
* const privateKey = Secp256k1.fromPrf(prf)
|
|
136
|
+
* ```
|
|
137
|
+
*
|
|
138
|
+
* `prf: true` uses the stable input `ox.webauthn.prf.v1`. Pass
|
|
139
|
+
* `{ input }` to use an application-owned input instead.
|
|
140
|
+
*
|
|
141
|
+
* When more than one credential can be selected, check `result.id`
|
|
142
|
+
* before using the PRF output.
|
|
143
|
+
*
|
|
144
|
+
* :::warning
|
|
145
|
+
*
|
|
146
|
+
* PRF output is secret application-held key material. Native
|
|
147
|
+
* `response.raw.toJSON()` output includes extension results, so do not
|
|
148
|
+
* serialize or send the raw response.
|
|
149
|
+
*
|
|
150
|
+
* :::
|
|
151
|
+
*
|
|
152
|
+
* @param options - Credential request and PRF options.
|
|
153
|
+
* @returns The requested credential and a copied 32-byte PRF output.
|
|
154
|
+
*/
|
|
155
|
+
export async function getCredential(options) {
|
|
156
|
+
if ('publicKey' in options)
|
|
157
|
+
throw new InvalidOptionsError();
|
|
158
|
+
const { challenge = Hex.random(32), extensions, getFn = (options) => window.navigator.credentials.get(options), prf, ...rest } = options;
|
|
159
|
+
assertExtensions(extensions);
|
|
160
|
+
const input = getPrfInput(prf);
|
|
161
|
+
const request = Authentication.getOptions({
|
|
162
|
+
...rest,
|
|
163
|
+
challenge,
|
|
164
|
+
extensions: {
|
|
165
|
+
...extensions,
|
|
166
|
+
prf: {
|
|
167
|
+
eval: {
|
|
168
|
+
first: input,
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
userVerification: 'required',
|
|
173
|
+
});
|
|
174
|
+
const raw = await (async () => {
|
|
175
|
+
try {
|
|
176
|
+
return (await getFn(request));
|
|
177
|
+
}
|
|
178
|
+
catch (cause) {
|
|
179
|
+
throw new GetCredentialFailedError({
|
|
180
|
+
cause: cause,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
})();
|
|
184
|
+
if (!raw)
|
|
185
|
+
throw new GetCredentialFailedError();
|
|
186
|
+
const response = {
|
|
187
|
+
id: raw.id,
|
|
188
|
+
raw,
|
|
189
|
+
};
|
|
190
|
+
const output = (() => {
|
|
191
|
+
try {
|
|
192
|
+
return response.raw.getClientExtensionResults().prf?.results?.first;
|
|
193
|
+
}
|
|
194
|
+
catch (cause) {
|
|
195
|
+
throw new PrfEvaluationFailedError({
|
|
196
|
+
cause: cause,
|
|
197
|
+
response,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
})();
|
|
201
|
+
if (output === undefined)
|
|
202
|
+
throw new PrfUnavailableError({
|
|
203
|
+
response,
|
|
204
|
+
});
|
|
205
|
+
return {
|
|
206
|
+
...response,
|
|
207
|
+
prf: parsePrfOutput(output, {
|
|
208
|
+
response,
|
|
209
|
+
}),
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function getPrfInput(prf) {
|
|
213
|
+
return (prf === true ? defaultPrfInput : prf.input).slice();
|
|
214
|
+
}
|
|
215
|
+
function parsePrfOutput(value, context) {
|
|
216
|
+
if (ArrayBuffer.isView(value)) {
|
|
217
|
+
if (value.byteLength !== 32)
|
|
218
|
+
throw new InvalidPrfOutputError({
|
|
219
|
+
...context,
|
|
220
|
+
size: value.byteLength,
|
|
221
|
+
});
|
|
222
|
+
return new Uint8Array(value.buffer, value.byteOffset, value.byteLength).slice();
|
|
223
|
+
}
|
|
224
|
+
const arrayBufferSize = getArrayBufferSize(value);
|
|
225
|
+
if (arrayBufferSize !== undefined) {
|
|
226
|
+
if (arrayBufferSize !== 32)
|
|
227
|
+
throw new InvalidPrfOutputError({
|
|
228
|
+
...context,
|
|
229
|
+
size: arrayBufferSize,
|
|
230
|
+
});
|
|
231
|
+
return new Uint8Array(value).slice();
|
|
232
|
+
}
|
|
233
|
+
if (typeof value === 'object' &&
|
|
234
|
+
value !== null &&
|
|
235
|
+
'length' in value &&
|
|
236
|
+
typeof value.length === 'number') {
|
|
237
|
+
if (value.length !== 32)
|
|
238
|
+
throw new InvalidPrfOutputError({
|
|
239
|
+
...context,
|
|
240
|
+
size: value.length,
|
|
241
|
+
});
|
|
242
|
+
const output = new Uint8Array(32);
|
|
243
|
+
for (let index = 0; index < output.length; index++) {
|
|
244
|
+
const byte = value[index];
|
|
245
|
+
if (typeof byte !== 'number' ||
|
|
246
|
+
!Number.isInteger(byte) ||
|
|
247
|
+
byte < 0 ||
|
|
248
|
+
byte > 255)
|
|
249
|
+
throw new InvalidPrfOutputError(context);
|
|
250
|
+
output[index] = byte;
|
|
251
|
+
}
|
|
252
|
+
return output;
|
|
253
|
+
}
|
|
254
|
+
throw new InvalidPrfOutputError(context);
|
|
255
|
+
}
|
|
256
|
+
function getArrayBufferSize(value) {
|
|
257
|
+
try {
|
|
258
|
+
return Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, 'byteLength')?.get?.call(value);
|
|
259
|
+
}
|
|
260
|
+
catch {
|
|
261
|
+
return undefined;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
function assertExtensions(extensions) {
|
|
265
|
+
if (extensions?.prf)
|
|
266
|
+
throw new InvalidExtensionError();
|
|
267
|
+
}
|
|
268
|
+
/** Thrown when a caller supplies the managed `prf` extension. */
|
|
269
|
+
export class InvalidExtensionError extends Errors.BaseError {
|
|
270
|
+
name = 'WebAuthn.InvalidExtensionError';
|
|
271
|
+
constructor() {
|
|
272
|
+
super('The `prf` extension is managed by this function.');
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
/** Thrown when raw credential options are combined with managed PRF evaluation. */
|
|
276
|
+
export class InvalidOptionsError extends Errors.BaseError {
|
|
277
|
+
name = 'WebAuthn.InvalidOptionsError';
|
|
278
|
+
constructor() {
|
|
279
|
+
super('The `publicKey` option cannot be combined with managed PRF evaluation.');
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
/** Thrown when a WebAuthn PRF result is not a valid 32-byte output. */
|
|
283
|
+
export class InvalidPrfOutputError extends Errors.BaseError {
|
|
284
|
+
/** Credential that returned the invalid PRF output, when created in this operation. */
|
|
285
|
+
credential;
|
|
286
|
+
/** Authentication response that returned the invalid PRF output, when available. */
|
|
287
|
+
response;
|
|
288
|
+
name = 'WebAuthn.InvalidPrfOutputError';
|
|
289
|
+
constructor({ credential, response, size, }) {
|
|
290
|
+
super(size === undefined
|
|
291
|
+
? 'Expected a 32-byte PRF output.'
|
|
292
|
+
: `Expected a 32-byte PRF output, but received ${size} bytes.`);
|
|
293
|
+
this.credential = credential;
|
|
294
|
+
this.response = response;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
/** Thrown when a created credential does not support PRF evaluation. */
|
|
298
|
+
export class PrfNotSupportedError extends Errors.BaseError {
|
|
299
|
+
/** Credential that was created before PRF support was determined. */
|
|
300
|
+
credential;
|
|
301
|
+
name = 'WebAuthn.PrfNotSupportedError';
|
|
302
|
+
constructor({ credential }) {
|
|
303
|
+
super('The created credential does not support PRF evaluation.');
|
|
304
|
+
this.credential = credential;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
/** Thrown when a credential assertion does not return a PRF output. */
|
|
308
|
+
export class PrfUnavailableError extends Errors.BaseError {
|
|
309
|
+
/** Authentication response that did not contain a PRF output. */
|
|
310
|
+
response;
|
|
311
|
+
name = 'WebAuthn.PrfUnavailableError';
|
|
312
|
+
constructor({ response }) {
|
|
313
|
+
super('The credential did not return a PRF output.');
|
|
314
|
+
this.response = response;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
/** Thrown when WebAuthn PRF evaluation fails after a credential ceremony. */
|
|
318
|
+
export class PrfEvaluationFailedError extends Errors.BaseError {
|
|
319
|
+
/** Credential that was created before PRF evaluation failed, when available. */
|
|
320
|
+
credential;
|
|
321
|
+
/** Authentication response produced before PRF evaluation failed, when available. */
|
|
322
|
+
response;
|
|
323
|
+
name = 'WebAuthn.PrfEvaluationFailedError';
|
|
324
|
+
constructor({ cause, credential, response, }) {
|
|
325
|
+
super(credential
|
|
326
|
+
? 'Created a credential, but failed to evaluate its PRF.'
|
|
327
|
+
: 'Failed to evaluate the credential PRF.', {
|
|
328
|
+
cause,
|
|
329
|
+
});
|
|
330
|
+
this.credential = credential;
|
|
331
|
+
this.response = response;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
/** Thrown when a WebAuthn credential request fails. */
|
|
335
|
+
export class GetCredentialFailedError extends Errors.BaseError {
|
|
336
|
+
name = 'WebAuthn.GetCredentialFailedError';
|
|
337
|
+
constructor({ cause } = {}) {
|
|
338
|
+
super('Failed to request credential.', {
|
|
339
|
+
cause,
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
//# sourceMappingURL=WebAuthn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebAuthn.js","sourceRoot":"","sources":["../../src/core/WebAuthn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,GAAG,MAAM,UA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