@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.
Files changed (166) hide show
  1. package/README.md +8 -4
  2. package/esm/authentication/generateAuthenticationOptions.d.ts +2 -2
  3. package/esm/authentication/generateAuthenticationOptions.d.ts.map +1 -1
  4. package/esm/authentication/verifyAuthenticationResponse.d.ts +1 -0
  5. package/esm/authentication/verifyAuthenticationResponse.d.ts.map +1 -1
  6. package/esm/authentication/verifyAuthenticationResponse.js +40 -2
  7. package/esm/helpers/cose.d.ts +18 -2
  8. package/esm/helpers/cose.d.ts.map +1 -1
  9. package/esm/helpers/cose.js +12 -0
  10. package/esm/helpers/decodeClientDataJSON.d.ts +1 -0
  11. package/esm/helpers/decodeClientDataJSON.d.ts.map +1 -1
  12. package/esm/helpers/index.d.ts +2 -0
  13. package/esm/helpers/index.d.ts.map +1 -1
  14. package/esm/helpers/index.js +2 -0
  15. package/esm/helpers/iso/isoCrypto/digest.js +2 -2
  16. package/esm/helpers/iso/isoCrypto/getWebCrypto.d.ts.map +1 -1
  17. package/esm/helpers/iso/isoCrypto/getWebCrypto.js +12 -0
  18. package/esm/helpers/iso/isoCrypto/importJWKKey.d.ts +9 -0
  19. package/esm/helpers/iso/isoCrypto/importJWKKey.d.ts.map +1 -0
  20. package/esm/helpers/iso/isoCrypto/{importKey.js → importJWKKey.js} +6 -4
  21. package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoHashAlgName.d.ts +10 -0
  22. package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoHashAlgName.d.ts.map +1 -0
  23. package/esm/helpers/iso/isoCrypto/{mapCoseAlgToWebCryptoAlg.js → mapCoseAlgToWebCryptoHashAlgName.js} +6 -3
  24. package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts +4 -1
  25. package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts.map +1 -1
  26. package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.js +15 -0
  27. package/esm/helpers/iso/isoCrypto/runtimeSupportsWebCryptoKeyAlg.d.ts +7 -0
  28. package/esm/helpers/iso/isoCrypto/runtimeSupportsWebCryptoKeyAlg.d.ts.map +1 -0
  29. package/esm/helpers/iso/isoCrypto/runtimeSupportsWebCryptoKeyAlg.js +16 -0
  30. package/esm/helpers/iso/isoCrypto/structs.d.ts +1 -1
  31. package/esm/helpers/iso/isoCrypto/structs.d.ts.map +1 -1
  32. package/esm/helpers/iso/isoCrypto/verify.d.ts.map +1 -1
  33. package/esm/helpers/iso/isoCrypto/verify.js +5 -1
  34. package/esm/helpers/iso/isoCrypto/verifyAKP.d.ts +9 -0
  35. package/esm/helpers/iso/isoCrypto/verifyAKP.d.ts.map +1 -0
  36. package/esm/helpers/iso/isoCrypto/verifyAKP.js +47 -0
  37. package/esm/helpers/iso/isoCrypto/verifyEC2.d.ts.map +1 -1
  38. package/esm/helpers/iso/isoCrypto/verifyEC2.js +5 -8
  39. package/esm/helpers/iso/isoCrypto/verifyOKP.d.ts.map +1 -1
  40. package/esm/helpers/iso/isoCrypto/verifyOKP.js +2 -5
  41. package/esm/helpers/iso/isoCrypto/verifyRSA.d.ts.map +1 -1
  42. package/esm/helpers/iso/isoCrypto/verifyRSA.js +5 -8
  43. package/esm/helpers/logging.d.ts +28 -10
  44. package/esm/helpers/logging.d.ts.map +1 -1
  45. package/esm/helpers/logging.js +27 -16
  46. package/esm/helpers/mapJWSAlgToCOSEAlg.d.ts +8 -0
  47. package/esm/helpers/mapJWSAlgToCOSEAlg.d.ts.map +1 -0
  48. package/esm/helpers/mapJWSAlgToCOSEAlg.js +31 -0
  49. package/esm/helpers/validateCertificatePath.d.ts.map +1 -1
  50. package/esm/helpers/validateCertificatePath.js +25 -7
  51. package/esm/metadata/verifyJWT.d.ts.map +1 -1
  52. package/esm/metadata/verifyJWT.js +7 -2
  53. package/esm/registration/generateRegistrationOptions.d.ts +10 -8
  54. package/esm/registration/generateRegistrationOptions.d.ts.map +1 -1
  55. package/esm/registration/generateRegistrationOptions.js +11 -29
  56. package/esm/registration/verifications/tpm/constants.d.ts +1 -2
  57. package/esm/registration/verifications/tpm/constants.d.ts.map +1 -1
  58. package/esm/registration/verifications/tpm/constants.js +1 -2
  59. package/esm/registration/verifications/tpm/isValidTPMManufacturerID.d.ts +3 -0
  60. package/esm/registration/verifications/tpm/isValidTPMManufacturerID.d.ts.map +1 -0
  61. package/esm/registration/verifications/tpm/isValidTPMManufacturerID.js +6 -0
  62. package/esm/registration/verifications/tpm/verifyAttestationTPM.d.ts.map +1 -1
  63. package/esm/registration/verifications/tpm/verifyAttestationTPM.js +3 -2
  64. package/esm/registration/verifyRegistrationResponse.d.ts +3 -3
  65. package/esm/registration/verifyRegistrationResponse.d.ts.map +1 -1
  66. package/esm/registration/verifyRegistrationResponse.js +3 -3
  67. package/esm/services/defaultRootCerts/mds.d.ts +11 -0
  68. package/esm/services/defaultRootCerts/mds.d.ts.map +1 -1
  69. package/esm/services/defaultRootCerts/mds.js +42 -0
  70. package/esm/services/metadataService.d.ts +4 -0
  71. package/esm/services/metadataService.d.ts.map +1 -1
  72. package/esm/services/metadataService.js +16 -10
  73. package/esm/services/settingsService.d.ts +4 -0
  74. package/esm/services/settingsService.d.ts.map +1 -1
  75. package/esm/services/settingsService.js +17 -2
  76. package/esm/types/dom.d.ts +236 -3
  77. package/esm/types/dom.d.ts.map +1 -1
  78. package/esm/types/index.d.ts +158 -44
  79. package/esm/types/index.d.ts.map +1 -1
  80. package/package.json +1 -1
  81. package/script/authentication/generateAuthenticationOptions.d.ts +2 -2
  82. package/script/authentication/generateAuthenticationOptions.d.ts.map +1 -1
  83. package/script/authentication/verifyAuthenticationResponse.d.ts +1 -0
  84. package/script/authentication/verifyAuthenticationResponse.d.ts.map +1 -1
  85. package/script/authentication/verifyAuthenticationResponse.js +40 -2
  86. package/script/helpers/cose.d.ts +18 -2
  87. package/script/helpers/cose.d.ts.map +1 -1
  88. package/script/helpers/cose.js +13 -0
  89. package/script/helpers/decodeClientDataJSON.d.ts +1 -0
  90. package/script/helpers/decodeClientDataJSON.d.ts.map +1 -1
  91. package/script/helpers/index.d.ts +2 -0
  92. package/script/helpers/index.d.ts.map +1 -1
  93. package/script/helpers/index.js +4 -1
  94. package/script/helpers/iso/isoCrypto/digest.js +2 -2
  95. package/script/helpers/iso/isoCrypto/getWebCrypto.d.ts.map +1 -1
  96. package/script/helpers/iso/isoCrypto/getWebCrypto.js +12 -0
  97. package/script/helpers/iso/isoCrypto/importJWKKey.d.ts +9 -0
  98. package/script/helpers/iso/isoCrypto/importJWKKey.d.ts.map +1 -0
  99. package/script/helpers/iso/isoCrypto/{importKey.js → importJWKKey.js} +7 -5
  100. package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoHashAlgName.d.ts +10 -0
  101. package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoHashAlgName.d.ts.map +1 -0
  102. package/script/helpers/iso/isoCrypto/{mapCoseAlgToWebCryptoAlg.js → mapCoseAlgToWebCryptoHashAlgName.js} +7 -4
  103. package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts +4 -1
  104. package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts.map +1 -1
  105. package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.js +15 -0
  106. package/script/helpers/iso/isoCrypto/runtimeSupportsWebCryptoKeyAlg.d.ts +7 -0
  107. package/script/helpers/iso/isoCrypto/runtimeSupportsWebCryptoKeyAlg.d.ts.map +1 -0
  108. package/script/helpers/iso/isoCrypto/runtimeSupportsWebCryptoKeyAlg.js +19 -0
  109. package/script/helpers/iso/isoCrypto/structs.d.ts +1 -1
  110. package/script/helpers/iso/isoCrypto/structs.d.ts.map +1 -1
  111. package/script/helpers/iso/isoCrypto/verify.d.ts.map +1 -1
  112. package/script/helpers/iso/isoCrypto/verify.js +4 -0
  113. package/script/helpers/iso/isoCrypto/verifyAKP.d.ts +9 -0
  114. package/script/helpers/iso/isoCrypto/verifyAKP.d.ts.map +1 -0
  115. package/script/helpers/iso/isoCrypto/verifyAKP.js +50 -0
  116. package/script/helpers/iso/isoCrypto/verifyEC2.d.ts.map +1 -1
  117. package/script/helpers/iso/isoCrypto/verifyEC2.js +5 -8
  118. package/script/helpers/iso/isoCrypto/verifyOKP.d.ts.map +1 -1
  119. package/script/helpers/iso/isoCrypto/verifyOKP.js +2 -5
  120. package/script/helpers/iso/isoCrypto/verifyRSA.d.ts.map +1 -1
  121. package/script/helpers/iso/isoCrypto/verifyRSA.js +5 -8
  122. package/script/helpers/logging.d.ts +28 -10
  123. package/script/helpers/logging.d.ts.map +1 -1
  124. package/script/helpers/logging.js +29 -17
  125. package/script/helpers/mapJWSAlgToCOSEAlg.d.ts +8 -0
  126. package/script/helpers/mapJWSAlgToCOSEAlg.d.ts.map +1 -0
  127. package/script/helpers/mapJWSAlgToCOSEAlg.js +34 -0
  128. package/script/helpers/validateCertificatePath.d.ts.map +1 -1
  129. package/script/helpers/validateCertificatePath.js +25 -7
  130. package/script/metadata/verifyJWT.d.ts.map +1 -1
  131. package/script/metadata/verifyJWT.js +6 -1
  132. package/script/registration/generateRegistrationOptions.d.ts +10 -8
  133. package/script/registration/generateRegistrationOptions.d.ts.map +1 -1
  134. package/script/registration/generateRegistrationOptions.js +13 -31
  135. package/script/registration/verifications/tpm/constants.d.ts +1 -2
  136. package/script/registration/verifications/tpm/constants.d.ts.map +1 -1
  137. package/script/registration/verifications/tpm/constants.js +1 -2
  138. package/script/registration/verifications/tpm/isValidTPMManufacturerID.d.ts +3 -0
  139. package/script/registration/verifications/tpm/isValidTPMManufacturerID.d.ts.map +1 -0
  140. package/script/registration/verifications/tpm/isValidTPMManufacturerID.js +9 -0
  141. package/script/registration/verifications/tpm/verifyAttestationTPM.d.ts.map +1 -1
  142. package/script/registration/verifications/tpm/verifyAttestationTPM.js +2 -1
  143. package/script/registration/verifyRegistrationResponse.d.ts +3 -3
  144. package/script/registration/verifyRegistrationResponse.d.ts.map +1 -1
  145. package/script/registration/verifyRegistrationResponse.js +2 -2
  146. package/script/services/defaultRootCerts/mds.d.ts +11 -0
  147. package/script/services/defaultRootCerts/mds.d.ts.map +1 -1
  148. package/script/services/defaultRootCerts/mds.js +43 -1
  149. package/script/services/metadataService.d.ts +4 -0
  150. package/script/services/metadataService.d.ts.map +1 -1
  151. package/script/services/metadataService.js +15 -9
  152. package/script/services/settingsService.d.ts +4 -0
  153. package/script/services/settingsService.d.ts.map +1 -1
  154. package/script/services/settingsService.js +16 -1
  155. package/script/types/dom.d.ts +236 -3
  156. package/script/types/dom.d.ts.map +1 -1
  157. package/script/types/index.d.ts +158 -44
  158. package/script/types/index.d.ts.map +1 -1
  159. package/esm/helpers/iso/isoCrypto/importKey.d.ts +0 -5
  160. package/esm/helpers/iso/isoCrypto/importKey.d.ts.map +0 -1
  161. package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts +0 -7
  162. package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts.map +0 -1
  163. package/script/helpers/iso/isoCrypto/importKey.d.ts +0 -5
  164. package/script/helpers/iso/isoCrypto/importKey.d.ts.map +0 -1
  165. package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts +0 -7
  166. package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts.map +0 -1
