@simplewebauthn/server 7.4.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +11 -14
- package/README.md +20 -7
- package/{dist → esm}/authentication/generateAuthenticationOptions.d.ts +2 -2
- package/esm/authentication/generateAuthenticationOptions.js +36 -0
- package/{dist → esm}/authentication/verifyAuthenticationResponse.d.ts +2 -2
- package/esm/authentication/verifyAuthenticationResponse.js +164 -0
- package/esm/deps.d.ts +11 -0
- package/esm/deps.js +14 -0
- package/esm/helpers/convertAAGUIDToString.js +17 -0
- package/esm/helpers/convertCOSEtoPKCS.js +21 -0
- package/{dist → esm}/helpers/convertCertBufferToPEM.d.ts +1 -1
- package/esm/helpers/convertCertBufferToPEM.js +31 -0
- package/esm/helpers/convertPEMToBytes.js +11 -0
- package/{dist → esm}/helpers/convertX509PublicKeyToCOSE.d.ts +1 -1
- package/esm/helpers/convertX509PublicKeyToCOSE.js +70 -0
- package/{dist → esm}/helpers/cose.d.ts +2 -1
- package/esm/helpers/cose.js +81 -0
- package/{dist → esm}/helpers/decodeAttestationObject.d.ts +3 -0
- package/esm/helpers/decodeAttestationObject.js +13 -0
- package/esm/helpers/decodeAuthenticatorExtensions.js +34 -0
- package/{dist → esm}/helpers/decodeClientDataJSON.d.ts +3 -0
- package/esm/helpers/decodeClientDataJSON.js +13 -0
- package/esm/helpers/decodeCredentialPublicKey.d.ts +5 -0
- package/esm/helpers/decodeCredentialPublicKey.js +8 -0
- package/esm/helpers/fetch.d.ts +8 -0
- package/esm/helpers/fetch.js +12 -0
- package/esm/helpers/generateChallenge.d.ts +7 -0
- package/esm/helpers/generateChallenge.js +21 -0
- package/{dist → esm}/helpers/getCertificateInfo.d.ts +1 -1
- package/esm/helpers/getCertificateInfo.js +76 -0
- package/esm/helpers/index.d.ts +22 -0
- package/esm/helpers/index.js +16 -0
- package/{dist → esm}/helpers/isCertRevoked.d.ts +1 -1
- package/esm/helpers/isCertRevoked.js +98 -0
- package/{dist → esm}/helpers/iso/index.d.ts +4 -4
- package/esm/helpers/iso/index.js +11 -0
- package/esm/helpers/iso/isoBase64URL.js +57 -0
- package/{dist → esm}/helpers/iso/isoCBOR.d.ts +1 -1
- package/esm/helpers/iso/isoCBOR.js +44 -0
- package/{dist → esm}/helpers/iso/isoCrypto/digest.d.ts +1 -1
- package/esm/helpers/iso/isoCrypto/digest.js +14 -0
- package/{dist → esm}/helpers/iso/isoCrypto/getRandomValues.d.ts +1 -1
- package/esm/helpers/iso/isoCrypto/getRandomValues.js +11 -0
- package/esm/helpers/iso/isoCrypto/getWebCrypto.d.ts +6 -0
- package/esm/helpers/iso/isoCrypto/getWebCrypto.js +40 -0
- package/esm/helpers/iso/isoCrypto/importKey.js +8 -0
- package/esm/helpers/iso/isoCrypto/index.d.ts +3 -0
- package/esm/helpers/iso/isoCrypto/index.js +3 -0
- package/{dist → esm}/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts +2 -2
- package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.js +20 -0
- package/{dist → esm}/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts +2 -2
- package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.js +19 -0
- package/esm/helpers/iso/isoCrypto/structs.js +1 -0
- package/esm/helpers/iso/isoCrypto/unwrapEC2Signature.js +30 -0
- package/{dist → esm}/helpers/iso/isoCrypto/verify.d.ts +1 -1
- package/esm/helpers/iso/isoCrypto/verify.js +28 -0
- package/{dist → esm}/helpers/iso/isoCrypto/verifyEC2.d.ts +1 -1
- package/esm/helpers/iso/isoCrypto/verifyEC2.js +73 -0
- package/{dist → esm}/helpers/iso/isoCrypto/verifyOKP.d.ts +1 -1
- package/esm/helpers/iso/isoCrypto/verifyOKP.js +51 -0
- package/{dist → esm}/helpers/iso/isoCrypto/verifyRSA.d.ts +1 -1
- package/esm/helpers/iso/isoCrypto/verifyRSA.js +91 -0
- package/esm/helpers/iso/isoUint8Array.js +75 -0
- package/{dist → esm}/helpers/logging.d.ts +1 -1
- package/esm/helpers/logging.js +19 -0
- package/{dist → esm}/helpers/mapX509SignatureAlgToCOSEAlg.d.ts +1 -1
- package/esm/helpers/mapX509SignatureAlgToCOSEAlg.js +35 -0
- package/esm/helpers/matchExpectedRPID.js +41 -0
- package/{dist → esm}/helpers/parseAuthenticatorData.d.ts +4 -1
- package/esm/helpers/parseAuthenticatorData.js +71 -0
- package/{dist → esm}/helpers/parseBackupFlags.d.ts +4 -1
- package/esm/helpers/parseBackupFlags.js +25 -0
- package/{dist → esm}/helpers/toHash.d.ts +1 -1
- package/esm/helpers/toHash.js +12 -0
- package/esm/helpers/validateCertificatePath.js +122 -0
- package/{dist → esm}/helpers/verifySignature.d.ts +4 -1
- package/esm/helpers/verifySignature.js +32 -0
- package/esm/index.d.ts +17 -0
- package/esm/index.js +11 -0
- package/{dist → esm}/metadata/mdsTypes.d.ts +1 -1
- package/esm/metadata/mdsTypes.js +17 -0
- package/esm/metadata/parseJWT.js +12 -0
- package/{dist → esm}/metadata/verifyAttestationWithMetadata.d.ts +3 -3
- package/esm/metadata/verifyAttestationWithMetadata.js +159 -0
- package/esm/metadata/verifyJWT.js +37 -0
- package/esm/package.json +3 -0
- package/{dist → esm}/registration/generateRegistrationOptions.d.ts +2 -2
- package/esm/registration/generateRegistrationOptions.js +142 -0
- package/esm/registration/verifications/tpm/constants.js +182 -0
- package/esm/registration/verifications/tpm/parseCertInfo.js +58 -0
- package/esm/registration/verifications/tpm/parsePubArea.js +94 -0
- package/{dist → esm}/registration/verifications/tpm/verifyAttestationTPM.d.ts +1 -1
- package/esm/registration/verifications/tpm/verifyAttestationTPM.js +323 -0
- package/{dist → esm}/registration/verifications/verifyAttestationAndroidKey.d.ts +1 -1
- package/esm/registration/verifications/verifyAttestationAndroidKey.js +90 -0
- package/{dist → esm}/registration/verifications/verifyAttestationAndroidSafetyNet.d.ts +1 -1
- package/esm/registration/verifications/verifyAttestationAndroidSafetyNet.js +112 -0
- package/{dist → esm}/registration/verifications/verifyAttestationApple.d.ts +1 -1
- package/esm/registration/verifications/verifyAttestationApple.js +57 -0
- package/{dist → esm}/registration/verifications/verifyAttestationFIDOU2F.d.ts +1 -1
- package/esm/registration/verifications/verifyAttestationFIDOU2F.js +48 -0
- package/{dist → esm}/registration/verifications/verifyAttestationPacked.d.ts +1 -1
- package/esm/registration/verifications/verifyAttestationPacked.js +105 -0
- package/{dist → esm}/registration/verifyRegistrationResponse.d.ts +3 -3
- package/esm/registration/verifyRegistrationResponse.js +198 -0
- package/esm/services/defaultRootCerts/android-key.js +85 -0
- package/esm/services/defaultRootCerts/android-safetynet.js +32 -0
- package/esm/services/defaultRootCerts/apple.js +25 -0
- package/esm/services/defaultRootCerts/mds.js +32 -0
- package/{dist → esm}/services/metadataService.d.ts +1 -1
- package/{dist → esm}/services/metadataService.js +52 -36
- package/{dist → esm}/services/settingsService.d.ts +1 -1
- package/esm/services/settingsService.js +65 -0
- package/package.json +40 -42
- package/script/authentication/generateAuthenticationOptions.d.ts +23 -0
- package/{dist → script}/authentication/generateAuthenticationOptions.js +8 -9
- package/script/authentication/verifyAuthenticationResponse.d.ts +66 -0
- package/{dist → script}/authentication/verifyAuthenticationResponse.js +25 -23
- package/script/deps.d.ts +11 -0
- package/script/deps.js +71 -0
- package/script/helpers/convertAAGUIDToString.d.ts +4 -0
- package/{dist → script}/helpers/convertAAGUIDToString.js +2 -3
- package/script/helpers/convertCOSEtoPKCS.d.ts +4 -0
- package/{dist → script}/helpers/convertCOSEtoPKCS.js +7 -8
- package/script/helpers/convertCertBufferToPEM.d.ts +5 -0
- package/{dist → script}/helpers/convertCertBufferToPEM.js +5 -6
- package/script/helpers/convertPEMToBytes.d.ts +4 -0
- package/{dist → script}/helpers/convertPEMToBytes.js +2 -3
- package/script/helpers/convertX509PublicKeyToCOSE.d.ts +2 -0
- package/{dist → script}/helpers/convertX509PublicKeyToCOSE.js +21 -25
- package/script/helpers/cose.d.ts +98 -0
- package/{dist → script}/helpers/cose.js +1 -1
- package/script/helpers/decodeAttestationObject.d.ts +29 -0
- package/script/helpers/decodeAttestationObject.js +17 -0
- package/script/helpers/decodeAuthenticatorExtensions.d.ts +20 -0
- package/{dist → script}/helpers/decodeAuthenticatorExtensions.js +2 -3
- package/script/helpers/decodeClientDataJSON.d.ts +17 -0
- package/script/helpers/decodeClientDataJSON.js +17 -0
- package/script/helpers/decodeCredentialPublicKey.d.ts +5 -0
- package/script/helpers/decodeCredentialPublicKey.js +12 -0
- package/script/helpers/fetch.d.ts +8 -0
- package/script/helpers/fetch.js +16 -0
- package/script/helpers/generateChallenge.d.ts +7 -0
- package/{dist → script}/helpers/generateChallenge.js +9 -6
- package/script/helpers/getCertificateInfo.d.ts +31 -0
- package/{dist → script}/helpers/getCertificateInfo.js +4 -6
- package/script/helpers/index.d.ts +22 -0
- package/script/helpers/index.js +59 -0
- package/script/helpers/isCertRevoked.d.ts +8 -0
- package/{dist → script}/helpers/isCertRevoked.js +20 -25
- package/script/helpers/iso/index.d.ts +11 -0
- package/{dist → script}/helpers/iso/index.js +4 -5
- package/script/helpers/iso/isoBase64URL.d.ts +37 -0
- package/{dist → script}/helpers/iso/isoBase64URL.js +9 -13
- package/script/helpers/iso/isoCBOR.d.ts +12 -0
- package/{dist → script}/helpers/iso/isoCBOR.js +8 -28
- package/script/helpers/iso/isoCrypto/digest.d.ts +8 -0
- package/script/helpers/iso/isoCrypto/digest.js +18 -0
- package/script/helpers/iso/isoCrypto/getRandomValues.d.ts +6 -0
- package/script/helpers/iso/isoCrypto/getRandomValues.js +15 -0
- package/script/helpers/iso/isoCrypto/getWebCrypto.d.ts +6 -0
- package/script/helpers/iso/isoCrypto/getWebCrypto.js +44 -0
- package/script/helpers/iso/isoCrypto/importKey.d.ts +4 -0
- package/script/helpers/iso/isoCrypto/importKey.js +12 -0
- package/script/helpers/iso/isoCrypto/index.d.ts +3 -0
- package/{dist → script}/helpers/iso/isoCrypto/index.js +6 -7
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts +6 -0
- package/{dist → script}/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.js +6 -6
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts +6 -0
- package/{dist → script}/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.js +5 -6
- package/script/helpers/iso/isoCrypto/structs.d.ts +3 -0
- package/{dist → script}/helpers/iso/isoCrypto/structs.js +0 -1
- package/script/helpers/iso/isoCrypto/unwrapEC2Signature.d.ts +6 -0
- package/{dist → script}/helpers/iso/isoCrypto/unwrapEC2Signature.js +4 -6
- package/script/helpers/iso/isoCrypto/verify.d.ts +10 -0
- package/script/helpers/iso/isoCrypto/verify.js +32 -0
- package/script/helpers/iso/isoCrypto/verifyEC2.d.ts +10 -0
- package/{dist → script}/helpers/iso/isoCrypto/verifyEC2.js +19 -22
- package/script/helpers/iso/isoCrypto/verifyOKP.d.ts +6 -0
- package/{dist → script}/helpers/iso/isoCrypto/verifyOKP.js +13 -16
- package/script/helpers/iso/isoCrypto/verifyRSA.d.ts +10 -0
- package/{dist → script}/helpers/iso/isoCrypto/verifyRSA.js +19 -22
- package/script/helpers/iso/isoUint8Array.d.ts +36 -0
- package/{dist → script}/helpers/iso/isoUint8Array.js +7 -8
- package/script/helpers/logging.d.ts +17 -0
- package/{dist → script}/helpers/logging.js +2 -6
- package/script/helpers/mapX509SignatureAlgToCOSEAlg.d.ts +8 -0
- package/{dist → script}/helpers/mapX509SignatureAlgToCOSEAlg.js +8 -9
- package/script/helpers/matchExpectedRPID.d.ts +7 -0
- package/{dist → script}/helpers/matchExpectedRPID.js +5 -6
- package/script/helpers/parseAuthenticatorData.d.ts +28 -0
- package/{dist → script}/helpers/parseAuthenticatorData.js +19 -16
- package/script/helpers/parseBackupFlags.d.ts +19 -0
- package/{dist → script}/helpers/parseBackupFlags.js +2 -2
- package/script/helpers/toHash.d.ts +6 -0
- package/{dist → script}/helpers/toHash.js +4 -5
- package/script/helpers/validateCertificatePath.d.ts +6 -0
- package/{dist → script}/helpers/validateCertificatePath.js +13 -15
- package/script/helpers/verifySignature.d.ts +14 -0
- package/script/helpers/verifySignature.js +36 -0
- package/script/index.d.ts +17 -0
- package/script/index.js +19 -0
- package/script/metadata/mdsTypes.d.ts +216 -0
- package/{dist → script}/metadata/mdsTypes.js +0 -1
- package/script/metadata/parseJWT.d.ts +4 -0
- package/{dist → script}/metadata/parseJWT.js +3 -4
- package/script/metadata/verifyAttestationWithMetadata.d.ts +29 -0
- package/{dist → script}/metadata/verifyAttestationWithMetadata.js +24 -22
- package/script/metadata/verifyJWT.d.ts +10 -0
- package/script/metadata/verifyJWT.js +41 -0
- package/script/package.json +3 -0
- package/script/registration/generateRegistrationOptions.d.ts +43 -0
- package/{dist → script}/registration/generateRegistrationOptions.js +9 -10
- package/script/registration/verifications/tpm/constants.d.ts +47 -0
- package/{dist → script}/registration/verifications/tpm/constants.js +1 -2
- package/script/registration/verifications/tpm/parseCertInfo.d.ts +24 -0
- package/{dist → script}/registration/verifications/tpm/parseCertInfo.js +13 -14
- package/script/registration/verifications/tpm/parsePubArea.d.ts +43 -0
- package/{dist → script}/registration/verifications/tpm/parsePubArea.js +16 -17
- package/script/registration/verifications/tpm/verifyAttestationTPM.d.ts +2 -0
- package/{dist → script}/registration/verifications/tpm/verifyAttestationTPM.js +58 -58
- package/script/registration/verifications/verifyAttestationAndroidKey.d.ts +5 -0
- package/{dist → script}/registration/verifications/verifyAttestationAndroidKey.js +22 -26
- package/script/registration/verifications/verifyAttestationAndroidSafetyNet.d.ts +5 -0
- package/{dist → script}/registration/verifications/verifyAttestationAndroidSafetyNet.js +22 -23
- package/script/registration/verifications/verifyAttestationApple.d.ts +2 -0
- package/{dist → script}/registration/verifications/verifyAttestationApple.js +15 -17
- package/script/registration/verifications/verifyAttestationFIDOU2F.d.ts +5 -0
- package/{dist → script}/registration/verifications/verifyAttestationFIDOU2F.js +12 -13
- package/script/registration/verifications/verifyAttestationPacked.d.ts +5 -0
- package/{dist → script}/registration/verifications/verifyAttestationPacked.js +17 -18
- package/script/registration/verifyRegistrationResponse.d.ts +85 -0
- package/{dist → script}/registration/verifyRegistrationResponse.js +39 -38
- package/script/services/defaultRootCerts/android-key.d.ts +24 -0
- package/{dist → script}/services/defaultRootCerts/android-key.js +0 -1
- package/script/services/defaultRootCerts/android-safetynet.d.ts +11 -0
- package/{dist → script}/services/defaultRootCerts/android-safetynet.js +0 -1
- package/script/services/defaultRootCerts/apple.d.ts +11 -0
- package/{dist → script}/services/defaultRootCerts/apple.js +0 -1
- package/script/services/defaultRootCerts/mds.d.ts +11 -0
- package/{dist → script}/services/defaultRootCerts/mds.js +0 -1
- package/script/services/metadataService.d.ts +53 -0
- package/script/services/metadataService.js +277 -0
- package/script/services/settingsService.d.ts +25 -0
- package/{dist → script}/services/settingsService.js +21 -13
- package/dist/authentication/generateAuthenticationOptions.js.map +0 -1
- package/dist/authentication/verifyAuthenticationResponse.js.map +0 -1
- package/dist/helpers/convertAAGUIDToString.js.map +0 -1
- package/dist/helpers/convertCOSEtoPKCS.js.map +0 -1
- package/dist/helpers/convertCertBufferToPEM.js.map +0 -1
- package/dist/helpers/convertPEMToBytes.js.map +0 -1
- package/dist/helpers/convertX509PublicKeyToCOSE.js.map +0 -1
- package/dist/helpers/cose.js.map +0 -1
- package/dist/helpers/decodeAttestationObject.js +0 -14
- package/dist/helpers/decodeAttestationObject.js.map +0 -1
- package/dist/helpers/decodeAuthenticatorExtensions.js.map +0 -1
- package/dist/helpers/decodeClientDataJSON.js +0 -14
- package/dist/helpers/decodeClientDataJSON.js.map +0 -1
- package/dist/helpers/decodeCredentialPublicKey.d.ts +0 -2
- package/dist/helpers/decodeCredentialPublicKey.js +0 -9
- package/dist/helpers/decodeCredentialPublicKey.js.map +0 -1
- package/dist/helpers/generateChallenge.d.ts +0 -4
- package/dist/helpers/generateChallenge.js.map +0 -1
- package/dist/helpers/getCertificateInfo.js.map +0 -1
- package/dist/helpers/index.d.ts +0 -22
- package/dist/helpers/index.js +0 -60
- package/dist/helpers/index.js.map +0 -1
- package/dist/helpers/isCertRevoked.js.map +0 -1
- package/dist/helpers/iso/index.js.map +0 -1
- package/dist/helpers/iso/isoBase64URL.js.map +0 -1
- package/dist/helpers/iso/isoCBOR.js.map +0 -1
- package/dist/helpers/iso/isoCrypto/digest.js +0 -21
- package/dist/helpers/iso/isoCrypto/digest.js.map +0 -1
- package/dist/helpers/iso/isoCrypto/getRandomValues.js +0 -18
- package/dist/helpers/iso/isoCrypto/getRandomValues.js.map +0 -1
- package/dist/helpers/iso/isoCrypto/importKey.js +0 -13
- package/dist/helpers/iso/isoCrypto/importKey.js.map +0 -1
- package/dist/helpers/iso/isoCrypto/index.d.ts +0 -3
- package/dist/helpers/iso/isoCrypto/index.js.map +0 -1
- package/dist/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.js.map +0 -1
- package/dist/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.js.map +0 -1
- package/dist/helpers/iso/isoCrypto/structs.js.map +0 -1
- package/dist/helpers/iso/isoCrypto/unwrapEC2Signature.js.map +0 -1
- package/dist/helpers/iso/isoCrypto/verify.js +0 -28
- package/dist/helpers/iso/isoCrypto/verify.js.map +0 -1
- package/dist/helpers/iso/isoCrypto/verifyEC2.js.map +0 -1
- package/dist/helpers/iso/isoCrypto/verifyOKP.js.map +0 -1
- package/dist/helpers/iso/isoCrypto/verifyRSA.js.map +0 -1
- package/dist/helpers/iso/isoUint8Array.js.map +0 -1
- package/dist/helpers/logging.js.map +0 -1
- package/dist/helpers/mapX509SignatureAlgToCOSEAlg.js.map +0 -1
- package/dist/helpers/matchExpectedRPID.js.map +0 -1
- package/dist/helpers/parseAuthenticatorData.js.map +0 -1
- package/dist/helpers/parseBackupFlags.js.map +0 -1
- package/dist/helpers/toHash.js.map +0 -1
- package/dist/helpers/validateCertificatePath.js.map +0 -1
- package/dist/helpers/verifySignature.js +0 -33
- package/dist/helpers/verifySignature.js.map +0 -1
- package/dist/index.d.ts +0 -17
- package/dist/index.js +0 -20
- package/dist/index.js.map +0 -1
- package/dist/metadata/mdsTypes.js.map +0 -1
- package/dist/metadata/parseJWT.js.map +0 -1
- package/dist/metadata/verifyAttestationWithMetadata.js.map +0 -1
- package/dist/metadata/verifyJWT.js +0 -42
- package/dist/metadata/verifyJWT.js.map +0 -1
- package/dist/registration/generateRegistrationOptions.js.map +0 -1
- package/dist/registration/verifications/tpm/constants.js.map +0 -1
- package/dist/registration/verifications/tpm/parseCertInfo.js.map +0 -1
- package/dist/registration/verifications/tpm/parsePubArea.js.map +0 -1
- package/dist/registration/verifications/tpm/verifyAttestationTPM.js.map +0 -1
- package/dist/registration/verifications/verifyAttestationAndroidKey.js.map +0 -1
- package/dist/registration/verifications/verifyAttestationAndroidSafetyNet.js.map +0 -1
- package/dist/registration/verifications/verifyAttestationApple.js.map +0 -1
- package/dist/registration/verifications/verifyAttestationFIDOU2F.js.map +0 -1
- package/dist/registration/verifications/verifyAttestationPacked.js.map +0 -1
- package/dist/registration/verifyRegistrationResponse.js.map +0 -1
- package/dist/services/defaultRootCerts/android-key.js.map +0 -1
- package/dist/services/defaultRootCerts/android-safetynet.js.map +0 -1
- package/dist/services/defaultRootCerts/apple.js.map +0 -1
- package/dist/services/defaultRootCerts/mds.js.map +0 -1
- package/dist/services/metadataService.js.map +0 -1
- package/dist/services/settingsService.js.map +0 -1
- /package/{dist → esm}/helpers/convertAAGUIDToString.d.ts +0 -0
- /package/{dist → esm}/helpers/convertCOSEtoPKCS.d.ts +0 -0
- /package/{dist → esm}/helpers/convertPEMToBytes.d.ts +0 -0
- /package/{dist → esm}/helpers/decodeAuthenticatorExtensions.d.ts +0 -0
- /package/{dist → esm}/helpers/iso/isoBase64URL.d.ts +0 -0
- /package/{dist → esm}/helpers/iso/isoCrypto/importKey.d.ts +0 -0
- /package/{dist → esm}/helpers/iso/isoCrypto/structs.d.ts +0 -0
- /package/{dist → esm}/helpers/iso/isoCrypto/unwrapEC2Signature.d.ts +0 -0
- /package/{dist → esm}/helpers/iso/isoUint8Array.d.ts +0 -0
- /package/{dist → esm}/helpers/matchExpectedRPID.d.ts +0 -0
- /package/{dist → esm}/helpers/validateCertificatePath.d.ts +0 -0
- /package/{dist → esm}/metadata/parseJWT.d.ts +0 -0
- /package/{dist → esm}/metadata/verifyJWT.d.ts +0 -0
- /package/{dist → esm}/registration/verifications/tpm/constants.d.ts +0 -0
- /package/{dist → esm}/registration/verifications/tpm/parseCertInfo.d.ts +0 -0
- /package/{dist → esm}/registration/verifications/tpm/parsePubArea.d.ts +0 -0
- /package/{dist → esm}/services/defaultRootCerts/android-key.d.ts +0 -0
- /package/{dist → esm}/services/defaultRootCerts/android-safetynet.d.ts +0 -0
- /package/{dist → esm}/services/defaultRootCerts/apple.d.ts +0 -0
- /package/{dist → esm}/services/defaultRootCerts/mds.d.ts +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="debug" />
|
|
2
|
+
import { Debugger } from '../deps.js';
|
|
3
|
+
/**
|
|
4
|
+
* Generate an instance of a `debug` logger that extends off of the "simplewebauthn" namespace for
|
|
5
|
+
* consistent naming.
|
|
6
|
+
*
|
|
7
|
+
* See https://www.npmjs.com/package/debug for information on how to control logging output when
|
|
8
|
+
* using @simplewebauthn/server
|
|
9
|
+
*
|
|
10
|
+
* Example:
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
* const log = getLogger('mds');
|
|
14
|
+
* log('hello'); // simplewebauthn:mds hello +0ms
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function getLogger(name: string): Debugger;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getLogger = void 0;
|
|
7
|
-
const
|
|
8
|
-
const defaultLogger = (0,
|
|
4
|
+
const deps_js_1 = require("../deps.js");
|
|
5
|
+
const defaultLogger = (0, deps_js_1.debug)('SimpleWebAuthn');
|
|
9
6
|
/**
|
|
10
7
|
* Generate an instance of a `debug` logger that extends off of the "simplewebauthn" namespace for
|
|
11
8
|
* consistent naming.
|
|
@@ -24,4 +21,3 @@ function getLogger(name) {
|
|
|
24
21
|
return defaultLogger.extend(name);
|
|
25
22
|
}
|
|
26
23
|
exports.getLogger = getLogger;
|
|
27
|
-
//# sourceMappingURL=logging.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { COSEALG } from './cose.js';
|
|
2
|
+
/**
|
|
3
|
+
* Map X.509 signature algorithm OIDs to COSE algorithm IDs
|
|
4
|
+
*
|
|
5
|
+
* - EC2 OIDs: https://oidref.com/1.2.840.10045.4.3
|
|
6
|
+
* - RSA OIDs: https://oidref.com/1.2.840.113549.1.1
|
|
7
|
+
*/
|
|
8
|
+
export declare function mapX509SignatureAlgToCOSEAlg(signatureAlgorithm: string): COSEALG;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mapX509SignatureAlgToCOSEAlg = void 0;
|
|
4
|
-
const
|
|
4
|
+
const cose_js_1 = require("./cose.js");
|
|
5
5
|
/**
|
|
6
6
|
* Map X.509 signature algorithm OIDs to COSE algorithm IDs
|
|
7
7
|
*
|
|
@@ -11,25 +11,25 @@ const cose_1 = require("./cose");
|
|
|
11
11
|
function mapX509SignatureAlgToCOSEAlg(signatureAlgorithm) {
|
|
12
12
|
let alg;
|
|
13
13
|
if (signatureAlgorithm === '1.2.840.10045.4.3.2') {
|
|
14
|
-
alg =
|
|
14
|
+
alg = cose_js_1.COSEALG.ES256;
|
|
15
15
|
}
|
|
16
16
|
else if (signatureAlgorithm === '1.2.840.10045.4.3.3') {
|
|
17
|
-
alg =
|
|
17
|
+
alg = cose_js_1.COSEALG.ES384;
|
|
18
18
|
}
|
|
19
19
|
else if (signatureAlgorithm === '1.2.840.10045.4.3.4') {
|
|
20
|
-
alg =
|
|
20
|
+
alg = cose_js_1.COSEALG.ES512;
|
|
21
21
|
}
|
|
22
22
|
else if (signatureAlgorithm === '1.2.840.113549.1.1.11') {
|
|
23
|
-
alg =
|
|
23
|
+
alg = cose_js_1.COSEALG.RS256;
|
|
24
24
|
}
|
|
25
25
|
else if (signatureAlgorithm === '1.2.840.113549.1.1.12') {
|
|
26
|
-
alg =
|
|
26
|
+
alg = cose_js_1.COSEALG.RS384;
|
|
27
27
|
}
|
|
28
28
|
else if (signatureAlgorithm === '1.2.840.113549.1.1.13') {
|
|
29
|
-
alg =
|
|
29
|
+
alg = cose_js_1.COSEALG.RS512;
|
|
30
30
|
}
|
|
31
31
|
else if (signatureAlgorithm === '1.2.840.113549.1.1.5') {
|
|
32
|
-
alg =
|
|
32
|
+
alg = cose_js_1.COSEALG.RS1;
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
35
|
throw new Error(`Unable to map X.509 signature algorithm ${signatureAlgorithm} to a COSE algorithm`);
|
|
@@ -37,4 +37,3 @@ function mapX509SignatureAlgToCOSEAlg(signatureAlgorithm) {
|
|
|
37
37
|
return alg;
|
|
38
38
|
}
|
|
39
39
|
exports.mapX509SignatureAlgToCOSEAlg = mapX509SignatureAlgToCOSEAlg;
|
|
40
|
-
//# sourceMappingURL=mapX509SignatureAlgToCOSEAlg.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Go through each expected RP ID and try to find one that matches. Returns the unhashed RP ID
|
|
3
|
+
* that matched the hash in the response.
|
|
4
|
+
*
|
|
5
|
+
* Raises an `UnexpectedRPIDHash` error if no match is found
|
|
6
|
+
*/
|
|
7
|
+
export declare function matchExpectedRPID(rpIDHash: Uint8Array, expectedRPIDs: string[]): Promise<string>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.matchExpectedRPID = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const toHash_js_1 = require("./toHash.js");
|
|
5
|
+
const index_js_1 = require("./iso/index.js");
|
|
6
6
|
/**
|
|
7
7
|
* Go through each expected RP ID and try to find one that matches. Returns the unhashed RP ID
|
|
8
8
|
* that matched the hash in the response.
|
|
@@ -11,10 +11,10 @@ const iso_1 = require("./iso");
|
|
|
11
11
|
*/
|
|
12
12
|
async function matchExpectedRPID(rpIDHash, expectedRPIDs) {
|
|
13
13
|
try {
|
|
14
|
-
const matchedRPID = await Promise.any(expectedRPIDs.map(expected => {
|
|
14
|
+
const matchedRPID = await Promise.any(expectedRPIDs.map((expected) => {
|
|
15
15
|
return new Promise((resolve, reject) => {
|
|
16
|
-
(0,
|
|
17
|
-
if (
|
|
16
|
+
(0, toHash_js_1.toHash)(index_js_1.isoUint8Array.fromASCIIString(expected)).then((expectedRPIDHash) => {
|
|
17
|
+
if (index_js_1.isoUint8Array.areEqual(rpIDHash, expectedRPIDHash)) {
|
|
18
18
|
resolve(expected);
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
@@ -43,4 +43,3 @@ class UnexpectedRPIDHash extends Error {
|
|
|
43
43
|
this.name = 'UnexpectedRPIDHash';
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
//# sourceMappingURL=matchExpectedRPID.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AuthenticationExtensionsAuthenticatorOutputs } from './decodeAuthenticatorExtensions.js';
|
|
2
|
+
/**
|
|
3
|
+
* Make sense of the authData buffer contained in an Attestation
|
|
4
|
+
*/
|
|
5
|
+
export declare function parseAuthenticatorData(authData: Uint8Array): ParsedAuthenticatorData;
|
|
6
|
+
export type ParsedAuthenticatorData = {
|
|
7
|
+
rpIdHash: Uint8Array;
|
|
8
|
+
flagsBuf: Uint8Array;
|
|
9
|
+
flags: {
|
|
10
|
+
up: boolean;
|
|
11
|
+
uv: boolean;
|
|
12
|
+
be: boolean;
|
|
13
|
+
bs: boolean;
|
|
14
|
+
at: boolean;
|
|
15
|
+
ed: boolean;
|
|
16
|
+
flagsInt: number;
|
|
17
|
+
};
|
|
18
|
+
counter: number;
|
|
19
|
+
counterBuf: Uint8Array;
|
|
20
|
+
aaguid?: Uint8Array;
|
|
21
|
+
credentialID?: Uint8Array;
|
|
22
|
+
credentialPublicKey?: Uint8Array;
|
|
23
|
+
extensionsData?: AuthenticationExtensionsAuthenticatorOutputs;
|
|
24
|
+
extensionsDataBuffer?: Uint8Array;
|
|
25
|
+
};
|
|
26
|
+
export declare const _parseAuthenticatorDataInternals: {
|
|
27
|
+
stubThis: (value: ParsedAuthenticatorData) => ParsedAuthenticatorData;
|
|
28
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseAuthenticatorData = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
3
|
+
exports._parseAuthenticatorDataInternals = exports.parseAuthenticatorData = void 0;
|
|
4
|
+
const decodeAuthenticatorExtensions_js_1 = require("./decodeAuthenticatorExtensions.js");
|
|
5
|
+
const index_js_1 = require("./iso/index.js");
|
|
6
6
|
/**
|
|
7
7
|
* Make sense of the authData buffer contained in an Attestation
|
|
8
8
|
*/
|
|
@@ -11,9 +11,9 @@ function parseAuthenticatorData(authData) {
|
|
|
11
11
|
throw new Error(`Authenticator data was ${authData.byteLength} bytes, expected at least 37 bytes`);
|
|
12
12
|
}
|
|
13
13
|
let pointer = 0;
|
|
14
|
-
const dataView =
|
|
15
|
-
const rpIdHash = authData.slice(pointer,
|
|
16
|
-
const flagsBuf = authData.slice(pointer,
|
|
14
|
+
const dataView = index_js_1.isoUint8Array.toDataView(authData);
|
|
15
|
+
const rpIdHash = authData.slice(pointer, pointer += 32);
|
|
16
|
+
const flagsBuf = authData.slice(pointer, pointer += 1);
|
|
17
17
|
const flagsInt = flagsBuf[0];
|
|
18
18
|
// Bit positions can be referenced here:
|
|
19
19
|
// https://www.w3.org/TR/webauthn-2/#flags
|
|
@@ -33,29 +33,29 @@ function parseAuthenticatorData(authData) {
|
|
|
33
33
|
let credentialID = undefined;
|
|
34
34
|
let credentialPublicKey = undefined;
|
|
35
35
|
if (flags.at) {
|
|
36
|
-
aaguid = authData.slice(pointer,
|
|
36
|
+
aaguid = authData.slice(pointer, pointer += 16);
|
|
37
37
|
const credIDLen = dataView.getUint16(pointer);
|
|
38
38
|
pointer += 2;
|
|
39
|
-
credentialID = authData.slice(pointer,
|
|
39
|
+
credentialID = authData.slice(pointer, pointer += credIDLen);
|
|
40
40
|
// Decode the next CBOR item in the buffer, then re-encode it back to a Buffer
|
|
41
|
-
const firstDecoded =
|
|
42
|
-
const firstEncoded = Uint8Array.from(
|
|
41
|
+
const firstDecoded = index_js_1.isoCBOR.decodeFirst(authData.slice(pointer));
|
|
42
|
+
const firstEncoded = Uint8Array.from(index_js_1.isoCBOR.encode(firstDecoded));
|
|
43
43
|
credentialPublicKey = firstEncoded;
|
|
44
44
|
pointer += firstEncoded.byteLength;
|
|
45
45
|
}
|
|
46
46
|
let extensionsData = undefined;
|
|
47
47
|
let extensionsDataBuffer = undefined;
|
|
48
48
|
if (flags.ed) {
|
|
49
|
-
const firstDecoded =
|
|
50
|
-
extensionsDataBuffer = Uint8Array.from(
|
|
51
|
-
extensionsData = (0,
|
|
49
|
+
const firstDecoded = index_js_1.isoCBOR.decodeFirst(authData.slice(pointer));
|
|
50
|
+
extensionsDataBuffer = Uint8Array.from(index_js_1.isoCBOR.encode(firstDecoded));
|
|
51
|
+
extensionsData = (0, decodeAuthenticatorExtensions_js_1.decodeAuthenticatorExtensions)(extensionsDataBuffer);
|
|
52
52
|
pointer += extensionsDataBuffer.byteLength;
|
|
53
53
|
}
|
|
54
54
|
// Pointer should be at the end of the authenticator data, otherwise too much data was sent
|
|
55
55
|
if (authData.byteLength > pointer) {
|
|
56
56
|
throw new Error('Leftover bytes detected while parsing authenticator data');
|
|
57
57
|
}
|
|
58
|
-
return {
|
|
58
|
+
return exports._parseAuthenticatorDataInternals.stubThis({
|
|
59
59
|
rpIdHash,
|
|
60
60
|
flagsBuf,
|
|
61
61
|
flags,
|
|
@@ -66,7 +66,10 @@ function parseAuthenticatorData(authData) {
|
|
|
66
66
|
credentialPublicKey,
|
|
67
67
|
extensionsData,
|
|
68
68
|
extensionsDataBuffer,
|
|
69
|
-
};
|
|
69
|
+
});
|
|
70
70
|
}
|
|
71
71
|
exports.parseAuthenticatorData = parseAuthenticatorData;
|
|
72
|
-
|
|
72
|
+
// Make it possible to stub the return value during testing
|
|
73
|
+
exports._parseAuthenticatorDataInternals = {
|
|
74
|
+
stubThis: (value) => value,
|
|
75
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CredentialDeviceType } from '../deps.js';
|
|
2
|
+
/**
|
|
3
|
+
* Make sense of Bits 3 and 4 in authenticator indicating:
|
|
4
|
+
*
|
|
5
|
+
* - Whether the credential can be used on multiple devices
|
|
6
|
+
* - Whether the credential is backed up or not
|
|
7
|
+
*
|
|
8
|
+
* Invalid configurations will raise an `Error`
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseBackupFlags({ be, bs }: {
|
|
11
|
+
be: boolean;
|
|
12
|
+
bs: boolean;
|
|
13
|
+
}): {
|
|
14
|
+
credentialDeviceType: CredentialDeviceType;
|
|
15
|
+
credentialBackedUp: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare class InvalidBackupFlags extends Error {
|
|
18
|
+
constructor(message: string);
|
|
19
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseBackupFlags = void 0;
|
|
3
|
+
exports.InvalidBackupFlags = exports.parseBackupFlags = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Make sense of Bits 3 and 4 in authenticator indicating:
|
|
6
6
|
*
|
|
@@ -27,4 +27,4 @@ class InvalidBackupFlags extends Error {
|
|
|
27
27
|
this.name = 'InvalidBackupFlags';
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
exports.InvalidBackupFlags = InvalidBackupFlags;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toHash = void 0;
|
|
4
|
-
const
|
|
4
|
+
const index_js_1 = require("./iso/index.js");
|
|
5
5
|
/**
|
|
6
6
|
* Returns hash digest of the given data, using the given algorithm when provided. Defaults to using
|
|
7
7
|
* SHA-256.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
function toHash(data, algorithm = -7) {
|
|
10
10
|
if (typeof data === 'string') {
|
|
11
|
-
data =
|
|
11
|
+
data = index_js_1.isoUint8Array.fromUTF8String(data);
|
|
12
12
|
}
|
|
13
|
-
const digest =
|
|
13
|
+
const digest = index_js_1.isoCrypto.digest(data, algorithm);
|
|
14
14
|
return digest;
|
|
15
15
|
}
|
|
16
16
|
exports.toHash = toHash;
|
|
17
|
-
//# sourceMappingURL=toHash.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Traverse an array of PEM certificates and ensure they form a proper chain
|
|
3
|
+
* @param certificates Typically the result of `x5c.map(convertASN1toPEM)`
|
|
4
|
+
* @param rootCertificates Possible root certificates to complete the path
|
|
5
|
+
*/
|
|
6
|
+
export declare function validateCertificatePath(certificates: string[], rootCertificates?: string[]): Promise<boolean>;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateCertificatePath = void 0;
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const convertPEMToBytes_1 = require("./convertPEMToBytes");
|
|
4
|
+
const deps_js_1 = require("../deps.js");
|
|
5
|
+
const isCertRevoked_js_1 = require("./isCertRevoked.js");
|
|
6
|
+
const verifySignature_js_1 = require("./verifySignature.js");
|
|
7
|
+
const mapX509SignatureAlgToCOSEAlg_js_1 = require("./mapX509SignatureAlgToCOSEAlg.js");
|
|
8
|
+
const getCertificateInfo_js_1 = require("./getCertificateInfo.js");
|
|
9
|
+
const convertPEMToBytes_js_1 = require("./convertPEMToBytes.js");
|
|
11
10
|
/**
|
|
12
11
|
* Traverse an array of PEM certificates and ensure they form a proper chain
|
|
13
12
|
* @param certificates Typically the result of `x5c.map(convertASN1toPEM)`
|
|
@@ -69,11 +68,11 @@ async function _validatePath(certificates) {
|
|
|
69
68
|
else {
|
|
70
69
|
issuerPem = certificates[i + 1];
|
|
71
70
|
}
|
|
72
|
-
const subjectInfo = (0,
|
|
73
|
-
const issuerInfo = (0,
|
|
71
|
+
const subjectInfo = (0, getCertificateInfo_js_1.getCertificateInfo)((0, convertPEMToBytes_js_1.convertPEMToBytes)(subjectPem));
|
|
72
|
+
const issuerInfo = (0, getCertificateInfo_js_1.getCertificateInfo)((0, convertPEMToBytes_js_1.convertPEMToBytes)(issuerPem));
|
|
74
73
|
const x509Subject = subjectInfo.parsedCertificate;
|
|
75
74
|
// Check for certificate revocation
|
|
76
|
-
const subjectCertRevoked = await (0,
|
|
75
|
+
const subjectCertRevoked = await (0, isCertRevoked_js_1.isCertRevoked)(x509Subject);
|
|
77
76
|
if (subjectCertRevoked) {
|
|
78
77
|
throw new Error(`Found revoked certificate in certificate path`);
|
|
79
78
|
}
|
|
@@ -95,11 +94,11 @@ async function _validatePath(certificates) {
|
|
|
95
94
|
throw new InvalidSubjectAndIssuer();
|
|
96
95
|
}
|
|
97
96
|
// Verify the subject certificate's signature with the issuer cert's public key
|
|
98
|
-
const data =
|
|
97
|
+
const data = deps_js_1.AsnSerializer.serialize(x509Subject.tbsCertificate);
|
|
99
98
|
const signature = x509Subject.signatureValue;
|
|
100
|
-
const signatureAlgorithm = (0,
|
|
101
|
-
const issuerCertBytes = (0,
|
|
102
|
-
const verified = await (0,
|
|
99
|
+
const signatureAlgorithm = (0, mapX509SignatureAlgToCOSEAlg_js_1.mapX509SignatureAlgToCOSEAlg)(x509Subject.signatureAlgorithm.algorithm);
|
|
100
|
+
const issuerCertBytes = (0, convertPEMToBytes_js_1.convertPEMToBytes)(issuerPem);
|
|
101
|
+
const verified = await (0, verifySignature_js_1.verifySignature)({
|
|
103
102
|
data: new Uint8Array(data),
|
|
104
103
|
signature: new Uint8Array(signature),
|
|
105
104
|
x509Certificate: issuerCertBytes,
|
|
@@ -125,4 +124,3 @@ class CertificateNotYetValidOrExpired extends Error {
|
|
|
125
124
|
this.name = 'CertificateNotYetValidOrExpired';
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
|
-
//# sourceMappingURL=validateCertificatePath.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { COSEALG } from './cose.js';
|
|
2
|
+
/**
|
|
3
|
+
* Verify an authenticator's signature
|
|
4
|
+
*/
|
|
5
|
+
export declare function verifySignature(opts: {
|
|
6
|
+
signature: Uint8Array;
|
|
7
|
+
data: Uint8Array;
|
|
8
|
+
credentialPublicKey?: Uint8Array;
|
|
9
|
+
x509Certificate?: Uint8Array;
|
|
10
|
+
hashAlgorithm?: COSEALG;
|
|
11
|
+
}): Promise<boolean>;
|
|
12
|
+
export declare const _verifySignatureInternals: {
|
|
13
|
+
stubThis: (value: Promise<boolean>) => Promise<boolean>;
|
|
14
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._verifySignatureInternals = exports.verifySignature = void 0;
|
|
4
|
+
const index_js_1 = require("./iso/index.js");
|
|
5
|
+
const decodeCredentialPublicKey_js_1 = require("./decodeCredentialPublicKey.js");
|
|
6
|
+
const convertX509PublicKeyToCOSE_js_1 = require("./convertX509PublicKeyToCOSE.js");
|
|
7
|
+
/**
|
|
8
|
+
* Verify an authenticator's signature
|
|
9
|
+
*/
|
|
10
|
+
function verifySignature(opts) {
|
|
11
|
+
const { signature, data, credentialPublicKey, x509Certificate, hashAlgorithm, } = opts;
|
|
12
|
+
if (!x509Certificate && !credentialPublicKey) {
|
|
13
|
+
throw new Error('Must declare either "leafCert" or "credentialPublicKey"');
|
|
14
|
+
}
|
|
15
|
+
if (x509Certificate && credentialPublicKey) {
|
|
16
|
+
throw new Error('Must not declare both "leafCert" and "credentialPublicKey"');
|
|
17
|
+
}
|
|
18
|
+
let cosePublicKey = new Map();
|
|
19
|
+
if (credentialPublicKey) {
|
|
20
|
+
cosePublicKey = (0, decodeCredentialPublicKey_js_1.decodeCredentialPublicKey)(credentialPublicKey);
|
|
21
|
+
}
|
|
22
|
+
else if (x509Certificate) {
|
|
23
|
+
cosePublicKey = (0, convertX509PublicKeyToCOSE_js_1.convertX509PublicKeyToCOSE)(x509Certificate);
|
|
24
|
+
}
|
|
25
|
+
return exports._verifySignatureInternals.stubThis(index_js_1.isoCrypto.verify({
|
|
26
|
+
cosePublicKey,
|
|
27
|
+
signature,
|
|
28
|
+
data,
|
|
29
|
+
shaHashOverride: hashAlgorithm,
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
exports.verifySignature = verifySignature;
|
|
33
|
+
// Make it possible to stub the return value during testing
|
|
34
|
+
exports._verifySignatureInternals = {
|
|
35
|
+
stubThis: (value) => value,
|
|
36
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @module @simplewebauthn/server
|
|
4
|
+
*/
|
|
5
|
+
import { generateRegistrationOptions } from './registration/generateRegistrationOptions.js';
|
|
6
|
+
import { verifyRegistrationResponse } from './registration/verifyRegistrationResponse.js';
|
|
7
|
+
import { generateAuthenticationOptions } from './authentication/generateAuthenticationOptions.js';
|
|
8
|
+
import { verifyAuthenticationResponse } from './authentication/verifyAuthenticationResponse.js';
|
|
9
|
+
import { MetadataService } from './services/metadataService.js';
|
|
10
|
+
import { SettingsService } from './services/settingsService.js';
|
|
11
|
+
export { generateAuthenticationOptions, generateRegistrationOptions, MetadataService, SettingsService, verifyAuthenticationResponse, verifyRegistrationResponse, };
|
|
12
|
+
import type { GenerateRegistrationOptionsOpts } from './registration/generateRegistrationOptions.js';
|
|
13
|
+
import type { GenerateAuthenticationOptionsOpts } from './authentication/generateAuthenticationOptions.js';
|
|
14
|
+
import type { MetadataStatement } from './metadata/mdsTypes.js';
|
|
15
|
+
import type { VerifiedRegistrationResponse, VerifyRegistrationResponseOpts } from './registration/verifyRegistrationResponse.js';
|
|
16
|
+
import type { VerifiedAuthenticationResponse, VerifyAuthenticationResponseOpts } from './authentication/verifyAuthenticationResponse.js';
|
|
17
|
+
export type { GenerateAuthenticationOptionsOpts, GenerateRegistrationOptionsOpts, MetadataStatement, VerifiedAuthenticationResponse, VerifiedRegistrationResponse, VerifyAuthenticationResponseOpts, VerifyRegistrationResponseOpts, };
|
package/script/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyRegistrationResponse = exports.verifyAuthenticationResponse = exports.SettingsService = exports.MetadataService = exports.generateRegistrationOptions = exports.generateAuthenticationOptions = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
* @module @simplewebauthn/server
|
|
7
|
+
*/
|
|
8
|
+
const generateRegistrationOptions_js_1 = require("./registration/generateRegistrationOptions.js");
|
|
9
|
+
Object.defineProperty(exports, "generateRegistrationOptions", { enumerable: true, get: function () { return generateRegistrationOptions_js_1.generateRegistrationOptions; } });
|
|
10
|
+
const verifyRegistrationResponse_js_1 = require("./registration/verifyRegistrationResponse.js");
|
|
11
|
+
Object.defineProperty(exports, "verifyRegistrationResponse", { enumerable: true, get: function () { return verifyRegistrationResponse_js_1.verifyRegistrationResponse; } });
|
|
12
|
+
const generateAuthenticationOptions_js_1 = require("./authentication/generateAuthenticationOptions.js");
|
|
13
|
+
Object.defineProperty(exports, "generateAuthenticationOptions", { enumerable: true, get: function () { return generateAuthenticationOptions_js_1.generateAuthenticationOptions; } });
|
|
14
|
+
const verifyAuthenticationResponse_js_1 = require("./authentication/verifyAuthenticationResponse.js");
|
|
15
|
+
Object.defineProperty(exports, "verifyAuthenticationResponse", { enumerable: true, get: function () { return verifyAuthenticationResponse_js_1.verifyAuthenticationResponse; } });
|
|
16
|
+
const metadataService_js_1 = require("./services/metadataService.js");
|
|
17
|
+
Object.defineProperty(exports, "MetadataService", { enumerable: true, get: function () { return metadataService_js_1.MetadataService; } });
|
|
18
|
+
const settingsService_js_1 = require("./services/settingsService.js");
|
|
19
|
+
Object.defineProperty(exports, "SettingsService", { enumerable: true, get: function () { return settingsService_js_1.SettingsService; } });
|