@simplewebauthn/server 13.3.3 → 14.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +52 -2
- package/esm/errors/index.d.ts +17 -0
- package/esm/errors/index.d.ts.map +1 -0
- package/esm/errors/index.js +24 -0
- package/esm/helpers/convertX509PublicKeyToCOSE.d.ts +1 -1
- package/esm/helpers/convertX509PublicKeyToCOSE.d.ts.map +1 -1
- package/esm/helpers/convertX509PublicKeyToCOSE.js +22 -6
- package/esm/helpers/cose.d.ts +19 -2
- package/esm/helpers/cose.d.ts.map +1 -1
- package/esm/helpers/cose.js +15 -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/isCertRevoked.d.ts +1 -0
- package/esm/helpers/isCertRevoked.d.ts.map +1 -1
- package/esm/helpers/isCertRevoked.js +1 -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 +48 -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/mapX509SignatureAlgToCOSEAlg.d.ts +0 -3
- package/esm/helpers/mapX509SignatureAlgToCOSEAlg.d.ts.map +1 -1
- package/esm/helpers/mapX509SignatureAlgToCOSEAlg.js +19 -10
- package/esm/helpers/validateCertificatePath.d.ts +1 -0
- package/esm/helpers/validateCertificatePath.d.ts.map +1 -1
- package/esm/helpers/validateCertificatePath.js +26 -7
- package/esm/index.d.ts +1 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -0
- 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/verifications/verifyAttestationPacked.js +1 -1
- package/esm/registration/verifyRegistrationResponse.d.ts +3 -3
- package/esm/registration/verifyRegistrationResponse.d.ts.map +1 -1
- package/esm/registration/verifyRegistrationResponse.js +22 -11
- 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 +12 -0
- 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 +4 -2
- 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 +52 -2
- package/script/errors/index.d.ts +17 -0
- package/script/errors/index.d.ts.map +1 -0
- package/script/errors/index.js +29 -0
- package/script/helpers/convertX509PublicKeyToCOSE.d.ts +1 -1
- package/script/helpers/convertX509PublicKeyToCOSE.d.ts.map +1 -1
- package/script/helpers/convertX509PublicKeyToCOSE.js +21 -5
- package/script/helpers/cose.d.ts +19 -2
- package/script/helpers/cose.d.ts.map +1 -1
- package/script/helpers/cose.js +17 -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/isCertRevoked.d.ts +1 -0
- package/script/helpers/isCertRevoked.d.ts.map +1 -1
- package/script/helpers/isCertRevoked.js +1 -0
- 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 +51 -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/mapX509SignatureAlgToCOSEAlg.d.ts +0 -3
- package/script/helpers/mapX509SignatureAlgToCOSEAlg.d.ts.map +1 -1
- package/script/helpers/mapX509SignatureAlgToCOSEAlg.js +19 -10
- package/script/helpers/validateCertificatePath.d.ts +1 -0
- package/script/helpers/validateCertificatePath.d.ts.map +1 -1
- package/script/helpers/validateCertificatePath.js +26 -7
- package/script/index.d.ts +1 -0
- package/script/index.d.ts.map +1 -1
- package/script/index.js +1 -0
- 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/verifications/verifyAttestationPacked.js +1 -1
- package/script/registration/verifyRegistrationResponse.d.ts +3 -3
- package/script/registration/verifyRegistrationResponse.d.ts.map +1 -1
- package/script/registration/verifyRegistrationResponse.js +24 -13
- 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 +12 -0
- 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.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;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,kBAAkB,CAAC,EAA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ED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplewebauthn/server",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.1",
|
|
4
4
|
"description": "SimpleWebAuthn for Servers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -56,7 +56,9 @@
|
|
|
56
56
|
"@peculiar/asn1-rsa": "^2.6.1",
|
|
57
57
|
"@peculiar/asn1-schema": "^2.6.0",
|
|
58
58
|
"@peculiar/asn1-x509": "^2.6.1",
|
|
59
|
-
"@peculiar/x509": "^
|
|
59
|
+
"@peculiar/asn1-x509-post-quantum": "^2.9.4",
|
|
60
|
+
"@peculiar/x509": "^2.1.0",
|
|
61
|
+
"reflect-metadata": "^0.2.2"
|
|
60
62
|
},
|
|
61
63
|
"devDependencies": {
|
|
62
64
|
"@types/node": "^20.9.0"
|
|
@@ -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;
|
|
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;AAQhH;;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,CA6QzC;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"}
|
|
@@ -8,6 +8,10 @@ const parseAuthenticatorData_js_1 = require("../helpers/parseAuthenticatorData.j
|
|
|
8
8
|
const parseBackupFlags_js_1 = require("../helpers/parseBackupFlags.js");
|
|
9
9
|
const matchExpectedRPID_js_1 = require("../helpers/matchExpectedRPID.js");
|
|
10
10
|
const index_js_1 = require("../helpers/iso/index.js");
|
|
11
|
+
const decodeCredentialPublicKey_js_1 = require("../helpers/decodeCredentialPublicKey.js");
|
|
12
|
+
const cose_js_1 = require("../helpers/cose.js");
|
|
13
|
+
const settingsService_js_1 = require("../services/settingsService.js");
|
|
14
|
+
const index_js_2 = require("../errors/index.js");
|
|
11
15
|
/**
|
|
12
16
|
* Verify that the user has legitimately completed the authentication process
|
|
13
17
|
*
|
|
@@ -24,7 +28,7 @@ const index_js_1 = require("../helpers/iso/index.js");
|
|
|
24
28
|
* @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
29
|
*/
|
|
26
30
|
async function verifyAuthenticationResponse(options) {
|
|
27
|
-
const { response, expectedChallenge, expectedOrigin, expectedRPID, expectedType, credential, requireUserVerification = true, advancedFIDOConfig, } = options;
|
|
31
|
+
const { response, expectedChallenge, expectedOrigin, expectedRPID, expectedType, expectedTopOrigin, credential, requireUserVerification = true, advancedFIDOConfig, } = options;
|
|
28
32
|
const { id, rawId, type: credentialType, response: assertionResponse } = response;
|
|
29
33
|
// Ensure credential specified an ID
|
|
30
34
|
if (!id) {
|
|
@@ -45,7 +49,7 @@ async function verifyAuthenticationResponse(options) {
|
|
|
45
49
|
throw new Error('Credential response clientDataJSON was not a string');
|
|
46
50
|
}
|
|
47
51
|
const clientDataJSON = (0, decodeClientDataJSON_js_1.decodeClientDataJSON)(assertionResponse.clientDataJSON);
|
|
48
|
-
const { type, origin, challenge, tokenBinding } = clientDataJSON;
|
|
52
|
+
const { type, origin, challenge, tokenBinding, crossOrigin, topOrigin } = clientDataJSON;
|
|
49
53
|
// Make sure we're handling an authentication
|
|
50
54
|
if (Array.isArray(expectedType)) {
|
|
51
55
|
if (!expectedType.includes(type)) {
|
|
@@ -70,6 +74,44 @@ async function verifyAuthenticationResponse(options) {
|
|
|
70
74
|
else if (challenge !== expectedChallenge) {
|
|
71
75
|
throw new Error(`Unexpected authentication response challenge "${challenge}", expected "${expectedChallenge}"`);
|
|
72
76
|
}
|
|
77
|
+
// Check that the authentication response is within an expected iframe
|
|
78
|
+
if (crossOrigin) {
|
|
79
|
+
/**
|
|
80
|
+
* TODO: Since Safari doesn't support `topOrigin` as of May 2026, only check this when
|
|
81
|
+
* `topOrigin` is available for now.
|
|
82
|
+
*/
|
|
83
|
+
if (topOrigin) {
|
|
84
|
+
if (!expectedTopOrigin) {
|
|
85
|
+
/**
|
|
86
|
+
* If `expectedTopOrigin` is not set, this should be considered an unexpected cross-origin
|
|
87
|
+
* request. Reject the response while helping the RP understand how they need to update this
|
|
88
|
+
* method call if they want to support verification of such WebAuthn authentication requests.
|
|
89
|
+
*/
|
|
90
|
+
throw new Error(`Detected cross-origin authentication response from top origin of "${topOrigin}", but a value for \`expectedTopOrigin\` was not specified when calling \`verifyAuthenticationResponse()\``);
|
|
91
|
+
}
|
|
92
|
+
if (Array.isArray(expectedTopOrigin)) {
|
|
93
|
+
if (!expectedTopOrigin.includes(topOrigin)) {
|
|
94
|
+
const joinedExpectedTopOrigin = expectedTopOrigin.join(', ');
|
|
95
|
+
throw new Error(`Unexpected cross-origin authentication response top origin of "${topOrigin}", expected one of: ${joinedExpectedTopOrigin}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
if (topOrigin !== expectedTopOrigin) {
|
|
100
|
+
throw new Error(`Unexpected cross-origin authentication response top origin of "${topOrigin}", expected: ${expectedTopOrigin}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
if (topOrigin) {
|
|
107
|
+
/**
|
|
108
|
+
* If `topOrigin` is set despite `crossOrigin` being false, this is an unexpected request.
|
|
109
|
+
*
|
|
110
|
+
* See https://w3c.github.io/webauthn/#dom-collectedclientdata-toporigin.
|
|
111
|
+
*/
|
|
112
|
+
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`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
73
115
|
// Check that the origin is our site
|
|
74
116
|
if (Array.isArray(expectedOrigin)) {
|
|
75
117
|
if (!expectedOrigin.includes(origin)) {
|
|
@@ -152,6 +194,14 @@ async function verifyAuthenticationResponse(options) {
|
|
|
152
194
|
// on the device without going through this site
|
|
153
195
|
throw new Error(`Response counter value ${counter} was lower than expected ${credential.counter}`);
|
|
154
196
|
}
|
|
197
|
+
const decodedPublicKey = (0, decodeCredentialPublicKey_js_1.decodeCredentialPublicKey)(credential.publicKey);
|
|
198
|
+
const pubKeyAlg = decodedPublicKey.get(cose_js_1.COSEKEYS.alg);
|
|
199
|
+
if (typeof pubKeyAlg !== 'number') {
|
|
200
|
+
throw new Error('Credential public key was missing numeric alg');
|
|
201
|
+
}
|
|
202
|
+
if ((0, cose_js_1.isPQCCOSEAlg)(pubKeyAlg) && !settingsService_js_1.SettingsService.runtimeSupportsPQC()) {
|
|
203
|
+
throw new index_js_2.PQCNotSupportedError(pubKeyAlg);
|
|
204
|
+
}
|
|
155
205
|
const { credentialDeviceType, credentialBackedUp } = (0, parseBackupFlags_js_1.parseBackupFlags)(flags);
|
|
156
206
|
const toReturn = {
|
|
157
207
|
verified: await (0, verifySignature_js_1.verifySignature)({
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { COSEALG } from '../helpers/cose.js';
|
|
2
|
+
/**
|
|
3
|
+
* Base error class that helps disambiguate SimpleWebAuthn library errors from other library errors
|
|
4
|
+
*/
|
|
5
|
+
export declare class SimpleWebAuthnError extends Error {
|
|
6
|
+
code: SimpleWebAuthnErrorCode;
|
|
7
|
+
constructor({ message, code, cause }: {
|
|
8
|
+
message: string;
|
|
9
|
+
code: SimpleWebAuthnErrorCode;
|
|
10
|
+
cause?: Error;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export declare class PQCNotSupportedError extends SimpleWebAuthnError {
|
|
14
|
+
constructor(alg: COSEALG);
|
|
15
|
+
}
|
|
16
|
+
export type SimpleWebAuthnErrorCode = 'RUNTIME_NO_PQC_SUPPORT';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGlD;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,IAAI,EAAE,uBAAuB,CAAC;gBAElB,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpC,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,uBAAuB,CAAC;QAC9B,KAAK,CAAC,EAAE,KAAK,CAAC;KACf;CAKF;AAED,qBAAa,oBAAqB,SAAQ,mBAAmB;gBAC/C,GAAG,EAAE,OAAO;CAKzB;AAED,MAAM,MAAM,uBAAuB,GAAG,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PQCNotSupportedError = exports.SimpleWebAuthnError = void 0;
|
|
4
|
+
const mapCoseAlgToWebCryptoKeyAlgName_js_1 = require("../helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.js");
|
|
5
|
+
/**
|
|
6
|
+
* Base error class that helps disambiguate SimpleWebAuthn library errors from other library errors
|
|
7
|
+
*/
|
|
8
|
+
class SimpleWebAuthnError extends Error {
|
|
9
|
+
constructor({ message, code, cause }) {
|
|
10
|
+
super(message, { cause });
|
|
11
|
+
Object.defineProperty(this, "code", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
configurable: true,
|
|
14
|
+
writable: true,
|
|
15
|
+
value: void 0
|
|
16
|
+
});
|
|
17
|
+
this.name = 'SimpleWebAuthnError';
|
|
18
|
+
this.code = code;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.SimpleWebAuthnError = SimpleWebAuthnError;
|
|
22
|
+
class PQCNotSupportedError extends SimpleWebAuthnError {
|
|
23
|
+
constructor(alg) {
|
|
24
|
+
const webCryptoAlg = (0, mapCoseAlgToWebCryptoKeyAlgName_js_1.mapCoseAlgToWebCryptoKeyAlgName)(alg);
|
|
25
|
+
const message = `This runtime's WebCrypto.subtle does not support use of ${webCryptoAlg}`;
|
|
26
|
+
super({ message, code: 'RUNTIME_NO_PQC_SUPPORT' });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.PQCNotSupportedError = PQCNotSupportedError;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COSEPublicKey } from './cose.js';
|
|
1
|
+
import { type COSEPublicKey } from './cose.js';
|
|
2
2
|
import type { Uint8Array_ } from '../types/index.js';
|
|
3
3
|
export declare function convertX509PublicKeyToCOSE(x509Certificate: Uint8Array_): COSEPublicKey;
|
|
4
4
|
//# sourceMappingURL=convertX509PublicKeyToCOSE.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertX509PublicKeyToCOSE.d.ts","sourceRoot":"","sources":["../../src/helpers/convertX509PublicKeyToCOSE.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"convertX509PublicKeyToCOSE.d.ts","sourceRoot":"","sources":["../../src/helpers/convertX509PublicKeyToCOSE.ts"],"names":[],"mappings":"AAMA,OAAO,EAKL,KAAK,aAAa,EAInB,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,WAAW,GAC3B,aAAa,CAsGf"}
|
|
@@ -4,6 +4,7 @@ exports.convertX509PublicKeyToCOSE = convertX509PublicKeyToCOSE;
|
|
|
4
4
|
const asn1_schema_1 = require("@peculiar/asn1-schema");
|
|
5
5
|
const asn1_x509_1 = require("@peculiar/asn1-x509");
|
|
6
6
|
const asn1_ecc_1 = require("@peculiar/asn1-ecc");
|
|
7
|
+
const asn1_x509_post_quantum_1 = require("@peculiar/asn1-x509-post-quantum");
|
|
7
8
|
const asn1_rsa_1 = require("@peculiar/asn1-rsa");
|
|
8
9
|
const cose_js_1 = require("./cose.js");
|
|
9
10
|
const mapX509SignatureAlgToCOSEAlg_js_1 = require("./mapX509SignatureAlgToCOSEAlg.js");
|
|
@@ -14,8 +15,7 @@ function convertX509PublicKeyToCOSE(x509Certificate) {
|
|
|
14
15
|
*/
|
|
15
16
|
const x509 = asn1_schema_1.AsnParser.parse(x509Certificate, asn1_x509_1.Certificate);
|
|
16
17
|
const { tbsCertificate } = x509;
|
|
17
|
-
const { subjectPublicKeyInfo
|
|
18
|
-
const signatureAlgorithm = _tbsSignature.algorithm;
|
|
18
|
+
const { subjectPublicKeyInfo } = tbsCertificate;
|
|
19
19
|
const publicKeyAlgorithmID = subjectPublicKeyInfo.algorithm.algorithm;
|
|
20
20
|
if (publicKeyAlgorithmID === asn1_ecc_1.id_ecPublicKey) {
|
|
21
21
|
/**
|
|
@@ -25,12 +25,15 @@ function convertX509PublicKeyToCOSE(x509Certificate) {
|
|
|
25
25
|
throw new Error('Certificate public key was missing parameters (EC2)');
|
|
26
26
|
}
|
|
27
27
|
const ecParameters = asn1_schema_1.AsnParser.parse(new Uint8Array(subjectPublicKeyInfo.algorithm.parameters), asn1_ecc_1.ECParameters);
|
|
28
|
-
let
|
|
28
|
+
let alg;
|
|
29
|
+
let crv;
|
|
29
30
|
const { namedCurve } = ecParameters;
|
|
30
31
|
if (namedCurve === asn1_ecc_1.id_secp256r1) {
|
|
32
|
+
alg = cose_js_1.COSEALG.ES256;
|
|
31
33
|
crv = cose_js_1.COSECRV.P256;
|
|
32
34
|
}
|
|
33
35
|
else if (namedCurve === asn1_ecc_1.id_secp384r1) {
|
|
36
|
+
alg = cose_js_1.COSEALG.ES384;
|
|
34
37
|
crv = cose_js_1.COSECRV.P384;
|
|
35
38
|
}
|
|
36
39
|
else {
|
|
@@ -51,7 +54,7 @@ function convertX509PublicKeyToCOSE(x509Certificate) {
|
|
|
51
54
|
}
|
|
52
55
|
const coseEC2PubKey = new Map();
|
|
53
56
|
coseEC2PubKey.set(cose_js_1.COSEKEYS.kty, cose_js_1.COSEKTY.EC2);
|
|
54
|
-
coseEC2PubKey.set(cose_js_1.COSEKEYS.alg,
|
|
57
|
+
coseEC2PubKey.set(cose_js_1.COSEKEYS.alg, alg);
|
|
55
58
|
coseEC2PubKey.set(cose_js_1.COSEKEYS.crv, crv);
|
|
56
59
|
coseEC2PubKey.set(cose_js_1.COSEKEYS.x, x);
|
|
57
60
|
coseEC2PubKey.set(cose_js_1.COSEKEYS.y, y);
|
|
@@ -64,11 +67,24 @@ function convertX509PublicKeyToCOSE(x509Certificate) {
|
|
|
64
67
|
const rsaPublicKey = asn1_schema_1.AsnParser.parse(subjectPublicKeyInfo.subjectPublicKey, asn1_rsa_1.RSAPublicKey);
|
|
65
68
|
const coseRSAPubKey = new Map();
|
|
66
69
|
coseRSAPubKey.set(cose_js_1.COSEKEYS.kty, cose_js_1.COSEKTY.RSA);
|
|
67
|
-
|
|
70
|
+
/**
|
|
71
|
+
* The algorithm ID is too ambiguous to know what this alg should really be. But practically
|
|
72
|
+
* speaking `shaHashOverride` is always specified when verifying signatures with RSA public keys
|
|
73
|
+
* which ultimately overrides this sensible default. Using RS256 also gets the correct WebCrypto
|
|
74
|
+
* alg name later on in verifyRSA.ts
|
|
75
|
+
*/
|
|
76
|
+
coseRSAPubKey.set(cose_js_1.COSEKEYS.alg, cose_js_1.COSEALG.RS256);
|
|
68
77
|
coseRSAPubKey.set(cose_js_1.COSEKEYS.n, new Uint8Array(rsaPublicKey.modulus));
|
|
69
78
|
coseRSAPubKey.set(cose_js_1.COSEKEYS.e, new Uint8Array(rsaPublicKey.publicExponent));
|
|
70
79
|
cosePublicKey = coseRSAPubKey;
|
|
71
80
|
}
|
|
81
|
+
else if ([asn1_x509_post_quantum_1.id_ml_dsa_44, asn1_x509_post_quantum_1.id_ml_dsa_65, asn1_x509_post_quantum_1.id_ml_dsa_87].indexOf(publicKeyAlgorithmID) >= 0) {
|
|
82
|
+
const coseAKPPubKey = new Map();
|
|
83
|
+
coseAKPPubKey.set(cose_js_1.COSEKEYS.kty, cose_js_1.COSEKTY.AKP);
|
|
84
|
+
coseAKPPubKey.set(cose_js_1.COSEKEYS.alg, (0, mapX509SignatureAlgToCOSEAlg_js_1.mapX509SignatureAlgToCOSEAlg)(publicKeyAlgorithmID));
|
|
85
|
+
coseAKPPubKey.set(cose_js_1.COSEKEYS.pub, new Uint8Array(subjectPublicKeyInfo.subjectPublicKey));
|
|
86
|
+
cosePublicKey = coseAKPPubKey;
|
|
87
|
+
}
|
|
72
88
|
else {
|
|
73
89
|
throw new Error(`Certificate public key contained unexpected algorithm ID ${publicKeyAlgorithmID}`);
|
|
74
90
|
}
|
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,10 +126,14 @@ 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,
|
|
119
135
|
RS1 = -65535
|
|
120
136
|
}
|
|
121
137
|
export declare function isCOSEAlg(alg: number | undefined): alg is COSEALG;
|
|
138
|
+
export declare function isPQCCOSEAlg(alg: COSEALG): boolean;
|
|
122
139
|
//# sourceMappingURL=cose.d.ts.map
|
|
@@ -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;IAE9C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,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;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAElD"}
|
package/script/helpers/cose.js
CHANGED
|
@@ -4,9 +4,11 @@ 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;
|
|
11
|
+
exports.isPQCCOSEAlg = isPQCCOSEAlg;
|
|
10
12
|
/**
|
|
11
13
|
* A type guard for determining if a COSE public key is an OKP key pair
|
|
12
14
|
*/
|
|
@@ -28,6 +30,13 @@ function isCOSEPublicKeyRSA(cosePublicKey) {
|
|
|
28
30
|
const kty = cosePublicKey.get(COSEKEYS.kty);
|
|
29
31
|
return isCOSEKty(kty) && kty === COSEKTY.RSA;
|
|
30
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* A type guard for determining if a COSE public key is an AKP key pair
|
|
35
|
+
*/
|
|
36
|
+
function isCOSEPublicKeyAKP(cosePublicKey) {
|
|
37
|
+
const kty = cosePublicKey.get(COSEKEYS.kty);
|
|
38
|
+
return isCOSEKty(kty) && kty === COSEKTY.AKP;
|
|
39
|
+
}
|
|
31
40
|
/**
|
|
32
41
|
* COSE Keys
|
|
33
42
|
*
|
|
@@ -43,6 +52,7 @@ var COSEKEYS;
|
|
|
43
52
|
COSEKEYS[COSEKEYS["y"] = -3] = "y";
|
|
44
53
|
COSEKEYS[COSEKEYS["n"] = -1] = "n";
|
|
45
54
|
COSEKEYS[COSEKEYS["e"] = -2] = "e";
|
|
55
|
+
COSEKEYS[COSEKEYS["pub"] = -1] = "pub";
|
|
46
56
|
})(COSEKEYS || (exports.COSEKEYS = COSEKEYS = {}));
|
|
47
57
|
/**
|
|
48
58
|
* COSE Key Types
|
|
@@ -54,6 +64,7 @@ var COSEKTY;
|
|
|
54
64
|
COSEKTY[COSEKTY["OKP"] = 1] = "OKP";
|
|
55
65
|
COSEKTY[COSEKTY["EC2"] = 2] = "EC2";
|
|
56
66
|
COSEKTY[COSEKTY["RSA"] = 3] = "RSA";
|
|
67
|
+
COSEKTY[COSEKTY["AKP"] = 7] = "AKP";
|
|
57
68
|
})(COSEKTY || (exports.COSEKTY = COSEKTY = {}));
|
|
58
69
|
function isCOSEKty(kty) {
|
|
59
70
|
return Object.values(COSEKTY).indexOf(kty) >= 0;
|
|
@@ -89,6 +100,9 @@ var COSEALG;
|
|
|
89
100
|
COSEALG[COSEALG["PS384"] = -38] = "PS384";
|
|
90
101
|
COSEALG[COSEALG["PS512"] = -39] = "PS512";
|
|
91
102
|
COSEALG[COSEALG["ES256K"] = -47] = "ES256K";
|
|
103
|
+
COSEALG[COSEALG["ML_DSA_44"] = -48] = "ML_DSA_44";
|
|
104
|
+
COSEALG[COSEALG["ML_DSA_65"] = -49] = "ML_DSA_65";
|
|
105
|
+
COSEALG[COSEALG["ML_DSA_87"] = -50] = "ML_DSA_87";
|
|
92
106
|
COSEALG[COSEALG["RS256"] = -257] = "RS256";
|
|
93
107
|
COSEALG[COSEALG["RS384"] = -258] = "RS384";
|
|
94
108
|
COSEALG[COSEALG["RS512"] = -259] = "RS512";
|
|
@@ -97,3 +111,6 @@ var COSEALG;
|
|
|
97
111
|
function isCOSEAlg(alg) {
|
|
98
112
|
return Object.values(COSEALG).indexOf(alg) >= 0;
|
|
99
113
|
}
|
|
114
|
+
function isPQCCOSEAlg(alg) {
|
|
115
|
+
return [COSEALG.ML_DSA_44, COSEALG.ML_DSA_65, COSEALG.ML_DSA_87].indexOf(alg) >= 0;
|
|
116
|
+
}
|
|
@@ -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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isCertRevoked.d.ts","sourceRoot":"","sources":["../../src/helpers/isCertRevoked.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,gBAAgB,CAAC;AAexB;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CAkG3E"}
|
|
1
|
+
{"version":3,"file":"isCertRevoked.d.ts","sourceRoot":"","sources":["../../src/helpers/isCertRevoked.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,gBAAgB,CAAC;AAexB;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CAkG3E"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isCertRevoked = isCertRevoked;
|
|
4
|
+
require("reflect-metadata");
|
|
4
5
|
const x509_1 = require("@peculiar/x509");
|
|
5
6
|
const fetch_js_1 = require("./fetch.js");
|
|
6
7
|
const cacheRevokedCerts = {};
|
|
@@ -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"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.importJWKKey = importJWKKey;
|
|
4
4
|
const getWebCrypto_js_1 = require("./getWebCrypto.js");
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Convert a JWK-formatted public key into a WebCrypto CryptoKey that can be used for
|
|
7
|
+
* signature verification
|
|
8
|
+
*/
|
|
9
|
+
async function importJWKKey(opts) {
|
|
6
10
|
const WebCrypto = await (0, getWebCrypto_js_1.getWebCrypto)();
|
|
7
11
|
const { keyData, algorithm } = opts;
|
|
8
|
-
return WebCrypto.subtle.importKey('jwk', keyData, algorithm, false, [
|
|
9
|
-
'verify',
|
|
10
|
-
]);
|
|
12
|
+
return WebCrypto.subtle.importKey('jwk', keyData, algorithm, false, ['verify']);
|
|
11
13
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SubtleCryptoAlg } from './structs.js';
|
|
2
|
+
import { COSEALG } from '../../cose.js';
|
|
3
|
+
/**
|
|
4
|
+
* Convert a COSE alg ID into a corresponding hash algorithm string value that WebCrypto APIs expect
|
|
5
|
+
*
|
|
6
|
+
* Unless otherwise specified, mappings were referenced from
|
|
7
|
+
* https://w3c.github.io/webcrypto/#jwk-mapping-alg
|
|
8
|
+
*/
|
|
9
|
+
export declare function mapCoseAlgToWebCryptoHashAlgName(alg: COSEALG): SubtleCryptoAlg;
|
|
10
|
+
//# sourceMappingURL=mapCoseAlgToWebCryptoHashAlgName.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapCoseAlgToWebCryptoHashAlgName.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoHashAlgName.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,CAe9E"}
|