@@ -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, 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, 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: AuthenticatorAttestationResponseFuture;
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?: AuthenticatorTransportFuture[];
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?: AuthenticatorTransportFuture[];
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?(): PublicKeyCredentialJSON;
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
@@ -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,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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ACzB,UAAU,GACV,QAAQ,GACR,mBAAmB,GACnB,aAAa,GACb,KAAK,GACL,OAAO,GACP,MAAM,CAAC;AAEX;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,+BAA+B,EAC/B,oCAAoC,EACpC,qCAAqC,EACrC,8BAA8B,EAC9B,uBAAuB,EACvB,gCAAgC,EAChC,8BAA8B,EAC9B,eAAe,EACf,uBAAuB,EACvB,QAAQ,EACR,mBAAmB,EACnB,kCAAkC,EAClC,iCAAiC,EACjC,6BAA6B,EAC7B,iCAAiC,EACjC,2BAA2B,EAC3B,uBAAuB,EACvB,YAAY,EACZ,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,mBAAmB,EACnB,+BAA+B,EAC/B,oCAAoC,EACpC,qCAAqC,EACrC,8BAA8B,EAC9B,uBAAuB,EACvB,gCAAgC,EAChC,8BAA8B,EAC9B,sBAAsB,EACtB,eAAe,EACf,uBAAuB,EACvB,yBAAyB,EACzB,wBAAwB,EACxB,MAAM,EACN,mBAAmB,EACnB,kCAAkC,EAClC,6BAA6B,EAC7B,iCAAiC,EACjC,6BAA6B,EAC7B,iCAAiC,EACjC,2BAA2B,EAC3B,uBAAuB,EACvB,6BAA6B,EAC7B,sBAAsB,EACtB,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;IACjB,k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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplewebauthn/server",
3
- "version": "13.3.2",
3
+ "version": "14.0.0",
4
4
  "description": "SimpleWebAuthn for Servers",
