ox 0.12.4 → 0.13.1
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 +21 -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/KeyAuthorization.js +18 -3
- package/_cjs/tempo/KeyAuthorization.js.map +1 -1
- package/_cjs/tempo/SignatureEnvelope.js +26 -0
- package/_cjs/tempo/SignatureEnvelope.js.map +1 -1
- package/_cjs/tempo/TxEnvelopeTempo.js +5 -10
- 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/KeyAuthorization.js +66 -3
- package/_esm/tempo/KeyAuthorization.js.map +1 -1
- package/_esm/tempo/SignatureEnvelope.js +74 -0
- package/_esm/tempo/SignatureEnvelope.js.map +1 -1
- package/_esm/tempo/TransactionReceipt.js +1 -1
- package/_esm/tempo/TransactionRequest.js +1 -1
- package/_esm/tempo/TxEnvelopeTempo.js +5 -10
- 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/KeyAuthorization.d.ts +57 -0
- package/_types/tempo/KeyAuthorization.d.ts.map +1 -1
- package/_types/tempo/SignatureEnvelope.d.ts +75 -0
- package/_types/tempo/SignatureEnvelope.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/KeyAuthorization.test.ts +139 -0
- package/tempo/KeyAuthorization.ts +82 -3
- package/tempo/SignatureEnvelope.test.ts +147 -0
- package/tempo/SignatureEnvelope.ts +113 -0
- package/tempo/Transaction.ts +2 -2
- package/tempo/TransactionReceipt.ts +2 -2
- package/tempo/TransactionRequest.ts +2 -2
- package/tempo/TxEnvelopeTempo.ts +5 -12
- package/tempo/e2e.test.ts +265 -0
- 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,182 @@
|
|
|
1
|
+
import * as Bytes from '../core/Bytes.js';
|
|
2
|
+
import * as Cbor from '../core/Cbor.js';
|
|
3
|
+
import type * as Errors from '../core/Errors.js';
|
|
4
|
+
import * as Hex from '../core/Hex.js';
|
|
5
|
+
import type * as PublicKey from '../core/PublicKey.js';
|
|
6
|
+
import type * as Types from './Types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Gets the authenticator data which contains information about the
|
|
9
|
+
* processing of an authenticator request (ie. from `Authentication.sign`).
|
|
10
|
+
*
|
|
11
|
+
* :::warning
|
|
12
|
+
*
|
|
13
|
+
* This function is mainly for testing purposes or for manually constructing
|
|
14
|
+
* autenticator data. In most cases you will not need this function.
|
|
15
|
+
* `authenticatorData` is typically returned as part of the
|
|
16
|
+
* authenticator response.
|
|
17
|
+
*
|
|
18
|
+
* :::
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts twoslash
|
|
22
|
+
* import { Authenticator } from 'ox/webauthn'
|
|
23
|
+
*
|
|
24
|
+
* const authenticatorData = Authenticator.getAuthenticatorData({
|
|
25
|
+
* rpId: 'example.com',
|
|
26
|
+
* signCount: 420,
|
|
27
|
+
* })
|
|
28
|
+
* // @log: "0xa379a6f6eeafb9a55e378c118034e2751e682fab9f2d30ab13d2125586ce194705000001a4"
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ### With Attested Credential Data
|
|
33
|
+
*
|
|
34
|
+
* Include a credential ID and public key in the authenticator data (for registration responses):
|
|
35
|
+
*
|
|
36
|
+
* ```ts twoslash
|
|
37
|
+
* import { P256 } from 'ox'
|
|
38
|
+
* import { Authenticator } from 'ox/webauthn'
|
|
39
|
+
*
|
|
40
|
+
* const { publicKey } = P256.createKeyPair()
|
|
41
|
+
*
|
|
42
|
+
* const authenticatorData = Authenticator.getAuthenticatorData({
|
|
43
|
+
* rpId: 'example.com',
|
|
44
|
+
* flag: 0x41, // UP + AT
|
|
45
|
+
* credential: {
|
|
46
|
+
* id: new Uint8Array(32),
|
|
47
|
+
* publicKey,
|
|
48
|
+
* },
|
|
49
|
+
* })
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @param options - Options to construct the authenticator data.
|
|
53
|
+
* @returns The authenticator data.
|
|
54
|
+
*/
|
|
55
|
+
export declare function getAuthenticatorData(options?: getAuthenticatorData.Options): Hex.Hex;
|
|
56
|
+
export declare namespace getAuthenticatorData {
|
|
57
|
+
type Options = {
|
|
58
|
+
/** Attested credential data to include (credential ID + public key). When set, the AT flag (0x40) should also be set. */
|
|
59
|
+
credential?: {
|
|
60
|
+
/** The credential ID as raw bytes. */
|
|
61
|
+
id: Uint8Array;
|
|
62
|
+
/** The P256 public key associated with the credential. */
|
|
63
|
+
publicKey: PublicKey.PublicKey;
|
|
64
|
+
} | undefined;
|
|
65
|
+
/** A bitfield that indicates various attributes that were asserted by the authenticator. [Read more](https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API/Authenticator_data#flags) */
|
|
66
|
+
flag?: number | undefined;
|
|
67
|
+
/** The [Relying Party ID](https://w3c.github.io/webauthn/#relying-party-identifier) that the credential is scoped to. */
|
|
68
|
+
rpId?: Types.PublicKeyCredentialRequestOptions['rpId'] | undefined;
|
|
69
|
+
/** A signature counter, if supported by the authenticator (set to 0 otherwise). */
|
|
70
|
+
signCount?: number | undefined;
|
|
71
|
+
};
|
|
72
|
+
type ErrorType = Errors.GlobalErrorType;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Extracts the signature counter from the authenticator data.
|
|
76
|
+
* The counter is a 4-byte big-endian unsigned integer at bytes 33–36.
|
|
77
|
+
*
|
|
78
|
+
* Useful for detecting cloned authenticators: if the counter is non-zero and
|
|
79
|
+
* does not monotonically increase between assertions, it may indicate a cloned key.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts twoslash
|
|
83
|
+
* import { Authenticator } from 'ox/webauthn'
|
|
84
|
+
*
|
|
85
|
+
* const signCount = Authenticator.getSignCount(
|
|
86
|
+
* '0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000001',
|
|
87
|
+
* )
|
|
88
|
+
* // @log: 1
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @param authenticatorData - The authenticator data hex string.
|
|
92
|
+
* @returns The signature counter.
|
|
93
|
+
*/
|
|
94
|
+
export declare function getSignCount(authenticatorData: Hex.Hex): number;
|
|
95
|
+
export declare namespace getSignCount {
|
|
96
|
+
type ErrorType = Bytes.fromHex.ErrorType | Errors.GlobalErrorType;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Constructs the Client Data in stringified JSON format which represents client data that
|
|
100
|
+
* was passed to `credentials.get()` or `credentials.create()`.
|
|
101
|
+
*
|
|
102
|
+
* :::warning
|
|
103
|
+
*
|
|
104
|
+
* This function is mainly for testing purposes or for manually constructing
|
|
105
|
+
* client data. In most cases you will not need this function.
|
|
106
|
+
* `clientDataJSON` is typically returned as part of the authenticator response.
|
|
107
|
+
*
|
|
108
|
+
* :::
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts twoslash
|
|
112
|
+
* import { Authenticator } from 'ox/webauthn'
|
|
113
|
+
*
|
|
114
|
+
* const clientDataJSON = Authenticator.getClientDataJSON({
|
|
115
|
+
* challenge: '0xdeadbeef',
|
|
116
|
+
* origin: 'https://example.com',
|
|
117
|
+
* })
|
|
118
|
+
* // @log: "{"type":"webauthn.get","challenge":"3q2-7w","origin":"https://example.com","crossOrigin":false}"
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* @param options - Options to construct the client data.
|
|
122
|
+
* @returns The client data.
|
|
123
|
+
*/
|
|
124
|
+
export declare function getClientDataJSON(options: getClientDataJSON.Options): string;
|
|
125
|
+
export declare namespace getClientDataJSON {
|
|
126
|
+
type Options = {
|
|
127
|
+
/** The challenge to sign. */
|
|
128
|
+
challenge: Hex.Hex;
|
|
129
|
+
/** If set to `true`, it means that the calling context is an `<iframe>` that is not same origin with its ancestor frames. */
|
|
130
|
+
crossOrigin?: boolean | undefined;
|
|
131
|
+
/** Additional client data to include in the client data JSON. */
|
|
132
|
+
extraClientData?: Record<string, unknown> | undefined;
|
|
133
|
+
/** The fully qualified origin of the relying party which has been given by the client/browser to the authenticator. */
|
|
134
|
+
origin?: string | undefined;
|
|
135
|
+
/** The WebAuthn ceremony type. @default 'webauthn.get' */
|
|
136
|
+
type?: 'webauthn.create' | 'webauthn.get' | undefined;
|
|
137
|
+
};
|
|
138
|
+
type ErrorType = Errors.GlobalErrorType;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Constructs a CBOR-encoded attestation object for testing WebAuthn registration
|
|
142
|
+
* verification. Combines the authenticator data with an attestation statement.
|
|
143
|
+
*
|
|
144
|
+
* :::warning
|
|
145
|
+
*
|
|
146
|
+
* This function is mainly for testing purposes. In production, the attestation
|
|
147
|
+
* object is returned by the authenticator during `navigator.credentials.create()`.
|
|
148
|
+
*
|
|
149
|
+
* :::
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts twoslash
|
|
153
|
+
* import { P256 } from 'ox'
|
|
154
|
+
* import { Authenticator } from 'ox/webauthn'
|
|
155
|
+
*
|
|
156
|
+
* const { publicKey } = P256.createKeyPair()
|
|
157
|
+
*
|
|
158
|
+
* const attestationObject = Authenticator.getAttestationObject({
|
|
159
|
+
* authData: Authenticator.getAuthenticatorData({
|
|
160
|
+
* rpId: 'example.com',
|
|
161
|
+
* flag: 0x41,
|
|
162
|
+
* credential: { id: new Uint8Array(32), publicKey },
|
|
163
|
+
* }),
|
|
164
|
+
* })
|
|
165
|
+
* ```
|
|
166
|
+
*
|
|
167
|
+
* @param options - Options to construct the attestation object.
|
|
168
|
+
* @returns The CBOR-encoded attestation object as a Hex string.
|
|
169
|
+
*/
|
|
170
|
+
export declare function getAttestationObject(options: getAttestationObject.Options): Hex.Hex;
|
|
171
|
+
export declare namespace getAttestationObject {
|
|
172
|
+
type Options = {
|
|
173
|
+
/** Attestation statement. */
|
|
174
|
+
attStmt?: Record<string, unknown> | undefined;
|
|
175
|
+
/** Authenticator data as a Hex string (from `Authenticator.getAuthenticatorData`). */
|
|
176
|
+
authData: Hex.Hex;
|
|
177
|
+
/** Attestation format. @default 'none' */
|
|
178
|
+
fmt?: string | undefined;
|
|
179
|
+
};
|
|
180
|
+
type ErrorType = Cbor.encode.ErrorType | Errors.GlobalErrorType;
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=Authenticator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Authenticator.d.ts","sourceRoot":"","sources":["../../webauthn/Authenticator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AACzC,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AAEvC,OAAO,KAAK,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAEhD,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,KAAK,SAAS,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,GAAE,oBAAoB,CAAC,OAAY,GACzC,GAAG,CAAC,GAAG,CAyBT;AAED,MAAM,CAAC,OAAO,WAAW,oBAAoB,CAAC;IAC5C,KAAK,OAAO,GAAG;QACb,yHAAyH;QACzH,UAAU,CAAC,EACP;YACE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,CAAC,eAAe,CAAA;CACxC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,oBAAoB,CAAC,OAAO,GACpC,GAAG,CAAC,GAAG,CAOT;AAED,MAAM,CAAC,OAAO,WAAW,oBAAoB,CAAC;IAC5C,KAAK,OAAO,GAAG;QACb,6BAA6B;QAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;QAC7C,sFAAsF;QACtF,QAAQ,EAAE,GAAG,CAAC,GAAG,CAAA;QACjB,0CAA0C;QAC1C,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KACzB,CAAA;IAED,KAAK,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,eAAe,CAAA;CAChE"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as Base64 from '../core/Base64.js';
|
|
2
|
+
import type * as Errors from '../core/Errors.js';
|
|
3
|
+
import type * as Hex from '../core/Hex.js';
|
|
4
|
+
import type { Compute } from '../core/internal/types.js';
|
|
5
|
+
import * as PublicKey from '../core/PublicKey.js';
|
|
6
|
+
import type * as Types from './Types.js';
|
|
7
|
+
/** A WebAuthn-flavored P256 credential. */
|
|
8
|
+
export type Credential<serialized extends boolean = false> = {
|
|
9
|
+
attestationObject: serialized extends true ? string : ArrayBuffer;
|
|
10
|
+
clientDataJSON: serialized extends true ? string : ArrayBuffer;
|
|
11
|
+
id: string;
|
|
12
|
+
publicKey: serialized extends true ? Hex.Hex : PublicKey.PublicKey;
|
|
13
|
+
raw: Types.PublicKeyCredential<serialized>;
|
|
14
|
+
};
|
|
15
|
+
/** Metadata for a WebAuthn P256 signature. */
|
|
16
|
+
export type SignMetadata = Compute<{
|
|
17
|
+
authenticatorData: Hex.Hex;
|
|
18
|
+
challengeIndex?: number | undefined;
|
|
19
|
+
clientDataJSON: string;
|
|
20
|
+
typeIndex?: number | undefined;
|
|
21
|
+
userVerificationRequired?: boolean | undefined;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Serializes a credential into a JSON-serializable
|
|
25
|
+
* format.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts twoslash
|
|
29
|
+
* import { Registration, Credential } from 'ox/webauthn'
|
|
30
|
+
*
|
|
31
|
+
* const credential = await Registration.create({ name: 'Example' })
|
|
32
|
+
*
|
|
33
|
+
* const serialized = Credential.serialize(credential) // [!code focus]
|
|
34
|
+
*
|
|
35
|
+
* // `serialized` is JSON-serializable — send it to a server, store it, etc.
|
|
36
|
+
* const json = JSON.stringify(serialized)
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @param credential - The credential to serialize.
|
|
40
|
+
* @returns The serialized credential.
|
|
41
|
+
*/
|
|
42
|
+
export declare function serialize(credential: Credential): Credential<true>;
|
|
43
|
+
export declare namespace serialize {
|
|
44
|
+
type ErrorType = Base64.fromBytes.ErrorType | PublicKey.toHex.ErrorType | Errors.GlobalErrorType;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Deserializes a serialized credential.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts twoslash
|
|
51
|
+
* import { Credential } from 'ox/webauthn'
|
|
52
|
+
*
|
|
53
|
+
* const credential = Credential.deserialize({ // [!code focus]
|
|
54
|
+
* attestationObject: 'o2NmbXRkbm9uZQ...', // [!code focus]
|
|
55
|
+
* clientDataJSON: 'eyJ0eXBlIjoid2ViYXV0aG4uY3JlYXRlIn0', // [!code focus]
|
|
56
|
+
* id: 'm1-bMPuAqpWhCxHZQZTT6e-lSPntQbh3opIoGe7g4Qs', // [!code focus]
|
|
57
|
+
* publicKey: '0x04ab891400140fc4f8e941ce0ff90e419de9470acaca613bbd717a4775435031a7d884318e919fd3b3e5a631d866d8a380b44063e70f0c381ee16e0652f7f97554', // [!code focus]
|
|
58
|
+
* raw: { // [!code focus]
|
|
59
|
+
* id: 'm1-bMPuAqpWhCxHZQZTT6e-lSPntQbh3opIoGe7g4Qs', // [!code focus]
|
|
60
|
+
* type: 'public-key', // [!code focus]
|
|
61
|
+
* authenticatorAttachment: 'platform', // [!code focus]
|
|
62
|
+
* rawId: 'm1-bMPuAqpWhCxHZQZTT6e-lSPntQbh3opIoGe7g4Qs', // [!code focus]
|
|
63
|
+
* response: { // [!code focus]
|
|
64
|
+
* clientDataJSON: 'eyJ0eXBlIjoid2ViYXV0aG4uY3JlYXRlIn0', // [!code focus]
|
|
65
|
+
* }, // [!code focus]
|
|
66
|
+
* }, // [!code focus]
|
|
67
|
+
* }) // [!code focus]
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @param credential - The serialized credential.
|
|
71
|
+
* @returns The deserialized credential.
|
|
72
|
+
*/
|
|
73
|
+
export declare function deserialize(credential: Credential<true>): Credential;
|
|
74
|
+
export declare namespace deserialize {
|
|
75
|
+
type ErrorType = Base64.toBytes.ErrorType | PublicKey.from.ErrorType | Errors.GlobalErrorType;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=Credential.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Credential.d.ts","sourceRoot":"","sources":["../../webauthn/Credential.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,KAAK,GAAG,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AAOjD,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAA;AAExC,2CAA2C;AAC3C,MAAM,MAAM,UAAU,CAAC,UAAU,SAAS,OAAO,GAAG,KAAK,IAAI;IAC3D,iBAAiB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
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,O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