@simplewebauthn/server 13.3.2 → 14.0.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/README.md +8 -4
- package/esm/authentication/generateAuthenticationOptions.d.ts +2 -2
- package/esm/authentication/generateAuthenticationOptions.d.ts.map +1 -1
- package/esm/authentication/verifyAuthenticationResponse.d.ts +1 -0
- package/esm/authentication/verifyAuthenticationResponse.d.ts.map +1 -1
- package/esm/authentication/verifyAuthenticationResponse.js +40 -2
- package/esm/helpers/cose.d.ts +18 -2
- package/esm/helpers/cose.d.ts.map +1 -1
- package/esm/helpers/cose.js +12 -0
- package/esm/helpers/decodeClientDataJSON.d.ts +1 -0
- package/esm/helpers/decodeClientDataJSON.d.ts.map +1 -1
- package/esm/helpers/index.d.ts +2 -0
- package/esm/helpers/index.d.ts.map +1 -1
- package/esm/helpers/index.js +2 -0
- package/esm/helpers/iso/isoCrypto/digest.js +2 -2
- package/esm/helpers/iso/isoCrypto/getWebCrypto.d.ts.map +1 -1
- package/esm/helpers/iso/isoCrypto/getWebCrypto.js +12 -0
- package/esm/helpers/iso/isoCrypto/importJWKKey.d.ts +9 -0
- package/esm/helpers/iso/isoCrypto/importJWKKey.d.ts.map +1 -0
- package/esm/helpers/iso/isoCrypto/{importKey.js → importJWKKey.js} +6 -4
- package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoHashAlgName.d.ts +10 -0
- package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoHashAlgName.d.ts.map +1 -0
- package/esm/helpers/iso/isoCrypto/{mapCoseAlgToWebCryptoAlg.js → mapCoseAlgToWebCryptoHashAlgName.js} +6 -3
- package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts +4 -1
- package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts.map +1 -1
- package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.js +15 -0
- package/esm/helpers/iso/isoCrypto/runtimeSupportsWebCryptoKeyAlg.d.ts +7 -0
- package/esm/helpers/iso/isoCrypto/runtimeSupportsWebCryptoKeyAlg.d.ts.map +1 -0
- package/esm/helpers/iso/isoCrypto/runtimeSupportsWebCryptoKeyAlg.js +16 -0
- package/esm/helpers/iso/isoCrypto/structs.d.ts +1 -1
- package/esm/helpers/iso/isoCrypto/structs.d.ts.map +1 -1
- package/esm/helpers/iso/isoCrypto/verify.d.ts.map +1 -1
- package/esm/helpers/iso/isoCrypto/verify.js +5 -1
- package/esm/helpers/iso/isoCrypto/verifyAKP.d.ts +9 -0
- package/esm/helpers/iso/isoCrypto/verifyAKP.d.ts.map +1 -0
- package/esm/helpers/iso/isoCrypto/verifyAKP.js +47 -0
- package/esm/helpers/iso/isoCrypto/verifyEC2.d.ts.map +1 -1
- package/esm/helpers/iso/isoCrypto/verifyEC2.js +5 -8
- package/esm/helpers/iso/isoCrypto/verifyOKP.d.ts.map +1 -1
- package/esm/helpers/iso/isoCrypto/verifyOKP.js +2 -5
- package/esm/helpers/iso/isoCrypto/verifyRSA.d.ts.map +1 -1
- package/esm/helpers/iso/isoCrypto/verifyRSA.js +5 -8
- package/esm/helpers/logging.d.ts +28 -10
- package/esm/helpers/logging.d.ts.map +1 -1
- package/esm/helpers/logging.js +27 -16
- package/esm/helpers/mapJWSAlgToCOSEAlg.d.ts +8 -0
- package/esm/helpers/mapJWSAlgToCOSEAlg.d.ts.map +1 -0
- package/esm/helpers/mapJWSAlgToCOSEAlg.js +31 -0
- package/esm/helpers/validateCertificatePath.d.ts.map +1 -1
- package/esm/helpers/validateCertificatePath.js +25 -7
- package/esm/metadata/verifyJWT.d.ts.map +1 -1
- package/esm/metadata/verifyJWT.js +7 -2
- package/esm/registration/generateRegistrationOptions.d.ts +10 -8
- package/esm/registration/generateRegistrationOptions.d.ts.map +1 -1
- package/esm/registration/generateRegistrationOptions.js +11 -29
- package/esm/registration/verifications/tpm/constants.d.ts +1 -2
- package/esm/registration/verifications/tpm/constants.d.ts.map +1 -1
- package/esm/registration/verifications/tpm/constants.js +1 -2
- package/esm/registration/verifications/tpm/isValidTPMManufacturerID.d.ts +3 -0
- package/esm/registration/verifications/tpm/isValidTPMManufacturerID.d.ts.map +1 -0
- package/esm/registration/verifications/tpm/isValidTPMManufacturerID.js +6 -0
- package/esm/registration/verifications/tpm/verifyAttestationTPM.d.ts.map +1 -1
- package/esm/registration/verifications/tpm/verifyAttestationTPM.js +3 -2
- package/esm/registration/verifyRegistrationResponse.d.ts +3 -3
- package/esm/registration/verifyRegistrationResponse.d.ts.map +1 -1
- package/esm/registration/verifyRegistrationResponse.js +3 -3
- package/esm/services/defaultRootCerts/mds.d.ts +11 -0
- package/esm/services/defaultRootCerts/mds.d.ts.map +1 -1
- package/esm/services/defaultRootCerts/mds.js +42 -0
- package/esm/services/metadataService.d.ts +4 -0
- package/esm/services/metadataService.d.ts.map +1 -1
- package/esm/services/metadataService.js +16 -10
- package/esm/services/settingsService.d.ts +4 -0
- package/esm/services/settingsService.d.ts.map +1 -1
- package/esm/services/settingsService.js +17 -2
- package/esm/types/dom.d.ts +236 -3
- package/esm/types/dom.d.ts.map +1 -1
- package/esm/types/index.d.ts +158 -44
- package/esm/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/authentication/generateAuthenticationOptions.d.ts +2 -2
- package/script/authentication/generateAuthenticationOptions.d.ts.map +1 -1
- package/script/authentication/verifyAuthenticationResponse.d.ts +1 -0
- package/script/authentication/verifyAuthenticationResponse.d.ts.map +1 -1
- package/script/authentication/verifyAuthenticationResponse.js +40 -2
- package/script/helpers/cose.d.ts +18 -2
- package/script/helpers/cose.d.ts.map +1 -1
- package/script/helpers/cose.js +13 -0
- package/script/helpers/decodeClientDataJSON.d.ts +1 -0
- package/script/helpers/decodeClientDataJSON.d.ts.map +1 -1
- package/script/helpers/index.d.ts +2 -0
- package/script/helpers/index.d.ts.map +1 -1
- package/script/helpers/index.js +4 -1
- package/script/helpers/iso/isoCrypto/digest.js +2 -2
- package/script/helpers/iso/isoCrypto/getWebCrypto.d.ts.map +1 -1
- package/script/helpers/iso/isoCrypto/getWebCrypto.js +12 -0
- package/script/helpers/iso/isoCrypto/importJWKKey.d.ts +9 -0
- package/script/helpers/iso/isoCrypto/importJWKKey.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/{importKey.js → importJWKKey.js} +7 -5
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoHashAlgName.d.ts +10 -0
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoHashAlgName.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/{mapCoseAlgToWebCryptoAlg.js → mapCoseAlgToWebCryptoHashAlgName.js} +7 -4
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts +4 -1
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts.map +1 -1
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.js +15 -0
- package/script/helpers/iso/isoCrypto/runtimeSupportsWebCryptoKeyAlg.d.ts +7 -0
- package/script/helpers/iso/isoCrypto/runtimeSupportsWebCryptoKeyAlg.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/runtimeSupportsWebCryptoKeyAlg.js +19 -0
- package/script/helpers/iso/isoCrypto/structs.d.ts +1 -1
- package/script/helpers/iso/isoCrypto/structs.d.ts.map +1 -1
- package/script/helpers/iso/isoCrypto/verify.d.ts.map +1 -1
- package/script/helpers/iso/isoCrypto/verify.js +4 -0
- package/script/helpers/iso/isoCrypto/verifyAKP.d.ts +9 -0
- package/script/helpers/iso/isoCrypto/verifyAKP.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/verifyAKP.js +50 -0
- package/script/helpers/iso/isoCrypto/verifyEC2.d.ts.map +1 -1
- package/script/helpers/iso/isoCrypto/verifyEC2.js +5 -8
- package/script/helpers/iso/isoCrypto/verifyOKP.d.ts.map +1 -1
- package/script/helpers/iso/isoCrypto/verifyOKP.js +2 -5
- package/script/helpers/iso/isoCrypto/verifyRSA.d.ts.map +1 -1
- package/script/helpers/iso/isoCrypto/verifyRSA.js +5 -8
- package/script/helpers/logging.d.ts +28 -10
- package/script/helpers/logging.d.ts.map +1 -1
- package/script/helpers/logging.js +29 -17
- package/script/helpers/mapJWSAlgToCOSEAlg.d.ts +8 -0
- package/script/helpers/mapJWSAlgToCOSEAlg.d.ts.map +1 -0
- package/script/helpers/mapJWSAlgToCOSEAlg.js +34 -0
- package/script/helpers/validateCertificatePath.d.ts.map +1 -1
- package/script/helpers/validateCertificatePath.js +25 -7
- package/script/metadata/verifyJWT.d.ts.map +1 -1
- package/script/metadata/verifyJWT.js +6 -1
- package/script/registration/generateRegistrationOptions.d.ts +10 -8
- package/script/registration/generateRegistrationOptions.d.ts.map +1 -1
- package/script/registration/generateRegistrationOptions.js +13 -31
- package/script/registration/verifications/tpm/constants.d.ts +1 -2
- package/script/registration/verifications/tpm/constants.d.ts.map +1 -1
- package/script/registration/verifications/tpm/constants.js +1 -2
- package/script/registration/verifications/tpm/isValidTPMManufacturerID.d.ts +3 -0
- package/script/registration/verifications/tpm/isValidTPMManufacturerID.d.ts.map +1 -0
- package/script/registration/verifications/tpm/isValidTPMManufacturerID.js +9 -0
- package/script/registration/verifications/tpm/verifyAttestationTPM.d.ts.map +1 -1
- package/script/registration/verifications/tpm/verifyAttestationTPM.js +2 -1
- package/script/registration/verifyRegistrationResponse.d.ts +3 -3
- package/script/registration/verifyRegistrationResponse.d.ts.map +1 -1
- package/script/registration/verifyRegistrationResponse.js +2 -2
- package/script/services/defaultRootCerts/mds.d.ts +11 -0
- package/script/services/defaultRootCerts/mds.d.ts.map +1 -1
- package/script/services/defaultRootCerts/mds.js +43 -1
- package/script/services/metadataService.d.ts +4 -0
- package/script/services/metadataService.d.ts.map +1 -1
- package/script/services/metadataService.js +15 -9
- package/script/services/settingsService.d.ts +4 -0
- package/script/services/settingsService.d.ts.map +1 -1
- package/script/services/settingsService.js +16 -1
- package/script/types/dom.d.ts +236 -3
- package/script/types/dom.d.ts.map +1 -1
- package/script/types/index.d.ts +158 -44
- package/script/types/index.d.ts.map +1 -1
- package/esm/helpers/iso/isoCrypto/importKey.d.ts +0 -5
- package/esm/helpers/iso/isoCrypto/importKey.d.ts.map +0 -1
- package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts +0 -7
- package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts.map +0 -1
- package/script/helpers/iso/isoCrypto/importKey.d.ts +0 -5
- package/script/helpers/iso/isoCrypto/importKey.d.ts.map +0 -1
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts +0 -7
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts.map +0 -1
package/esm/types/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* deno task codegen:types
|
|
8
8
|
*/
|
|
9
|
-
import type { AttestationConveyancePreference, AuthenticationExtensionsClientInputs, AuthenticationExtensionsClientOutputs, AuthenticatorAssertionResponse, AuthenticatorAttachment, AuthenticatorAttestationResponse, AuthenticatorSelectionCriteria, COSEAlgorithmIdentifier, PublicKeyCredential, PublicKeyCredentialCreationOptions,
|
|
10
|
-
export type { AttestationConveyancePreference, AuthenticationExtensionsClientInputs, AuthenticationExtensionsClientOutputs, AuthenticatorAssertionResponse, AuthenticatorAttachment, AuthenticatorAttestationResponse, AuthenticatorSelectionCriteria, AuthenticatorTransport, COSEAlgorithmIdentifier, Crypto, PublicKeyCredential, PublicKeyCredentialCreationOptions, PublicKeyCredentialDescriptor, PublicKeyCredentialParameters, PublicKeyCredentialRequestOptions, PublicKeyCredentialRpEntity, PublicKeyCredentialType, PublicKeyCredentialUserEntity, ResidentKeyRequirement, UserVerificationRequirement, } from './dom.js';
|
|
9
|
+
import type { AlgorithmIdentifier, AttestationConveyancePreference, AuthenticationExtensionsClientInputs, AuthenticationExtensionsClientOutputs, AuthenticatorAssertionResponse, AuthenticatorAttachment, AuthenticatorAttestationResponse, AuthenticatorSelectionCriteria, Base64URLString, COSEAlgorithmIdentifier, KeyUsage, PublicKeyCredential, PublicKeyCredentialCreationOptions, PublicKeyCredentialDescriptorJSON, PublicKeyCredentialParameters, PublicKeyCredentialRequestOptions, PublicKeyCredentialRpEntity, PublicKeyCredentialType, SubtleCrypto, UserVerificationRequirement } from './dom.js';
|
|
10
|
+
export type { AlgorithmIdentifier, AttestationConveyancePreference, AuthenticationExtensionsClientInputs, AuthenticationExtensionsClientOutputs, AuthenticatorAssertionResponse, AuthenticatorAttachment, AuthenticatorAttestationResponse, AuthenticatorSelectionCriteria, AuthenticatorTransport, Base64URLString, COSEAlgorithmIdentifier, CredentialCreationOptions, CredentialRequestOptions, Crypto, PublicKeyCredential, PublicKeyCredentialCreationOptions, PublicKeyCredentialDescriptor, PublicKeyCredentialDescriptorJSON, PublicKeyCredentialParameters, PublicKeyCredentialRequestOptions, PublicKeyCredentialRpEntity, PublicKeyCredentialType, PublicKeyCredentialUserEntity, ResidentKeyRequirement, UserVerificationRequirement, } from './dom.js';
|
|
11
11
|
/**
|
|
12
12
|
* A variant of PublicKeyCredentialCreationOptions suitable for JSON transmission to the browser to
|
|
13
13
|
* (eventually) get passed into navigator.credentials.create(...) in the browser.
|
|
@@ -43,14 +43,6 @@ export interface PublicKeyCredentialRequestOptionsJSON {
|
|
|
43
43
|
hints?: PublicKeyCredentialHint[];
|
|
44
44
|
extensions?: AuthenticationExtensionsClientInputs;
|
|
45
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
46
|
/**
|
|
55
47
|
* https://w3c.github.io/webauthn/#dictdef-publickeycredentialuserentityjson
|
|
56
48
|
*/
|
|
@@ -63,7 +55,7 @@ export interface PublicKeyCredentialUserEntityJSON {
|
|
|
63
55
|
* The value returned from navigator.credentials.create()
|
|
64
56
|
*/
|
|
65
57
|
export interface RegistrationCredential extends PublicKeyCredentialFuture {
|
|
66
|
-
response:
|
|
58
|
+
response: AuthenticatorAttestationResponse;
|
|
67
59
|
}
|
|
68
60
|
/**
|
|
69
61
|
* A slightly-modified RegistrationCredential to simplify working with ArrayBuffers that
|
|
@@ -109,7 +101,7 @@ export interface AuthenticatorAttestationResponseJSON {
|
|
|
109
101
|
clientDataJSON: Base64URLString;
|
|
110
102
|
attestationObject: Base64URLString;
|
|
111
103
|
authenticatorData?: Base64URLString;
|
|
112
|
-
transports?:
|
|
104
|
+
transports?: string[];
|
|
113
105
|
publicKeyAlgorithm?: COSEAlgorithmIdentifier;
|
|
114
106
|
publicKey?: Base64URLString;
|
|
115
107
|
}
|
|
@@ -132,38 +124,8 @@ export type WebAuthnCredential = {
|
|
|
132
124
|
id: Base64URLString;
|
|
133
125
|
publicKey: Uint8Array_;
|
|
134
126
|
counter: number;
|
|
135
|
-
transports?:
|
|
127
|
+
transports?: string[];
|
|
136
128
|
};
|
|
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
129
|
/** */
|
|
168
130
|
export type PublicKeyCredentialJSON = RegistrationResponseJSON | AuthenticationResponseJSON;
|
|
169
131
|
/**
|
|
@@ -174,7 +136,11 @@ export interface PublicKeyCredentialFuture extends PublicKeyCredential {
|
|
|
174
136
|
isConditionalMediationAvailable?(): Promise<boolean>;
|
|
175
137
|
parseCreationOptionsFromJSON?(options: PublicKeyCredentialCreationOptionsJSON): PublicKeyCredentialCreationOptions;
|
|
176
138
|
parseRequestOptionsFromJSON?(options: PublicKeyCredentialRequestOptionsJSON): PublicKeyCredentialRequestOptions;
|
|
177
|
-
toJSON
|
|
139
|
+
toJSON(): PublicKeyCredentialJSON;
|
|
140
|
+
getClientCapabilities?(): Promise<PublicKeyCredentialClientCapabilities>;
|
|
141
|
+
signalUnknownCredential(options: UnknownCredentialOptions): Promise<undefined>;
|
|
142
|
+
signalAllAcceptedCredentials(options: AllAcceptedCredentialsOptions): Promise<undefined>;
|
|
143
|
+
signalCurrentUserDetails(options: CurrentUserDetailsOptions): Promise<undefined>;
|
|
178
144
|
}
|
|
179
145
|
/**
|
|
180
146
|
* The two types of credentials as defined by bit 3 ("Backup Eligibility") in authenticator data:
|
|
@@ -202,6 +168,27 @@ export type PublicKeyCredentialHint = 'hybrid' | 'security-key' | 'client-device
|
|
|
202
168
|
* See https://www.iana.org/assignments/webauthn/webauthn.xhtml#webauthn-attestation-statement-format-ids
|
|
203
169
|
*/
|
|
204
170
|
export type AttestationFormat = 'fido-u2f' | 'packed' | 'android-safetynet' | 'android-key' | 'tpm' | 'apple' | 'none';
|
|
171
|
+
/**
|
|
172
|
+
* More specific values available from `PublicKeyCredential.getClientCapabilities()`.
|
|
173
|
+
*
|
|
174
|
+
* A capability with an `undefined` value does not mean the feature is unsupported. It may
|
|
175
|
+
* simply be that the browser has chosen not to divulge its support for the capability as a more
|
|
176
|
+
* specific determination may be factored into e.g. ad-tech's browser fingerprinting that violates
|
|
177
|
+
* user privacy against the goals of the browser.
|
|
178
|
+
*
|
|
179
|
+
* See https://w3c.github.io/webauthn/#typedefdef-publickeycredentialclientcapabilities
|
|
180
|
+
*/
|
|
181
|
+
export type PublicKeyCredentialClientCapabilities = {
|
|
182
|
+
conditionalCreate?: boolean;
|
|
183
|
+
conditionalGet?: boolean;
|
|
184
|
+
hybridTransport?: boolean;
|
|
185
|
+
passkeyPlatformAuthenticator?: boolean;
|
|
186
|
+
userVerifyingPlatformAuthenticator?: boolean;
|
|
187
|
+
relatedOrigins?: boolean;
|
|
188
|
+
signalAllAcceptedCredentials?: boolean;
|
|
189
|
+
signalCurrentUserDetails?: boolean;
|
|
190
|
+
signalUnknownCredential?: boolean;
|
|
191
|
+
};
|
|
205
192
|
/**
|
|
206
193
|
* Equivalent to `Uint8Array` before TypeScript 5.7, and `Uint8Array<ArrayBuffer>` in TypeScript 5.7
|
|
207
194
|
* and beyond.
|
|
@@ -217,4 +204,131 @@ export type AttestationFormat = 'fido-u2f' | 'packed' | 'android-safetynet' | 'a
|
|
|
217
204
|
* https://github.com/denoland/std/blob/b5a5fe4f96b91c1fe8dba5cc0270092dd11d3287/bytes/_types.ts#L11
|
|
218
205
|
*/
|
|
219
206
|
export type Uint8Array_ = ReturnType<Uint8Array['slice']>;
|
|
207
|
+
/**
|
|
208
|
+
* Options for `PublicKeyCredential.signalUnknownCredential()`. This signal communicates that the
|
|
209
|
+
* credential that the user just tried to register, or to authenticate with, was not one that the
|
|
210
|
+
* Relying Party recognizes. The authenticator responsible for the credential can hide or delete
|
|
211
|
+
* the credential so that the user does not see it in the future as an option to sign in with.
|
|
212
|
+
*
|
|
213
|
+
* It is a good idea for a Relying Party to send this signal immediately after the use of an
|
|
214
|
+
* unrecognized credential. For example, after rejecting the output from `startRegistration()` due
|
|
215
|
+
* to unsatisfied RP-specific authenticator registration policy; or after rejecting the output from
|
|
216
|
+
* `startAuthentication()` because the user deleted the passkey from their RP-specific user
|
|
217
|
+
* settings.
|
|
218
|
+
*
|
|
219
|
+
* See https://w3c.github.io/webauthn/#sctn-signalUnknownCredential for more info.
|
|
220
|
+
*/
|
|
221
|
+
type UnknownCredentialOptions = {
|
|
222
|
+
rpId: string;
|
|
223
|
+
credentialId: Base64URLString;
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Options for `PublicKeyCredential.signalAllAcceptedCredentials()`. This signal communicates the
|
|
227
|
+
* current list of passkeys the Relying Party will recognize for use by the **authenticated** user
|
|
228
|
+
* on the next login. Authenticators that have a passkey for (rpId + userId), but the passkey ID is
|
|
229
|
+
* not found in allAcceptedCredentialIds, may choose to hide or delete the passkey because it will
|
|
230
|
+
* not be accepted for use by the Relying Party.
|
|
231
|
+
*
|
|
232
|
+
* It is a good idea for a Relying Party to periodically send this signal, for example after every
|
|
233
|
+
* successful authentication.
|
|
234
|
+
*
|
|
235
|
+
* See https://w3c.github.io/webauthn/#sctn-signalAllAcceptedCredentials for more info.
|
|
236
|
+
*/
|
|
237
|
+
type AllAcceptedCredentialsOptions = {
|
|
238
|
+
rpId: string;
|
|
239
|
+
userId: Base64URLString;
|
|
240
|
+
allAcceptedCredentialIds: Base64URLString[];
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* Options for `PublicKeyCredential.signalCurrentUserDetails()`. This signal that communicates a
|
|
244
|
+
* change in the **authenticated** user's name and/or display name. This can help browsers and
|
|
245
|
+
* platforms display the most up-to-date information about the user during a passkey authentication
|
|
246
|
+
* instead of always showing whatever value was set at the time of registration.
|
|
247
|
+
*
|
|
248
|
+
* It is a good idea for a Relying Party to periodically send this signal, for example after every
|
|
249
|
+
* successful authentication and immediately after the user name and/or display name is changed.
|
|
250
|
+
*
|
|
251
|
+
* See https://w3c.github.io/webauthn/#sctn-signalCurrentUserDetails for more info.
|
|
252
|
+
*/
|
|
253
|
+
type CurrentUserDetailsOptions = {
|
|
254
|
+
rpId: string;
|
|
255
|
+
userId: Base64URLString;
|
|
256
|
+
name: string;
|
|
257
|
+
displayName: string;
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* Below are types for @simplewebauthn/browser's `sendSignal()` method. Shared out of here so that an RP
|
|
261
|
+
* might use these same types in @simplewebauthn/server to type an API return value that can be
|
|
262
|
+
* passed into `sendSignal()`
|
|
263
|
+
*/
|
|
264
|
+
/**
|
|
265
|
+
* A signal that communicates that the credential that the user just tried to register, or to
|
|
266
|
+
* authenticate with, was not one that the Relying Party recognizes. The authenticator responsible
|
|
267
|
+
* for the credential can hide or delete the credential so that the user does not see it in the
|
|
268
|
+
* future as an option to sign in with.
|
|
269
|
+
*
|
|
270
|
+
* It is a good idea for a Relying Party to send this signal immediately after the use of an
|
|
271
|
+
* unrecognized credential. For example, after rejecting the output from `startRegistration()` due
|
|
272
|
+
* to unsatisfied RP-specific authenticator registration policy; or after rejecting the output from
|
|
273
|
+
* `startAuthentication()` because the user deleted the passkey from their RP-specific user
|
|
274
|
+
* settings.
|
|
275
|
+
*
|
|
276
|
+
* See https://w3c.github.io/webauthn/#sctn-signalUnknownCredential for more info.
|
|
277
|
+
*/
|
|
278
|
+
export type SendSignalUnknownCredentialOpts = {
|
|
279
|
+
signalName: 'unknownCredential';
|
|
280
|
+
/** The same value used for `rpID` when calling \@simplewebauthn/server's `generateRegistrationOptions()` */
|
|
281
|
+
rpID: string;
|
|
282
|
+
/** The credential ID that the Relying Party didn't recognize for use */
|
|
283
|
+
credentialID: Base64URLString;
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* A signal that communicates the current list of passkeys the Relying Party will recognize for use
|
|
287
|
+
* by the **authenticated** user on the next login. Authenticators that have a passkey for
|
|
288
|
+
* (rpId + userId), but the passkey ID is not found in allAcceptedCredentialIds, may choose to hide
|
|
289
|
+
* or delete the passkey because it will not be accepted for use by the Relying Party.
|
|
290
|
+
*
|
|
291
|
+
* It is a good idea for a Relying Party to periodically send this signal, for example after every
|
|
292
|
+
* successful authentication.
|
|
293
|
+
*
|
|
294
|
+
* See https://w3c.github.io/webauthn/#sctn-signalAllAcceptedCredentials for more info.
|
|
295
|
+
*/
|
|
296
|
+
export type SendSignalAllAcceptedCredentialsOpts = {
|
|
297
|
+
signalName: 'allAcceptedCredentials';
|
|
298
|
+
/** The same value used for `rpID` when calling \@simplewebauthn/server's `generateRegistrationOptions()` */
|
|
299
|
+
rpID: string;
|
|
300
|
+
/** The base64url-encoded value used for `userID` when calling \@simplewebauthn/server's `generateRegistrationOptions()` */
|
|
301
|
+
userID: Base64URLString;
|
|
302
|
+
/** An array of base64url-encoded credential IDs for all credentials the user may use to authenticate */
|
|
303
|
+
allAcceptedCredentialIDs: Base64URLString[];
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* A signal that communicates a change in the **authenticated** user's name and/or display name.
|
|
307
|
+
* This can help browsers and platforms display the most up-to-date information about the user
|
|
308
|
+
* during a passkey authentication instead of always showing whatever value was set at the time of
|
|
309
|
+
* registration.
|
|
310
|
+
*
|
|
311
|
+
* It is a good idea for a Relying Party to periodically send this signal, for example after every
|
|
312
|
+
* successful authentication and immediately after the user name and/or display name is changed.
|
|
313
|
+
*
|
|
314
|
+
* See https://w3c.github.io/webauthn/#sctn-signalCurrentUserDetails for more info.
|
|
315
|
+
*/
|
|
316
|
+
export type SendSignalCurrentUserDetailsOpts = {
|
|
317
|
+
signalName: 'currentUserDetails';
|
|
318
|
+
/** The same value used for `rpID` when calling \@simplewebauthn/server's `generateRegistrationOptions()` */
|
|
319
|
+
rpID: string;
|
|
320
|
+
/** The base64url-encoded value used for `userID` when calling \@simplewebauthn/server's `generateRegistrationOptions()` */
|
|
321
|
+
userID: Base64URLString;
|
|
322
|
+
/** The primary account name, like an email address, username, etc... */
|
|
323
|
+
userName: string;
|
|
324
|
+
/** An optional, longer user identifier, like a full name, account differentiator, etc... Defaults to `""` */
|
|
325
|
+
userDisplayName?: string;
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* A super class of TypeScript's `SubtleCrypto` that knows about upcoming features
|
|
329
|
+
*/
|
|
330
|
+
export interface SubtleCryptoFuture extends SubtleCrypto {
|
|
331
|
+
/** https://wicg.github.io/webcrypto-modern-algos/#SubtleCrypto-method-supports */
|
|
332
|
+
supports(operation: KeyUsage, algorithm: AlgorithmIdentifier, length?: number): boolean;
|
|
333
|
+
}
|
|
220
334
|
//# sourceMappingURL=index.d.ts.map
|
package/esm/types/index.d.ts.map
CHANGED
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;A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,MAAM,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,UAAU,EAAE,mBAAmB,CAAC;IAChC,4GAA4G;IAC5G,IAAI,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,YAAY,EAAE,eAAe,CAAC;CAC/B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,UAAU,EAAE,wBAAwB,CAAC;IACrC,4GAA4G;IAC5G,IAAI,EAAE,MAAM,CAAC;IACb,2HAA2H;IAC3H,MAAM,EAAE,eAAe,CAAC;IACxB,wGAAwG;IACxG,wBAAwB,EAAE,eAAe,EAAE,CAAC;CAC7C,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAC7C,UAAU,EAAE,oBAAoB,CAAC;IACjC,4GAA4G;IAC5G,IAAI,EAAE,MAAM,CAAC;IACb,2HAA2H;IAC3H,MAAM,EAAE,eAAe,CAAC;IACxB,wEAAwE;IACxE,QAAQ,EAAE,MAAM,CAAC;IACjB,6GAA6G;IAC7G,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,kFAAkF;IAClF,QAAQ,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACzF"}
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuthenticationExtensionsClientInputs,
|
|
1
|
+
import type { AuthenticationExtensionsClientInputs, Base64URLString, PublicKeyCredentialRequestOptionsJSON, Uint8Array_ } from '../types/index.js';
|
|
2
2
|
export type GenerateAuthenticationOptionsOpts = Parameters<typeof generateAuthenticationOptions>[0];
|
|
3
3
|
/**
|
|
4
4
|
* Prepare a value to pass into navigator.credentials.get(...) for authenticator authentication
|
|
@@ -16,7 +16,7 @@ export declare function generateAuthenticationOptions(options: {
|
|
|
16
16
|
rpID: string;
|
|
17
17
|
allowCredentials?: {
|
|
18
18
|
id: Base64URLString;
|
|
19
|
-
transports?:
|
|
19
|
+
transports?: string[];
|
|
20
20
|
}[];
|
|
21
21
|
challenge?: string | Uint8Array_;
|
|
22
22
|
timeout?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateAuthenticationOptions.d.ts","sourceRoot":"","sources":["../../src/authentication/generateAuthenticationOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,
|
|
1
|
+
{"version":3,"file":"generateAuthenticationOptions.d.ts","sourceRoot":"","sources":["../../src/authentication/generateAuthenticationOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,eAAe,EACf,qCAAqC,EACrC,WAAW,EACZ,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,MAAM,EAAE,CAAC;KACvB,EAAE,CAAC;IACJ,SAAS,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IACjC,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"}
|
|
@@ -26,6 +26,7 @@ export declare function verifyAuthenticationResponse(options: {
|
|
|
26
26
|
expectedRPID: string | string[];
|
|
27
27
|
credential: WebAuthnCredential;
|
|
28
28
|
expectedType?: string | string[];
|
|
29
|
+
expectedTopOrigin?: string | string[];
|
|
29
30
|
requireUserVerification?: boolean;
|
|
30
31
|
advancedFIDOConfig?: {
|
|
31
32
|
userVerification?: UserVerificationRequirement;
|
|
@@ -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,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,
|
|
1
|
+
{"version":3,"file":"verifyAuthenticationResponse.d.ts","sourceRoot":"","sources":["../../src/authentication/verifyAuthenticationResponse.ts"],"names":[],"mapp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CAAC;QACb,6BAA6B,CAAC,EAAE,4CAA4C,CAAC;KAC9E,CAAC;CACH,CAAC"}
|
|
@@ -24,7 +24,7 @@ const index_js_1 = require("../helpers/iso/index.js");
|
|
|
24
24
|
* @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"`
|
|
25
25
|
*/
|
|
26
26
|
async function verifyAuthenticationResponse(options) {
|
|
27
|
-
const { response, expectedChallenge, expectedOrigin, expectedRPID, expectedType, credential, requireUserVerification = true, advancedFIDOConfig, } = options;
|
|
27
|
+
const { response, expectedChallenge, expectedOrigin, expectedRPID, expectedType, expectedTopOrigin, credential, requireUserVerification = true, advancedFIDOConfig, } = options;
|
|
28
28
|
const { id, rawId, type: credentialType, response: assertionResponse } = response;
|
|
29
29
|
// Ensure credential specified an ID
|
|
30
30
|
if (!id) {
|
|
@@ -45,7 +45,7 @@ async function verifyAuthenticationResponse(options) {
|
|
|
45
45
|
throw new Error('Credential response clientDataJSON was not a string');
|
|
46
46
|
}
|
|
47
47
|
const clientDataJSON = (0, decodeClientDataJSON_js_1.decodeClientDataJSON)(assertionResponse.clientDataJSON);
|
|
48
|
-
const { type, origin, challenge, tokenBinding } = clientDataJSON;
|
|
48
|
+
const { type, origin, challenge, tokenBinding, crossOrigin, topOrigin } = clientDataJSON;
|
|
49
49
|
// Make sure we're handling an authentication
|
|
50
50
|
if (Array.isArray(expectedType)) {
|
|
51
51
|
if (!expectedType.includes(type)) {
|
|
@@ -70,6 +70,44 @@ async function verifyAuthenticationResponse(options) {
|
|
|
70
70
|
else if (challenge !== expectedChallenge) {
|
|
71
71
|
throw new Error(`Unexpected authentication response challenge "${challenge}", expected "${expectedChallenge}"`);
|
|
72
72
|
}
|
|
73
|
+
// Check that the authentication response is within an expected iframe
|
|
74
|
+
if (crossOrigin) {
|
|
75
|
+
/**
|
|
76
|
+
* TODO: Since Safari doesn't support `topOrigin` as of May 2026, only check this when
|
|
77
|
+
* `topOrigin` is available for now.
|
|
78
|
+
*/
|
|
79
|
+
if (topOrigin) {
|
|
80
|
+
if (!expectedTopOrigin) {
|
|
81
|
+
/**
|
|
82
|
+
* If `expectedTopOrigin` is not set, this should be considered an unexpected cross-origin
|
|
83
|
+
* request. Reject the response while helping the RP understand how they need to update this
|
|
84
|
+
* method call if they want to support verification of such WebAuthn authentication requests.
|
|
85
|
+
*/
|
|
86
|
+
throw new Error(`Detected cross-origin authentication response from top origin of "${topOrigin}", but a value for \`expectedTopOrigin\` was not specified when calling \`verifyAuthenticationResponse()\``);
|
|
87
|
+
}
|
|
88
|
+
if (Array.isArray(expectedTopOrigin)) {
|
|
89
|
+
if (!expectedTopOrigin.includes(topOrigin)) {
|
|
90
|
+
const joinedExpectedTopOrigin = expectedTopOrigin.join(', ');
|
|
91
|
+
throw new Error(`Unexpected cross-origin authentication response top origin of "${topOrigin}", expected one of: ${joinedExpectedTopOrigin}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
if (topOrigin !== expectedTopOrigin) {
|
|
96
|
+
throw new Error(`Unexpected cross-origin authentication response top origin of "${topOrigin}", expected: ${expectedTopOrigin}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
if (topOrigin) {
|
|
103
|
+
/**
|
|
104
|
+
* If `topOrigin` is set despite `crossOrigin` being false, this is an unexpected request.
|
|
105
|
+
*
|
|
106
|
+
* See https://w3c.github.io/webauthn/#dom-collectedclientdata-toporigin.
|
|
107
|
+
*/
|
|
108
|
+
throw new Error(`Unexpected top origin of "${topOrigin}" within a non-cross-origin authentication response. This error should be reported to the browser vendor as a WebAuthn specification violation with a link to https://w3c.github.io/webauthn/#dom-collectedclientdata-toporigin`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
73
111
|
// Check that the origin is our site
|
|
74
112
|
if (Array.isArray(expectedOrigin)) {
|
|
75
113
|
if (!expectedOrigin.includes(origin)) {
|
package/script/helpers/cose.d.ts
CHANGED
|
@@ -48,6 +48,13 @@ export type COSEPublicKeyRSA = COSEPublicKey & {
|
|
|
48
48
|
set(key: COSEKEYS.n, value: Uint8Array_): void;
|
|
49
49
|
set(key: COSEKEYS.e, value: Uint8Array_): void;
|
|
50
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* Values specific for AKP (ML-DSA) public keys
|
|
53
|
+
*/
|
|
54
|
+
export type COSEPublicKeyAKP = COSEPublicKey & {
|
|
55
|
+
get(key: COSEKEYS.pub): Uint8Array_ | undefined;
|
|
56
|
+
set(key: COSEKEYS.pub, value: Uint8Array_): void;
|
|
57
|
+
};
|
|
51
58
|
/**
|
|
52
59
|
* A type guard for determining if a COSE public key is an OKP key pair
|
|
53
60
|
*/
|
|
@@ -60,6 +67,10 @@ export declare function isCOSEPublicKeyEC2(cosePublicKey: COSEPublicKey): cosePu
|
|
|
60
67
|
* A type guard for determining if a COSE public key is an RSA key pair
|
|
61
68
|
*/
|
|
62
69
|
export declare function isCOSEPublicKeyRSA(cosePublicKey: COSEPublicKey): cosePublicKey is COSEPublicKeyRSA;
|
|
70
|
+
/**
|
|
71
|
+
* A type guard for determining if a COSE public key is an AKP key pair
|
|
72
|
+
*/
|
|
73
|
+
export declare function isCOSEPublicKeyAKP(cosePublicKey: COSEPublicKey): cosePublicKey is COSEPublicKeyAKP;
|
|
63
74
|
/**
|
|
64
75
|
* COSE Keys
|
|
65
76
|
*
|
|
@@ -73,7 +84,8 @@ export declare enum COSEKEYS {
|
|
|
73
84
|
x = -2,
|
|
74
85
|
y = -3,
|
|
75
86
|
n = -1,
|
|
76
|
-
e = -2
|
|
87
|
+
e = -2,
|
|
88
|
+
pub = -1
|
|
77
89
|
}
|
|
78
90
|
/**
|
|
79
91
|
* COSE Key Types
|
|
@@ -83,7 +95,8 @@ export declare enum COSEKEYS {
|
|
|
83
95
|
export declare enum COSEKTY {
|
|
84
96
|
OKP = 1,
|
|
85
97
|
EC2 = 2,
|
|
86
|
-
RSA = 3
|
|
98
|
+
RSA = 3,
|
|
99
|
+
AKP = 7
|
|
87
100
|
}
|
|
88
101
|
export declare function isCOSEKty(kty: number | undefined): kty is COSEKTY;
|
|
89
102
|
/**
|
|
@@ -113,6 +126,9 @@ export declare enum COSEALG {
|
|
|
113
126
|
PS384 = -38,
|
|
114
127
|
PS512 = -39,
|
|
115
128
|
ES256K = -47,
|
|
129
|
+
ML_DSA_44 = -48,
|
|
130
|
+
ML_DSA_65 = -49,
|
|
131
|
+
ML_DSA_87 = -50,
|
|
116
132
|
RS256 = -257,
|
|
117
133
|
RS384 = -258,
|
|
118
134
|
RS512 = -259,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cose.d.ts","sourceRoot":"","sources":["../../src/helpers/cose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;;;;;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,GAAG,WAAW,GAAG,SAAS,CAAC;I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KAAK,MAAM;IACX,KAAK,MAAM;IACX,MAAM,MAAM;IACZ,SAAS,MAAM;IACf,SAAS,MAAM;IACf,SAAS,MAAM;IACf,KAAK,OAAO;IACZ,KAAK,OAAO;IACZ,KAAK,OAAO;IACZ,GAAG,SAAS;CACb;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,GAAG,IAAI,OAAO,CAEjE"}
|
package/script/helpers/cose.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.COSEALG = exports.COSECRV = exports.COSEKTY = exports.COSEKEYS = void 0;
|
|
|
4
4
|
exports.isCOSEPublicKeyOKP = isCOSEPublicKeyOKP;
|
|
5
5
|
exports.isCOSEPublicKeyEC2 = isCOSEPublicKeyEC2;
|
|
6
6
|
exports.isCOSEPublicKeyRSA = isCOSEPublicKeyRSA;
|
|
7
|
+
exports.isCOSEPublicKeyAKP = isCOSEPublicKeyAKP;
|
|
7
8
|
exports.isCOSEKty = isCOSEKty;
|
|
8
9
|
exports.isCOSECrv = isCOSECrv;
|
|
9
10
|
exports.isCOSEAlg = isCOSEAlg;
|
|
@@ -28,6 +29,13 @@ function isCOSEPublicKeyRSA(cosePublicKey) {
|
|
|
28
29
|
const kty = cosePublicKey.get(COSEKEYS.kty);
|
|
29
30
|
return isCOSEKty(kty) && kty === COSEKTY.RSA;
|
|
30
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* A type guard for determining if a COSE public key is an AKP key pair
|
|
34
|
+
*/
|
|
35
|
+
function isCOSEPublicKeyAKP(cosePublicKey) {
|
|
36
|
+
const kty = cosePublicKey.get(COSEKEYS.kty);
|
|
37
|
+
return isCOSEKty(kty) && kty === COSEKTY.AKP;
|
|
38
|
+
}
|
|
31
39
|
/**
|
|
32
40
|
* COSE Keys
|
|
33
41
|
*
|
|
@@ -43,6 +51,7 @@ var COSEKEYS;
|
|
|
43
51
|
COSEKEYS[COSEKEYS["y"] = -3] = "y";
|
|
44
52
|
COSEKEYS[COSEKEYS["n"] = -1] = "n";
|
|
45
53
|
COSEKEYS[COSEKEYS["e"] = -2] = "e";
|
|
54
|
+
COSEKEYS[COSEKEYS["pub"] = -1] = "pub";
|
|
46
55
|
})(COSEKEYS || (exports.COSEKEYS = COSEKEYS = {}));
|
|
47
56
|
/**
|
|
48
57
|
* COSE Key Types
|
|
@@ -54,6 +63,7 @@ var COSEKTY;
|
|
|
54
63
|
COSEKTY[COSEKTY["OKP"] = 1] = "OKP";
|
|
55
64
|
COSEKTY[COSEKTY["EC2"] = 2] = "EC2";
|
|
56
65
|
COSEKTY[COSEKTY["RSA"] = 3] = "RSA";
|
|
66
|
+
COSEKTY[COSEKTY["AKP"] = 7] = "AKP";
|
|
57
67
|
})(COSEKTY || (exports.COSEKTY = COSEKTY = {}));
|
|
58
68
|
function isCOSEKty(kty) {
|
|
59
69
|
return Object.values(COSEKTY).indexOf(kty) >= 0;
|
|
@@ -89,6 +99,9 @@ var COSEALG;
|
|
|
89
99
|
COSEALG[COSEALG["PS384"] = -38] = "PS384";
|
|
90
100
|
COSEALG[COSEALG["PS512"] = -39] = "PS512";
|
|
91
101
|
COSEALG[COSEALG["ES256K"] = -47] = "ES256K";
|
|
102
|
+
COSEALG[COSEALG["ML_DSA_44"] = -48] = "ML_DSA_44";
|
|
103
|
+
COSEALG[COSEALG["ML_DSA_65"] = -49] = "ML_DSA_65";
|
|
104
|
+
COSEALG[COSEALG["ML_DSA_87"] = -50] = "ML_DSA_87";
|
|
92
105
|
COSEALG[COSEALG["RS256"] = -257] = "RS256";
|
|
93
106
|
COSEALG[COSEALG["RS384"] = -258] = "RS384";
|
|
94
107
|
COSEALG[COSEALG["RS512"] = -259] = "RS512";
|
|
@@ -1 +1 @@
|
|
|
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"}
|
|
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,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,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"}
|
|
@@ -15,4 +15,6 @@ export * from './verifySignature.js';
|
|
|
15
15
|
export * from './iso/index.js';
|
|
16
16
|
export * from '../metadata/verifyMDSBlob.js';
|
|
17
17
|
export * as cose from './cose.js';
|
|
18
|
+
export { COSEALG } from './cose.js';
|
|
19
|
+
export { type SimpleWebAuthnLogger } from './logging.js';
|
|
18
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,aAAa,CAAC;AAC5B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,aAAa,CAAC;AAC5B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC"}
|
package/script/helpers/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26
26
|
return result;
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.cose = void 0;
|
|
29
|
+
exports.COSEALG = exports.cose = void 0;
|
|
30
30
|
__exportStar(require("./convertAAGUIDToString.js"), exports);
|
|
31
31
|
__exportStar(require("./convertCertBufferToPEM.js"), exports);
|
|
32
32
|
__exportStar(require("./convertCOSEtoPKCS.js"), exports);
|
|
@@ -44,3 +44,6 @@ __exportStar(require("./verifySignature.js"), exports);
|
|
|
44
44
|
__exportStar(require("./iso/index.js"), exports);
|
|
45
45
|
__exportStar(require("../metadata/verifyMDSBlob.js"), exports);
|
|
46
46
|
exports.cose = __importStar(require("./cose.js"));
|
|
47
|
+
// Specially exporting this for easier `supportedAlgorithmIDs` argument definition
|
|
48
|
+
var cose_js_1 = require("./cose.js");
|
|
49
|
+
Object.defineProperty(exports, "COSEALG", { enumerable: true, get: function () { return cose_js_1.COSEALG; } });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.digest = digest;
|
|
4
|
-
const
|
|
4
|
+
const mapCoseAlgToWebCryptoHashAlgName_js_1 = require("./mapCoseAlgToWebCryptoHashAlgName.js");
|
|
5
5
|
const getWebCrypto_js_1 = require("./getWebCrypto.js");
|
|
6
6
|
/**
|
|
7
7
|
* Generate a digest of the provided data.
|
|
@@ -11,7 +11,7 @@ const getWebCrypto_js_1 = require("./getWebCrypto.js");
|
|
|
11
11
|
*/
|
|
12
12
|
async function digest(data, algorithm) {
|
|
13
13
|
const WebCrypto = await (0, getWebCrypto_js_1.getWebCrypto)();
|
|
14
|
-
const subtleAlgorithm = (0,
|
|
14
|
+
const subtleAlgorithm = (0, mapCoseAlgToWebCryptoHashAlgName_js_1.mapCoseAlgToWebCryptoHashAlgName)(algorithm);
|
|
15
15
|
const hashed = await WebCrypto.subtle.digest(subtleAlgorithm, data);
|
|
16
16
|
return new Uint8Array(hashed);
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWebCrypto.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/getWebCrypto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAItD;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"getWebCrypto.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/getWebCrypto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAItD;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CA4C9C;AAED,qBAAa,gBAAiB,SAAQ,KAAK;;CAM1C;AAGD,eAAO,MAAM,sBAAsB;;iCAGJ,MAAM,GAAG,SAAS;CAGhD,CAAC"}
|
|
@@ -28,6 +28,18 @@ function getWebCrypto() {
|
|
|
28
28
|
*/
|
|
29
29
|
const _globalThisCrypto = exports._getWebCryptoInternals.stubThisGlobalThisCrypto();
|
|
30
30
|
if (_globalThisCrypto) {
|
|
31
|
+
/**
|
|
32
|
+
* In Deno v2.7.x, TypeScript 5.9 defines `Crypto.getRandomValues()` as the following type:
|
|
33
|
+
*
|
|
34
|
+
* `getRandomValues<T extends ArrayBufferView>(array: T): T;`
|
|
35
|
+
*
|
|
36
|
+
* However in earlier versions of TypeScript, `Crypto.getRandomValues()` is defined as such:
|
|
37
|
+
*
|
|
38
|
+
* `getRandomValues<T extends ArrayBufferView | null>(array: T): T;`
|
|
39
|
+
*
|
|
40
|
+
* Casting to `as unknown as Crypto` here (using this project's `Crypto` types extracted from
|
|
41
|
+
* DOM types in an older, minimum-supported-Deno version of TypeScript) helps bridge the gap.
|
|
42
|
+
*/
|
|
31
43
|
webCrypto = _globalThisCrypto;
|
|
32
44
|
return resolve(webCrypto);
|
|
33
45
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert a JWK-formatted public key into a WebCrypto CryptoKey that can be used for
|
|
3
|
+
* signature verification
|
|
4
|
+
*/
|
|
5
|
+
export declare function importJWKKey(opts: {
|
|
6
|
+
keyData: JsonWebKey;
|
|
7
|
+
algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams;
|
|
8
|
+
}): Promise<CryptoKey>;
|
|
9
|
+
//# sourceMappingURL=importJWKKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importJWKKey.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/importJWKKey.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE;IACvC,OAAO,EAAE,UAAU,CAAC;IACpB,SAAS,EAAE,mBAAmB,GAAG,qBAAqB,GAAG,iBAAiB,CAAC;CAC5E,GAAG,OAAO,CAAC,SAAS,CAAC,CAMrB"}
|