5
5
  "keywords": [
6
6
  "typescript",
@@ -1,4 +1,4 @@
1
- import type { AuthenticationExtensionsClientInputs, AuthenticatorTransportFuture, Base64URLString, PublicKeyCredentialRequestOptionsJSON, Uint8Array_ } from '../types/index.js';
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?: AuthenticatorTransportFuture[];
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,4BAA4B,EAC5B,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,4BAA4B,EAAE,CAAC;KAC7C,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"}
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":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CACH,CAAC"}
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,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACtC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,kBAAkB,CAAC,EAAE;QACnB,gBAAgB,CAAC,EAAE,2BAA2B,CAAC;KAChD,CAAC;CACH,GACA,OAAO,CAAC,8BAA8B,CAAC,CAgQzC;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"}
@@ -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)) {
@@ -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,GA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;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"}
@@ -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";
@@ -8,6 +8,7 @@ export type ClientDataJSON = {
8
8
  challenge: string;
9
9
  origin: string;
10
10
  crossOrigin?: boolean;
11
+ topOrigin?: string;
11
12
  tokenBinding?: {
12
13
  id?: string;
13
14
  status: 'present' | 'supported' | 'not-supported';
@@ -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"}
@@ -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 mapCoseAlgToWebCryptoAlg_js_1 = require("./mapCoseAlgToWebCryptoAlg.js");
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, mapCoseAlgToWebCryptoAlg_js_1.mapCoseAlgToWebCryptoAlg)(algorithm);
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,CAgC9C;AAED,qBAAa,gBAAiB,SAAQ,KAAK;;CAM1C;AAGD,eAAO,MAAM,sBAAsB;;iCAGJ,MAAM,GAAG,SAAS;CAGhD,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"}