@simplewebauthn/server 12.0.0 → 13.0.0-alpha1
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/README.md +2 -2
- package/esm/authentication/generateAuthenticationOptions.d.ts +13 -13
- package/esm/authentication/generateAuthenticationOptions.d.ts.map +1 -1
- package/esm/authentication/verifyAuthenticationResponse.d.ts +18 -15
- package/esm/authentication/verifyAuthenticationResponse.d.ts.map +1 -1
- package/esm/helpers/convertCertBufferToPEM.d.ts +1 -1
- package/esm/helpers/convertCertBufferToPEM.d.ts.map +1 -1
- package/esm/helpers/cose.d.ts +22 -0
- package/esm/helpers/cose.d.ts.map +1 -1
- package/esm/helpers/cose.js +20 -0
- package/esm/helpers/decodeAttestationObject.d.ts +4 -0
- package/esm/helpers/decodeAttestationObject.d.ts.map +1 -1
- package/esm/helpers/decodeAttestationObject.js +4 -1
- package/esm/helpers/decodeClientDataJSON.d.ts +5 -1
- package/esm/helpers/decodeClientDataJSON.d.ts.map +1 -1
- package/esm/helpers/decodeClientDataJSON.js +4 -1
- package/esm/helpers/decodeCredentialPublicKey.d.ts +4 -0
- package/esm/helpers/decodeCredentialPublicKey.d.ts.map +1 -1
- package/esm/helpers/decodeCredentialPublicKey.js +4 -1
- package/esm/helpers/fetch.d.ts +4 -0
- package/esm/helpers/fetch.d.ts.map +1 -1
- package/esm/helpers/fetch.js +4 -1
- package/esm/helpers/generateChallenge.d.ts +4 -0
- package/esm/helpers/generateChallenge.d.ts.map +1 -1
- package/esm/helpers/generateChallenge.js +4 -1
- package/esm/helpers/generateUserID.d.ts +4 -0
- package/esm/helpers/generateUserID.d.ts.map +1 -1
- package/esm/helpers/generateUserID.js +4 -1
- package/esm/helpers/index.d.ts +16 -23
- package/esm/helpers/index.d.ts.map +1 -1
- package/esm/helpers/index.js +16 -17
- package/esm/helpers/iso/isoBase64URL.d.ts +1 -1
- package/esm/helpers/iso/isoBase64URL.d.ts.map +1 -1
- package/esm/helpers/iso/isoBase64URL.js +4 -0
- package/esm/helpers/iso/isoCBOR.d.ts +4 -0
- package/esm/helpers/iso/isoCBOR.d.ts.map +1 -1
- package/esm/helpers/iso/isoCBOR.js +4 -0
- package/esm/helpers/iso/isoCrypto/getWebCrypto.d.ts +1 -1
- package/esm/helpers/iso/isoCrypto/getWebCrypto.d.ts.map +1 -1
- package/esm/helpers/iso/isoCrypto/index.d.ts +4 -0
- package/esm/helpers/iso/isoCrypto/index.d.ts.map +1 -1
- package/esm/helpers/iso/isoCrypto/index.js +4 -0
- package/esm/helpers/iso/isoUint8Array.d.ts +4 -0
- package/esm/helpers/iso/isoUint8Array.d.ts.map +1 -1
- package/esm/helpers/iso/isoUint8Array.js +4 -0
- package/esm/helpers/parseAuthenticatorData.d.ts +4 -0
- package/esm/helpers/parseAuthenticatorData.d.ts.map +1 -1
- package/esm/helpers/parseAuthenticatorData.js +4 -1
- package/esm/helpers/parseBackupFlags.d.ts +1 -1
- package/esm/helpers/parseBackupFlags.d.ts.map +1 -1
- package/esm/helpers/validateCertificatePath.d.ts +3 -3
- package/esm/helpers/validateCertificatePath.d.ts.map +1 -1
- package/esm/helpers/validateCertificatePath.js +81 -58
- package/esm/helpers/verifySignature.d.ts +4 -0
- package/esm/helpers/verifySignature.d.ts.map +1 -1
- package/esm/helpers/verifySignature.js +4 -1
- package/esm/index.d.ts +8 -17
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +8 -11
- package/esm/metadata/mdsTypes.d.ts +5 -1
- package/esm/metadata/mdsTypes.d.ts.map +1 -1
- package/esm/metadata/verifyAttestationWithMetadata.d.ts +2 -2
- package/esm/metadata/verifyAttestationWithMetadata.d.ts.map +1 -1
- package/esm/metadata/verifyAttestationWithMetadata.js +1 -1
- package/esm/registration/generateRegistrationOptions.d.ts +21 -19
- package/esm/registration/generateRegistrationOptions.d.ts.map +1 -1
- package/esm/registration/generateRegistrationOptions.js +22 -1
- package/esm/registration/verifyRegistrationResponse.d.ts +17 -14
- package/esm/registration/verifyRegistrationResponse.d.ts.map +1 -1
- package/esm/services/metadataService.d.ts +22 -18
- package/esm/services/metadataService.d.ts.map +1 -1
- package/esm/services/metadataService.js +0 -19
- package/esm/services/settingsService.d.ts +11 -1
- package/esm/services/settingsService.d.ts.map +1 -1
- package/esm/services/settingsService.js +0 -10
- package/esm/types/dom.d.ts +329 -0
- package/esm/types/dom.d.ts.map +1 -0
- package/esm/types/dom.js +1 -0
- package/esm/types/index.d.ts +205 -0
- package/esm/types/index.d.ts.map +1 -0
- package/esm/types/index.js +1 -0
- package/package.json +2 -3
- package/script/authentication/generateAuthenticationOptions.d.ts +13 -13
- package/script/authentication/generateAuthenticationOptions.d.ts.map +1 -1
- package/script/authentication/verifyAuthenticationResponse.d.ts +18 -15
- package/script/authentication/verifyAuthenticationResponse.d.ts.map +1 -1
- package/script/helpers/convertCertBufferToPEM.d.ts +1 -1
- package/script/helpers/convertCertBufferToPEM.d.ts.map +1 -1
- package/script/helpers/cose.d.ts +22 -0
- package/script/helpers/cose.d.ts.map +1 -1
- package/script/helpers/cose.js +20 -0
- package/script/helpers/decodeAttestationObject.d.ts +4 -0
- package/script/helpers/decodeAttestationObject.d.ts.map +1 -1
- package/script/helpers/decodeAttestationObject.js +4 -1
- package/script/helpers/decodeClientDataJSON.d.ts +5 -1
- package/script/helpers/decodeClientDataJSON.d.ts.map +1 -1
- package/script/helpers/decodeClientDataJSON.js +4 -1
- package/script/helpers/decodeCredentialPublicKey.d.ts +4 -0
- package/script/helpers/decodeCredentialPublicKey.d.ts.map +1 -1
- package/script/helpers/decodeCredentialPublicKey.js +4 -1
- package/script/helpers/fetch.d.ts +4 -0
- package/script/helpers/fetch.d.ts.map +1 -1
- package/script/helpers/fetch.js +4 -1
- package/script/helpers/generateChallenge.d.ts +4 -0
- package/script/helpers/generateChallenge.d.ts.map +1 -1
- package/script/helpers/generateChallenge.js +4 -1
- package/script/helpers/generateUserID.d.ts +4 -0
- package/script/helpers/generateUserID.d.ts.map +1 -1
- package/script/helpers/generateUserID.js +4 -1
- package/script/helpers/index.d.ts +16 -23
- package/script/helpers/index.d.ts.map +1 -1
- package/script/helpers/index.js +20 -36
- package/script/helpers/iso/isoBase64URL.d.ts +1 -1
- package/script/helpers/iso/isoBase64URL.d.ts.map +1 -1
- package/script/helpers/iso/isoBase64URL.js +4 -0
- package/script/helpers/iso/isoCBOR.d.ts +4 -0
- package/script/helpers/iso/isoCBOR.d.ts.map +1 -1
- package/script/helpers/iso/isoCBOR.js +4 -0
- package/script/helpers/iso/isoCrypto/getWebCrypto.d.ts +1 -1
- package/script/helpers/iso/isoCrypto/getWebCrypto.d.ts.map +1 -1
- package/script/helpers/iso/isoCrypto/index.d.ts +4 -0
- package/script/helpers/iso/isoCrypto/index.d.ts.map +1 -1
- package/script/helpers/iso/isoCrypto/index.js +4 -0
- package/script/helpers/iso/isoUint8Array.d.ts +4 -0
- package/script/helpers/iso/isoUint8Array.d.ts.map +1 -1
- package/script/helpers/iso/isoUint8Array.js +4 -0
- package/script/helpers/parseAuthenticatorData.d.ts +4 -0
- package/script/helpers/parseAuthenticatorData.d.ts.map +1 -1
- package/script/helpers/parseAuthenticatorData.js +4 -1
- package/script/helpers/parseBackupFlags.d.ts +1 -1
- package/script/helpers/parseBackupFlags.d.ts.map +1 -1
- package/script/helpers/validateCertificatePath.d.ts +3 -3
- package/script/helpers/validateCertificatePath.d.ts.map +1 -1
- package/script/helpers/validateCertificatePath.js +81 -58
- package/script/helpers/verifySignature.d.ts +4 -0
- package/script/helpers/verifySignature.d.ts.map +1 -1
- package/script/helpers/verifySignature.js +4 -1
- package/script/index.d.ts +8 -17
- package/script/index.d.ts.map +1 -1
- package/script/index.js +22 -17
- package/script/metadata/mdsTypes.d.ts +5 -1
- package/script/metadata/mdsTypes.d.ts.map +1 -1
- package/script/metadata/verifyAttestationWithMetadata.d.ts +2 -2
- package/script/metadata/verifyAttestationWithMetadata.d.ts.map +1 -1
- package/script/registration/generateRegistrationOptions.d.ts +21 -19
- package/script/registration/generateRegistrationOptions.d.ts.map +1 -1
- package/script/registration/generateRegistrationOptions.js +22 -1
- package/script/registration/verifyRegistrationResponse.d.ts +17 -14
- package/script/registration/verifyRegistrationResponse.d.ts.map +1 -1
- package/script/services/metadataService.d.ts +22 -18
- package/script/services/metadataService.d.ts.map +1 -1
- package/script/services/metadataService.js +0 -19
- package/script/services/settingsService.d.ts +11 -1
- package/script/services/settingsService.d.ts.map +1 -1
- package/script/services/settingsService.js +0 -10
- package/script/types/dom.d.ts +329 -0
- package/script/types/dom.d.ts.map +1 -0
- package/script/types/dom.js +2 -0
- package/script/types/index.d.ts +205 -0
- package/script/types/index.d.ts.map +1 -0
- package/script/types/index.js +2 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DO NOT MODIFY THESE FILES!
|
|
3
|
+
*
|
|
4
|
+
* These files were copied from the **types** package. To update this file, make changes to those
|
|
5
|
+
* files instead and then run the following command from the monorepo root folder:
|
|
6
|
+
*
|
|
7
|
+
* deno task codegen:types
|
|
8
|
+
*/
|
|
9
|
+
import type { AttestationConveyancePreference, AuthenticationExtensionsClientInputs, AuthenticationExtensionsClientOutputs, AuthenticatorAssertionResponse, AuthenticatorAttachment, AuthenticatorAttestationResponse, AuthenticatorSelectionCriteria, COSEAlgorithmIdentifier, PublicKeyCredential, PublicKeyCredentialCreationOptions, PublicKeyCredentialDescriptor, PublicKeyCredentialParameters, PublicKeyCredentialRequestOptions, PublicKeyCredentialRpEntity, PublicKeyCredentialType, UserVerificationRequirement } from './dom.js';
|
|
10
|
+
export type { AttestationConveyancePreference, AuthenticationExtensionsClientInputs, AuthenticationExtensionsClientOutputs, AuthenticatorAssertionResponse, AuthenticatorAttachment, AuthenticatorAttestationResponse, AuthenticatorSelectionCriteria, AuthenticatorTransport, COSEAlgorithmIdentifier, Crypto, PublicKeyCredential, PublicKeyCredentialCreationOptions, PublicKeyCredentialDescriptor, PublicKeyCredentialParameters, PublicKeyCredentialRequestOptions, PublicKeyCredentialRpEntity, PublicKeyCredentialType, PublicKeyCredentialUserEntity, UserVerificationRequirement, } from './dom.js';
|
|
11
|
+
/**
|
|
12
|
+
* A variant of PublicKeyCredentialCreationOptions suitable for JSON transmission to the browser to
|
|
13
|
+
* (eventually) get passed into navigator.credentials.create(...) in the browser.
|
|
14
|
+
*
|
|
15
|
+
* This should eventually get replaced with official TypeScript DOM types when WebAuthn L3 types
|
|
16
|
+
* eventually make it into the language:
|
|
17
|
+
*
|
|
18
|
+
* https://w3c.github.io/webauthn/#dictdef-publickeycredentialcreationoptionsjson
|
|
19
|
+
*/
|
|
20
|
+
export interface PublicKeyCredentialCreationOptionsJSON {
|
|
21
|
+
rp: PublicKeyCredentialRpEntity;
|
|
22
|
+
user: PublicKeyCredentialUserEntityJSON;
|
|
23
|
+
challenge: Base64URLString;
|
|
24
|
+
pubKeyCredParams: PublicKeyCredentialParameters[];
|
|
25
|
+
timeout?: number;
|
|
26
|
+
excludeCredentials?: PublicKeyCredentialDescriptorJSON[];
|
|
27
|
+
authenticatorSelection?: AuthenticatorSelectionCriteria;
|
|
28
|
+
hints?: PublicKeyCredentialHint[];
|
|
29
|
+
attestation?: AttestationConveyancePreference;
|
|
30
|
+
attestationFormats?: AttestationFormat[];
|
|
31
|
+
extensions?: AuthenticationExtensionsClientInputs;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A variant of PublicKeyCredentialRequestOptions suitable for JSON transmission to the browser to
|
|
35
|
+
* (eventually) get passed into navigator.credentials.get(...) in the browser.
|
|
36
|
+
*/
|
|
37
|
+
export interface PublicKeyCredentialRequestOptionsJSON {
|
|
38
|
+
challenge: Base64URLString;
|
|
39
|
+
timeout?: number;
|
|
40
|
+
rpId?: string;
|
|
41
|
+
allowCredentials?: PublicKeyCredentialDescriptorJSON[];
|
|
42
|
+
userVerification?: UserVerificationRequirement;
|
|
43
|
+
hints?: PublicKeyCredentialHint[];
|
|
44
|
+
extensions?: AuthenticationExtensionsClientInputs;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* https://w3c.github.io/webauthn/#dictdef-publickeycredentialdescriptorjson
|
|
48
|
+
*/
|
|
49
|
+
export interface PublicKeyCredentialDescriptorJSON {
|
|
50
|
+
id: Base64URLString;
|
|
51
|
+
type: PublicKeyCredentialType;
|
|
52
|
+
transports?: AuthenticatorTransportFuture[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* https://w3c.github.io/webauthn/#dictdef-publickeycredentialuserentityjson
|
|
56
|
+
*/
|
|
57
|
+
export interface PublicKeyCredentialUserEntityJSON {
|
|
58
|
+
id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
displayName: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The value returned from navigator.credentials.create()
|
|
64
|
+
*/
|
|
65
|
+
export interface RegistrationCredential extends PublicKeyCredentialFuture {
|
|
66
|
+
response: AuthenticatorAttestationResponseFuture;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A slightly-modified RegistrationCredential to simplify working with ArrayBuffers that
|
|
70
|
+
* are Base64URL-encoded in the browser so that they can be sent as JSON to the server.
|
|
71
|
+
*
|
|
72
|
+
* https://w3c.github.io/webauthn/#dictdef-registrationresponsejson
|
|
73
|
+
*/
|
|
74
|
+
export interface RegistrationResponseJSON {
|
|
75
|
+
id: Base64URLString;
|
|
76
|
+
rawId: Base64URLString;
|
|
77
|
+
response: AuthenticatorAttestationResponseJSON;
|
|
78
|
+
authenticatorAttachment?: AuthenticatorAttachment;
|
|
79
|
+
clientExtensionResults: AuthenticationExtensionsClientOutputs;
|
|
80
|
+
type: PublicKeyCredentialType;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The value returned from navigator.credentials.get()
|
|
84
|
+
*/
|
|
85
|
+
export interface AuthenticationCredential extends PublicKeyCredentialFuture {
|
|
86
|
+
response: AuthenticatorAssertionResponse;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A slightly-modified AuthenticationCredential to simplify working with ArrayBuffers that
|
|
90
|
+
* are Base64URL-encoded in the browser so that they can be sent as JSON to the server.
|
|
91
|
+
*
|
|
92
|
+
* https://w3c.github.io/webauthn/#dictdef-authenticationresponsejson
|
|
93
|
+
*/
|
|
94
|
+
export interface AuthenticationResponseJSON {
|
|
95
|
+
id: Base64URLString;
|
|
96
|
+
rawId: Base64URLString;
|
|
97
|
+
response: AuthenticatorAssertionResponseJSON;
|
|
98
|
+
authenticatorAttachment?: AuthenticatorAttachment;
|
|
99
|
+
clientExtensionResults: AuthenticationExtensionsClientOutputs;
|
|
100
|
+
type: PublicKeyCredentialType;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* A slightly-modified AuthenticatorAttestationResponse to simplify working with ArrayBuffers that
|
|
104
|
+
* are Base64URL-encoded in the browser so that they can be sent as JSON to the server.
|
|
105
|
+
*
|
|
106
|
+
* https://w3c.github.io/webauthn/#dictdef-authenticatorattestationresponsejson
|
|
107
|
+
*/
|
|
108
|
+
export interface AuthenticatorAttestationResponseJSON {
|
|
109
|
+
clientDataJSON: Base64URLString;
|
|
110
|
+
attestationObject: Base64URLString;
|
|
111
|
+
authenticatorData?: Base64URLString;
|
|
112
|
+
transports?: AuthenticatorTransportFuture[];
|
|
113
|
+
publicKeyAlgorithm?: COSEAlgorithmIdentifier;
|
|
114
|
+
publicKey?: Base64URLString;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* A slightly-modified AuthenticatorAssertionResponse to simplify working with ArrayBuffers that
|
|
118
|
+
* are Base64URL-encoded in the browser so that they can be sent as JSON to the server.
|
|
119
|
+
*
|
|
120
|
+
* https://w3c.github.io/webauthn/#dictdef-authenticatorassertionresponsejson
|
|
121
|
+
*/
|
|
122
|
+
export interface AuthenticatorAssertionResponseJSON {
|
|
123
|
+
clientDataJSON: Base64URLString;
|
|
124
|
+
authenticatorData: Base64URLString;
|
|
125
|
+
signature: Base64URLString;
|
|
126
|
+
userHandle?: Base64URLString;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Public key credential information needed to verify authentication responses
|
|
130
|
+
*/
|
|
131
|
+
export type WebAuthnCredential = {
|
|
132
|
+
id: Base64URLString;
|
|
133
|
+
publicKey: Uint8Array;
|
|
134
|
+
counter: number;
|
|
135
|
+
transports?: AuthenticatorTransportFuture[];
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* An attempt to communicate that this isn't just any string, but a Base64URL-encoded string
|
|
139
|
+
*/
|
|
140
|
+
export type Base64URLString = string;
|
|
141
|
+
/**
|
|
142
|
+
* AuthenticatorAttestationResponse in TypeScript's DOM lib is outdated (up through v3.9.7).
|
|
143
|
+
* Maintain an augmented version here so we can implement additional properties as the WebAuthn
|
|
144
|
+
* spec evolves.
|
|
145
|
+
*
|
|
146
|
+
* See https://www.w3.org/TR/webauthn-2/#iface-authenticatorattestationresponse
|
|
147
|
+
*
|
|
148
|
+
* Properties marked optional are not supported in all browsers.
|
|
149
|
+
*/
|
|
150
|
+
export interface AuthenticatorAttestationResponseFuture extends AuthenticatorAttestationResponse {
|
|
151
|
+
getTransports(): AuthenticatorTransportFuture[];
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* A super class of TypeScript's `AuthenticatorTransport` that includes support for the latest
|
|
155
|
+
* transports. Should eventually be replaced by TypeScript's when TypeScript gets updated to
|
|
156
|
+
* know about it (sometime after 4.6.3)
|
|
157
|
+
*/
|
|
158
|
+
export type AuthenticatorTransportFuture = 'ble' | 'cable' | 'hybrid' | 'internal' | 'nfc' | 'smart-card' | 'usb';
|
|
159
|
+
/**
|
|
160
|
+
* A super class of TypeScript's `PublicKeyCredentialDescriptor` that knows about the latest
|
|
161
|
+
* transports. Should eventually be replaced by TypeScript's when TypeScript gets updated to
|
|
162
|
+
* know about it (sometime after 4.6.3)
|
|
163
|
+
*/
|
|
164
|
+
export interface PublicKeyCredentialDescriptorFuture extends Omit<PublicKeyCredentialDescriptor, 'transports'> {
|
|
165
|
+
transports?: AuthenticatorTransportFuture[];
|
|
166
|
+
}
|
|
167
|
+
/** */
|
|
168
|
+
export type PublicKeyCredentialJSON = RegistrationResponseJSON | AuthenticationResponseJSON;
|
|
169
|
+
/**
|
|
170
|
+
* A super class of TypeScript's `PublicKeyCredential` that knows about upcoming WebAuthn features
|
|
171
|
+
*/
|
|
172
|
+
export interface PublicKeyCredentialFuture extends PublicKeyCredential {
|
|
173
|
+
type: PublicKeyCredentialType;
|
|
174
|
+
isConditionalMediationAvailable?(): Promise<boolean>;
|
|
175
|
+
parseCreationOptionsFromJSON?(options: PublicKeyCredentialCreationOptionsJSON): PublicKeyCredentialCreationOptions;
|
|
176
|
+
parseRequestOptionsFromJSON?(options: PublicKeyCredentialRequestOptionsJSON): PublicKeyCredentialRequestOptions;
|
|
177
|
+
toJSON?(): PublicKeyCredentialJSON;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* The two types of credentials as defined by bit 3 ("Backup Eligibility") in authenticator data:
|
|
181
|
+
* - `"singleDevice"` credentials will never be backed up
|
|
182
|
+
* - `"multiDevice"` credentials can be backed up
|
|
183
|
+
*/
|
|
184
|
+
export type CredentialDeviceType = 'singleDevice' | 'multiDevice';
|
|
185
|
+
/**
|
|
186
|
+
* Categories of authenticators that Relying Parties can pass along to browsers during
|
|
187
|
+
* registration. Browsers that understand these values can optimize their modal experience to
|
|
188
|
+
* start the user off in a particular registration flow:
|
|
189
|
+
*
|
|
190
|
+
* - `hybrid`: A platform authenticator on a mobile device
|
|
191
|
+
* - `security-key`: A portable FIDO2 authenticator capable of being used on multiple devices via a USB or NFC connection
|
|
192
|
+
* - `client-device`: The device that WebAuthn is being called on. Typically synonymous with platform authenticators
|
|
193
|
+
*
|
|
194
|
+
* See https://w3c.github.io/webauthn/#enumdef-publickeycredentialhint
|
|
195
|
+
*
|
|
196
|
+
* These values are less strict than `authenticatorAttachment`
|
|
197
|
+
*/
|
|
198
|
+
export type PublicKeyCredentialHint = 'hybrid' | 'security-key' | 'client-device';
|
|
199
|
+
/**
|
|
200
|
+
* Values for an attestation object's `fmt`
|
|
201
|
+
*
|
|
202
|
+
* See https://www.iana.org/assignments/webauthn/webauthn.xhtml#webauthn-attestation-statement-format-ids
|
|
203
|
+
*/
|
|
204
|
+
export type AttestationFormat = 'fido-u2f' | 'packed' | 'android-safetynet' | 'android-key' | 'tpm' | 'apple' | 'none';
|
|
205
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,+BAA+B,EAC/B,oCAAoC,EACpC,qCAAqC,EACrC,8BAA8B,EAC9B,uBAAuB,EACvB,gCAAgC,EAChC,8BAA8B,EAC9B,uBAAuB,EACvB,mBAAmB,EACnB,kCAAkC,EAClC,6BAA6B,EAC7B,6BAA6B,EAC7B,iCAAiC,EACjC,2BAA2B,EAC3B,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,+BAA+B,EAC/B,oCAAoC,EACpC,qCAAqC,EACrC,8BAA8B,EAC9B,uBAAuB,EACvB,gCAAgC,EAChC,8BAA8B,EAC9B,sBAAsB,EACtB,uBAAuB,EACvB,MAAM,EACN,mBAAmB,EACnB,kCAAkC,EAClC,6BAA6B,EAC7B,6BAA6B,EAC7B,iCAAiC,EACjC,2BAA2B,EAC3B,uBAAuB,EACvB,6BAA6B,EAC7B,2BAA2B,GAC5B,MAAM,UAAU,CAAC;AAElB;;;;;;;;GAQG;AACH,MAAM,WAAW,sCAAsC;IACrD,EAAE,EAAE,2BAA2B,CAAC;IAChC,IAAI,EAAE,iCAAiC,CAAC;IACxC,SAAS,EAAE,eAAe,CAAC;IAC3B,gBAAgB,EAAE,6BAA6B,EAAE,CAAC;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;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GACL,YAAY,GACZ,KAAK,CAAC;AAEV;;;;GAIG;AACH,MAAM,WAAW,mCACf,SAAQ,IAAI,CAAC,6BAA6B,EAAE,YAAY,CAAC;IACzD,UAAU,CAAC,EAAE,4BAA4B,EAAE,CAAC;CAC7C;AAED,MAAM;AACN,MAAM,MAAM,uBAAuB,GAC/B,wBAAwB,GACxB,0BAA0B,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IACpE,IAAI,EAAE,uBAAuB,CAAC;IAE9B,+BAA+B,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAErD,4BAA4B,CAAC,CAC3B,OAAO,EAAE,sCAAsC,GAC9C,kCAAkC,CAAC;IAEtC,2BAA2B,CAAC,CAC1B,OAAO,EAAE,qCAAqC,GAC7C,iCAAiC,CAAC;IAErC,MAAM,CAAC,IAAI,uBAAuB,CAAC;CACpC;AAED;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,cAAc,GAAG,aAAa,CAAC;AAElE;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,cAAc,GAAG,eAAe,CAAC;AAElF;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GACzB,UAAU,GACV,QAAQ,GACR,mBAAmB,GACnB,aAAa,GACb,KAAK,GACL,OAAO,GACP,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplewebauthn/server",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0-alpha1",
|
|
4
4
|
"description": "SimpleWebAuthn for Servers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -56,8 +56,7 @@
|
|
|
56
56
|
"@peculiar/asn1-rsa": "^2.3.8",
|
|
57
57
|
"@peculiar/asn1-schema": "^2.3.8",
|
|
58
58
|
"@peculiar/asn1-x509": "^2.3.8",
|
|
59
|
-
"cross-fetch": "^4.0.0"
|
|
60
|
-
"@simplewebauthn/types": "^12.0.0"
|
|
59
|
+
"cross-fetch": "^4.0.0"
|
|
61
60
|
},
|
|
62
61
|
"devDependencies": {
|
|
63
62
|
"@types/node": "^20.9.0"
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
import type { AuthenticationExtensionsClientInputs, AuthenticatorTransportFuture, Base64URLString, PublicKeyCredentialRequestOptionsJSON
|
|
2
|
-
export type GenerateAuthenticationOptionsOpts =
|
|
3
|
-
rpID: string;
|
|
4
|
-
allowCredentials?: {
|
|
5
|
-
id: Base64URLString;
|
|
6
|
-
transports?: AuthenticatorTransportFuture[];
|
|
7
|
-
}[];
|
|
8
|
-
challenge?: string | Uint8Array;
|
|
9
|
-
timeout?: number;
|
|
10
|
-
userVerification?: UserVerificationRequirement;
|
|
11
|
-
extensions?: AuthenticationExtensionsClientInputs;
|
|
12
|
-
};
|
|
1
|
+
import type { AuthenticationExtensionsClientInputs, AuthenticatorTransportFuture, Base64URLString, PublicKeyCredentialRequestOptionsJSON } from '../types/index.js';
|
|
2
|
+
export type GenerateAuthenticationOptionsOpts = Parameters<typeof generateAuthenticationOptions>[0];
|
|
13
3
|
/**
|
|
14
4
|
* Prepare a value to pass into navigator.credentials.get(...) for authenticator authentication
|
|
15
5
|
*
|
|
@@ -22,5 +12,15 @@ export type GenerateAuthenticationOptionsOpts = {
|
|
|
22
12
|
* @param userVerification **(Optional)** - Set to `'discouraged'` when asserting as part of a 2FA flow, otherwise set to `'preferred'` or `'required'` as desired. Defaults to `"preferred"`
|
|
23
13
|
* @param extensions **(Optional)** - Additional plugins the authenticator or browser should use during authentication
|
|
24
14
|
*/
|
|
25
|
-
export declare function generateAuthenticationOptions(options:
|
|
15
|
+
export declare function generateAuthenticationOptions(options: {
|
|
16
|
+
rpID: string;
|
|
17
|
+
allowCredentials?: {
|
|
18
|
+
id: Base64URLString;
|
|
19
|
+
transports?: AuthenticatorTransportFuture[];
|
|
20
|
+
}[];
|
|
21
|
+
challenge?: string | Uint8Array;
|
|
22
|
+
timeout?: number;
|
|
23
|
+
userVerification?: 'required' | 'preferred' | 'discouraged';
|
|
24
|
+
extensions?: AuthenticationExtensionsClientInputs;
|
|
25
|
+
}): Promise<PublicKeyCredentialRequestOptionsJSON>;
|
|
26
26
|
//# sourceMappingURL=generateAuthenticationOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateAuthenticationOptions.d.ts","sourceRoot":"","sources":["../../src/authentication/generateAuthenticationOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,4BAA4B,EAC5B,eAAe,EACf,qCAAqC,
|
|
1
|
+
{"version":3,"file":"generateAuthenticationOptions.d.ts","sourceRoot":"","sources":["../../src/authentication/generateAuthenticationOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,4BAA4B,EAC5B,eAAe,EACf,qCAAqC,EACtC,MAAM,mBAAmB,CAAC;AAI3B,MAAM,MAAM,iCAAiC,GAAG,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC;AAEpG;;;;;;;;;;;GAWG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,EAAE;IACP,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE;QACjB,EAAE,EAAE,eAAe,CAAC;QACpB,UAAU,CAAC,EAAE,4BAA4B,EAAE,CAAC;KAC7C,EAAE,CAAC;IACJ,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,CAAC;IAC5D,UAAU,CAAC,EAAE,oCAAoC,CAAC;CACnD,GACA,OAAO,CAAC,qCAAqC,CAAC,CAoChD"}
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
import type { AuthenticationResponseJSON, Base64URLString, CredentialDeviceType, UserVerificationRequirement, WebAuthnCredential } from '
|
|
2
|
-
import { AuthenticationExtensionsAuthenticatorOutputs } from '../helpers/decodeAuthenticatorExtensions.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
expectedRPID: string | string[];
|
|
8
|
-
credential: WebAuthnCredential;
|
|
9
|
-
expectedType?: string | string[];
|
|
10
|
-
requireUserVerification?: boolean;
|
|
11
|
-
advancedFIDOConfig?: {
|
|
12
|
-
userVerification?: UserVerificationRequirement;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
1
|
+
import type { AuthenticationResponseJSON, Base64URLString, CredentialDeviceType, UserVerificationRequirement, WebAuthnCredential } from '../types/index.js';
|
|
2
|
+
import type { AuthenticationExtensionsAuthenticatorOutputs } from '../helpers/decodeAuthenticatorExtensions.js';
|
|
3
|
+
/**
|
|
4
|
+
* Configurable options when calling `verifyAuthenticationResponse()`
|
|
5
|
+
*/
|
|
6
|
+
export type VerifyAuthenticationResponseOpts = Parameters<typeof verifyAuthenticationResponse>[0];
|
|
15
7
|
/**
|
|
16
8
|
* Verify that the user has legitimately completed the authentication process
|
|
17
9
|
*
|
|
@@ -27,7 +19,18 @@ export type VerifyAuthenticationResponseOpts = {
|
|
|
27
19
|
* @param advancedFIDOConfig **(Optional)** - Options for satisfying more stringent FIDO RP feature requirements
|
|
28
20
|
* @param advancedFIDOConfig.userVerification **(Optional)** - Enable alternative rules for evaluating the User Presence and User Verified flags in authenticator data: UV (and UP) flags are optional unless this value is `"required"`
|
|
29
21
|
*/
|
|
30
|
-
export declare function verifyAuthenticationResponse(options:
|
|
22
|
+
export declare function verifyAuthenticationResponse(options: {
|
|
23
|
+
response: AuthenticationResponseJSON;
|
|
24
|
+
expectedChallenge: string | ((challenge: string) => boolean | Promise<boolean>);
|
|
25
|
+
expectedOrigin: string | string[];
|
|
26
|
+
expectedRPID: string | string[];
|
|
27
|
+
credential: WebAuthnCredential;
|
|
28
|
+
expectedType?: string | string[];
|
|
29
|
+
requireUserVerification?: boolean;
|
|
30
|
+
advancedFIDOConfig?: {
|
|
31
|
+
userVerification?: UserVerificationRequirement;
|
|
32
|
+
};
|
|
33
|
+
}): Promise<VerifiedAuthenticationResponse>;
|
|
31
34
|
/**
|
|
32
35
|
* Result of authentication verification
|
|
33
36
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyAuthenticationResponse.d.ts","sourceRoot":"","sources":["../../src/authentication/verifyAuthenticationResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,eAAe,EACf,oBAAoB,EACpB,2BAA2B,EAC3B,kBAAkB,EACnB,MAAM,
|
|
1
|
+
{"version":3,"file":"verifyAuthenticationResponse.d.ts","sourceRoot":"","sources":["../../src/authentication/verifyAuthenticationResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,eAAe,EACf,oBAAoB,EACpB,2BAA2B,EAC3B,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,KAAK,EAAE,4CAA4C,EAAE,MAAM,6CAA6C,CAAC;AAIhH;;GAEG;AACH,MAAM,MAAM,gCAAgC,GAAG,UAAU,CAAC,OAAO,4BAA4B,CAAC,CAAC,CAAC,CAAC,CAAC;AAElG;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,4BAA4B,CAChD,OAAO,EAAE;IACP,QAAQ,EAAE,0BAA0B,CAAC;IACrC,iBAAiB,EAAE,MAAM,GAAG,CAAC,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAChF,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAClC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAChC,UAAU,EAAE,kBAAkB,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACjC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,kBAAkB,CAAC,EAAE;QACnB,gBAAgB,CAAC,EAAE,2BAA2B,CAAC;KAChD,CAAC;CACH,GACA,OAAO,CAAC,8BAA8B,CAAC,CAmNzC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE;QAClB,YAAY,EAAE,eAAe,CAAC;QAC9B,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,OAAO,CAAC;QACtB,oBAAoB,EAAE,oBAAoB,CAAC;QAC3C,kBAAkB,EAAE,OAAO,CAAC;QAC5B,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,6BAA6B,CAAC,EAAE,4CAA4C,CAAC;KAC9E,CAAC;CACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertCertBufferToPEM.d.ts","sourceRoot":"","sources":["../../src/helpers/convertCertBufferToPEM.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"convertCertBufferToPEM.d.ts","sourceRoot":"","sources":["../../src/helpers/convertCertBufferToPEM.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzD;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,UAAU,GAAG,eAAe,GACvC,MAAM,CA4BR"}
|
package/script/helpers/cose.d.ts
CHANGED
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
*
|
|
8
8
|
* These types are an unorthodox way of saying "these Maps should involve these discrete lists of
|
|
9
9
|
* keys", but it works.
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* COSE public key common values
|
|
10
14
|
*/
|
|
11
15
|
export type COSEPublicKey = {
|
|
12
16
|
get(key: COSEKEYS.kty): COSEKTY | undefined;
|
|
@@ -14,12 +18,18 @@ export type COSEPublicKey = {
|
|
|
14
18
|
set(key: COSEKEYS.kty, value: COSEKTY): void;
|
|
15
19
|
set(key: COSEKEYS.alg, value: COSEALG): void;
|
|
16
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Values specific to Octet Key Pair public keys
|
|
23
|
+
*/
|
|
17
24
|
export type COSEPublicKeyOKP = COSEPublicKey & {
|
|
18
25
|
get(key: COSEKEYS.crv): number | undefined;
|
|
19
26
|
get(key: COSEKEYS.x): Uint8Array | undefined;
|
|
20
27
|
set(key: COSEKEYS.crv, value: number): void;
|
|
21
28
|
set(key: COSEKEYS.x, value: Uint8Array): void;
|
|
22
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Values specific to Elliptic Curve Cryptography public keys
|
|
32
|
+
*/
|
|
23
33
|
export type COSEPublicKeyEC2 = COSEPublicKey & {
|
|
24
34
|
get(key: COSEKEYS.crv): number | undefined;
|
|
25
35
|
get(key: COSEKEYS.x): Uint8Array | undefined;
|
|
@@ -28,14 +38,26 @@ export type COSEPublicKeyEC2 = COSEPublicKey & {
|
|
|
28
38
|
set(key: COSEKEYS.x, value: Uint8Array): void;
|
|
29
39
|
set(key: COSEKEYS.y, value: Uint8Array): void;
|
|
30
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* Values specific to RSA public keys
|
|
43
|
+
*/
|
|
31
44
|
export type COSEPublicKeyRSA = COSEPublicKey & {
|
|
32
45
|
get(key: COSEKEYS.n): Uint8Array | undefined;
|
|
33
46
|
get(key: COSEKEYS.e): Uint8Array | undefined;
|
|
34
47
|
set(key: COSEKEYS.n, value: Uint8Array): void;
|
|
35
48
|
set(key: COSEKEYS.e, value: Uint8Array): void;
|
|
36
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* A type guard for determining if a COSE public key is an OKP key pair
|
|
52
|
+
*/
|
|
37
53
|
export declare function isCOSEPublicKeyOKP(cosePublicKey: COSEPublicKey): cosePublicKey is COSEPublicKeyOKP;
|
|
54
|
+
/**
|
|
55
|
+
* A type guard for determining if a COSE public key is an EC2 key pair
|
|
56
|
+
*/
|
|
38
57
|
export declare function isCOSEPublicKeyEC2(cosePublicKey: COSEPublicKey): cosePublicKey is COSEPublicKeyEC2;
|
|
58
|
+
/**
|
|
59
|
+
* A type guard for determining if a COSE public key is an RSA key pair
|
|
60
|
+
*/
|
|
39
61
|
export declare function isCOSEPublicKeyRSA(cosePublicKey: COSEPublicKey): cosePublicKey is COSEPublicKeyRSA;
|
|
40
62
|
/**
|
|
41
63
|
* COSE Keys
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cose.d.ts","sourceRoot":"","sources":["../../src/helpers/cose.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cose.d.ts","sourceRoot":"","sources":["../../src/helpers/cose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAE1B,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,GAAG,OAAO,GAAG,SAAS,CAAC;IAC5C,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,GAAG,OAAO,GAAG,SAAS,CAAC;IAE5C,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7C,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAE7C,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,GAAG,MAAM,GAAG,SAAS,CAAC;IAC3C,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,GAA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|
+
/**
|
|
3
|
+
* Fundamental values that are needed to discern the more specific COSE public key types below.
|
|
4
|
+
*
|
|
5
|
+
* The use of `Maps` here is due to CBOR encoding being used with public keys, and the CBOR "Map"
|
|
6
|
+
* type is being decoded to JavaScript's `Map` type instead of, say, a basic Object as us JS
|
|
7
|
+
* developers might prefer.
|
|
8
|
+
*
|
|
9
|
+
* These types are an unorthodox way of saying "these Maps should involve these discrete lists of
|
|
10
|
+
* keys", but it works.
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.COSEALG = exports.COSECRV = exports.COSEKTY = exports.COSEKEYS = void 0;
|
|
4
15
|
exports.isCOSEPublicKeyOKP = isCOSEPublicKeyOKP;
|
|
@@ -7,14 +18,23 @@ exports.isCOSEPublicKeyRSA = isCOSEPublicKeyRSA;
|
|
|
7
18
|
exports.isCOSEKty = isCOSEKty;
|
|
8
19
|
exports.isCOSECrv = isCOSECrv;
|
|
9
20
|
exports.isCOSEAlg = isCOSEAlg;
|
|
21
|
+
/**
|
|
22
|
+
* A type guard for determining if a COSE public key is an OKP key pair
|
|
23
|
+
*/
|
|
10
24
|
function isCOSEPublicKeyOKP(cosePublicKey) {
|
|
11
25
|
const kty = cosePublicKey.get(COSEKEYS.kty);
|
|
12
26
|
return isCOSEKty(kty) && kty === COSEKTY.OKP;
|
|
13
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* A type guard for determining if a COSE public key is an EC2 key pair
|
|
30
|
+
*/
|
|
14
31
|
function isCOSEPublicKeyEC2(cosePublicKey) {
|
|
15
32
|
const kty = cosePublicKey.get(COSEKEYS.kty);
|
|
16
33
|
return isCOSEKty(kty) && kty === COSEKTY.EC2;
|
|
17
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* A type guard for determining if a COSE public key is an RSA key pair
|
|
37
|
+
*/
|
|
18
38
|
function isCOSEPublicKeyRSA(cosePublicKey) {
|
|
19
39
|
const kty = cosePublicKey.get(COSEKEYS.kty);
|
|
20
40
|
return isCOSEKty(kty) && kty === COSEKTY.RSA;
|
|
@@ -24,6 +24,10 @@ export type AttestationStatement = {
|
|
|
24
24
|
get(key: 'pubArea'): Uint8Array | undefined;
|
|
25
25
|
readonly size: number;
|
|
26
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Make it possible to stub the return value during testing
|
|
29
|
+
* @ignore Don't include this in docs output
|
|
30
|
+
*/
|
|
27
31
|
export declare const _decodeAttestationObjectInternals: {
|
|
28
32
|
stubThis: (value: AttestationObject) => AttestationObject;
|
|
29
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decodeAttestationObject.d.ts","sourceRoot":"","sources":["../../src/helpers/decodeAttestationObject.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,iBAAiB,EAAE,UAAU,GAC5B,iBAAiB,CAInB;AAED,MAAM,MAAM,iBAAiB,GACzB,UAAU,GACV,QAAQ,GACR,mBAAmB,GACnB,aAAa,GACb,KAAK,GACL,OAAO,GACP,MAAM,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,CAAC,GAAG,EAAE,KAAK,GAAG,iBAAiB,CAAC;IACnC,GAAG,CAAC,GAAG,EAAE,SAAS,GAAG,oBAAoB,CAAC;IAC1C,GAAG,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,CAAC;CAClC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,CAAC,GAAG,EAAE,KAAK,GAAG,UAAU,GAAG,SAAS,CAAC;IACxC,GAAG,CAAC,GAAG,EAAE,KAAK,GAAG,UAAU,EAAE,GAAG,SAAS,CAAC;IAC1C,GAAG,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;IAC7C,GAAG,CAAC,GAAG,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC;IACpC,GAA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G,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IAE5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iCAAiC;sBAC1B,iBAAiB;CACpC,CAAC"}
|
|
@@ -11,7 +11,10 @@ const index_js_1 = require("./iso/index.js");
|
|
|
11
11
|
function decodeAttestationObject(attestationObject) {
|
|
12
12
|
return exports._decodeAttestationObjectInternals.stubThis(index_js_1.isoCBOR.decodeFirst(attestationObject));
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Make it possible to stub the return value during testing
|
|
16
|
+
* @ignore Don't include this in docs output
|
|
17
|
+
*/
|
|
15
18
|
exports._decodeAttestationObjectInternals = {
|
|
16
19
|
stubThis: (value) => value,
|
|
17
20
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Base64URLString } from '
|
|
1
|
+
import type { Base64URLString } from '../types/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Decode an authenticator's base64url-encoded clientDataJSON to JSON
|
|
4
4
|
*/
|
|
@@ -13,6 +13,10 @@ export type ClientDataJSON = {
|
|
|
13
13
|
status: 'present' | 'supported' | 'not-supported';
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Make it possible to stub the return value during testing
|
|
18
|
+
* @ignore Don't include this in docs output
|
|
19
|
+
*/
|
|
16
20
|
export declare const _decodeClientDataJSONInternals: {
|
|
17
21
|
stubThis: (value: ClientDataJSON) => ClientDataJSON;
|
|
18
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decodeClientDataJSON.d.ts","sourceRoot":"","sources":["../../src/helpers/decodeClientDataJSON.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"decodeClientDataJSON.d.ts","sourceRoot":"","sources":["../../src/helpers/decodeClientDataJSON.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,eAAe,GAAG,cAAc,CAK1E;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE;QACb,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,eAAe,CAAC;KACnD,CAAC;CACH,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,8BAA8B;sBACvB,cAAc;CACjC,CAAC"}
|
|
@@ -11,7 +11,10 @@ function decodeClientDataJSON(data) {
|
|
|
11
11
|
const clientData = JSON.parse(toString);
|
|
12
12
|
return exports._decodeClientDataJSONInternals.stubThis(clientData);
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Make it possible to stub the return value during testing
|
|
16
|
+
* @ignore Don't include this in docs output
|
|
17
|
+
*/
|
|
15
18
|
exports._decodeClientDataJSONInternals = {
|
|
16
19
|
stubThis: (value) => value,
|
|
17
20
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { COSEPublicKey } from './cose.js';
|
|
2
2
|
export declare function decodeCredentialPublicKey(publicKey: Uint8Array): COSEPublicKey;
|
|
3
|
+
/**
|
|
4
|
+
* Make it possible to stub the return value during testing
|
|
5
|
+
* @ignore Don't include this in docs output
|
|
6
|
+
*/
|
|
3
7
|
export declare const _decodeCredentialPublicKeyInternals: {
|
|
4
8
|
stubThis: (value: COSEPublicKey) => COSEPublicKey;
|
|
5
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decodeCredentialPublicKey.d.ts","sourceRoot":"","sources":["../../src/helpers/decodeCredentialPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG1C,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,UAAU,GACpB,aAAa,CAIf;
|
|
1
|
+
{"version":3,"file":"decodeCredentialPublicKey.d.ts","sourceRoot":"","sources":["../../src/helpers/decodeCredentialPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG1C,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,UAAU,GACpB,aAAa,CAIf;AAED;;;GAGG;AACH,eAAO,MAAM,mCAAmC;sBAC5B,aAAa;CAChC,CAAC"}
|
|
@@ -6,7 +6,10 @@ const index_js_1 = require("./iso/index.js");
|
|
|
6
6
|
function decodeCredentialPublicKey(publicKey) {
|
|
7
7
|
return exports._decodeCredentialPublicKeyInternals.stubThis(index_js_1.isoCBOR.decodeFirst(publicKey));
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Make it possible to stub the return value during testing
|
|
11
|
+
* @ignore Don't include this in docs output
|
|
12
|
+
*/
|
|
10
13
|
exports._decodeCredentialPublicKeyInternals = {
|
|
11
14
|
stubThis: (value) => value,
|
|
12
15
|
};
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
* across multiple runtimes.
|
|
4
4
|
*/
|
|
5
5
|
export declare function fetch(url: string): Promise<Response>;
|
|
6
|
+
/**
|
|
7
|
+
* Make it possible to stub the return value during testing
|
|
8
|
+
* @ignore Don't include this in docs output
|
|
9
|
+
*/
|
|
6
10
|
export declare const _fetchInternals: {
|
|
7
11
|
stubThis: (url: string) => Promise<Response>;
|
|
8
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/helpers/fetch.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAEpD;
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/helpers/fetch.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAEpD;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe;oBACV,MAAM;CACvB,CAAC"}
|
package/script/helpers/fetch.js
CHANGED
|
@@ -10,7 +10,10 @@ const cross_fetch_1 = require("cross-fetch");
|
|
|
10
10
|
function fetch(url) {
|
|
11
11
|
return exports._fetchInternals.stubThis(url);
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Make it possible to stub the return value during testing
|
|
15
|
+
* @ignore Don't include this in docs output
|
|
16
|
+
*/
|
|
14
17
|
exports._fetchInternals = {
|
|
15
18
|
stubThis: (url) => (0, cross_fetch_1.fetch)(url),
|
|
16
19
|
};
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* Generate a suitably random value to be used as an attestation or assertion challenge
|
|
3
3
|
*/
|
|
4
4
|
export declare function generateChallenge(): Promise<Uint8Array>;
|
|
5
|
+
/**
|
|
6
|
+
* Make it possible to stub the return value during testing
|
|
7
|
+
* @ignore Don't include this in docs output
|
|
8
|
+
*/
|
|
5
9
|
export declare const _generateChallengeInternals: {
|
|
6
10
|
stubThis: (value: Uint8Array) => Uint8Array;
|
|
7
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateChallenge.d.ts","sourceRoot":"","sources":["../../src/helpers/generateChallenge.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,UAAU,CAAC,CAc7D;
|
|
1
|
+
{"version":3,"file":"generateChallenge.d.ts","sourceRoot":"","sources":["../../src/helpers/generateChallenge.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,UAAU,CAAC,CAc7D;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B;sBACpB,UAAU;CAC7B,CAAC"}
|
|
@@ -19,7 +19,10 @@ async function generateChallenge() {
|
|
|
19
19
|
await index_js_1.isoCrypto.getRandomValues(challenge);
|
|
20
20
|
return exports._generateChallengeInternals.stubThis(challenge);
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Make it possible to stub the return value during testing
|
|
24
|
+
* @ignore Don't include this in docs output
|
|
25
|
+
*/
|
|
23
26
|
exports._generateChallengeInternals = {
|
|
24
27
|
stubThis: (value) => value,
|
|
25
28
|
};
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* Generate a suitably random value to be used as user ID
|
|
3
3
|
*/
|
|
4
4
|
export declare function generateUserID(): Promise<Uint8Array>;
|
|
5
|
+
/**
|
|
6
|
+
* Make it possible to stub the return value during testing
|
|
7
|
+
* @ignore Don't include this in docs output
|
|
8
|
+
*/
|
|
5
9
|
export declare const _generateUserIDInternals: {
|
|
6
10
|
stubThis: (value: Uint8Array) => Uint8Array;
|
|
7
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateUserID.d.ts","sourceRoot":"","sources":["../../src/helpers/generateUserID.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,UAAU,CAAC,CAU1D;
|
|
1
|
+
{"version":3,"file":"generateUserID.d.ts","sourceRoot":"","sources":["../../src/helpers/generateUserID.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,UAAU,CAAC,CAU1D;AAED;;;GAGG;AACH,eAAO,MAAM,wBAAwB;sBACjB,UAAU;CAC7B,CAAC"}
|