@simplewebauthn/server 7.4.0 → 8.0.0-alpha.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 +6 -2
- 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 +10 -0
- package/esm/deps.js +12 -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 -45
- 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 +10 -0
- package/script/deps.js +68 -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 +0 -1
- 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,216 @@
|
|
|
1
|
+
import type { Base64URLString } from '../deps.js';
|
|
2
|
+
/**
|
|
3
|
+
* Metadata Service structures
|
|
4
|
+
* https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html
|
|
5
|
+
*/
|
|
6
|
+
export type MDSJWTHeader = {
|
|
7
|
+
alg: string;
|
|
8
|
+
typ: string;
|
|
9
|
+
x5c: Base64URLString[];
|
|
10
|
+
};
|
|
11
|
+
export type MDSJWTPayload = {
|
|
12
|
+
legalHeader: string;
|
|
13
|
+
no: number;
|
|
14
|
+
nextUpdate: string;
|
|
15
|
+
entries: MetadataBLOBPayloadEntry[];
|
|
16
|
+
};
|
|
17
|
+
export type MetadataBLOBPayloadEntry = {
|
|
18
|
+
aaid?: string;
|
|
19
|
+
aaguid?: string;
|
|
20
|
+
attestationCertificateKeyIdentifiers?: string[];
|
|
21
|
+
metadataStatement?: MetadataStatement;
|
|
22
|
+
biometricStatusReports?: BiometricStatusReport[];
|
|
23
|
+
statusReports: StatusReport[];
|
|
24
|
+
timeOfLastStatusChange: string;
|
|
25
|
+
rogueListURL?: string;
|
|
26
|
+
rogueListHash?: string;
|
|
27
|
+
};
|
|
28
|
+
export type BiometricStatusReport = {
|
|
29
|
+
certLevel: number;
|
|
30
|
+
modality: UserVerify;
|
|
31
|
+
effectiveDate?: string;
|
|
32
|
+
certificationDescriptor?: string;
|
|
33
|
+
certificateNumber?: string;
|
|
34
|
+
certificationPolicyVersion?: string;
|
|
35
|
+
certificationRequirementsVersion?: string;
|
|
36
|
+
};
|
|
37
|
+
export type StatusReport = {
|
|
38
|
+
status: AuthenticatorStatus;
|
|
39
|
+
effectiveDate?: string;
|
|
40
|
+
authenticatorVersion?: number;
|
|
41
|
+
certificate?: string;
|
|
42
|
+
url?: string;
|
|
43
|
+
certificationDescriptor?: string;
|
|
44
|
+
certificateNumber?: string;
|
|
45
|
+
certificationPolicyVersion?: string;
|
|
46
|
+
certificationRequirementsVersion?: string;
|
|
47
|
+
};
|
|
48
|
+
export type AuthenticatorStatus = 'NOT_FIDO_CERTIFIED' | 'FIDO_CERTIFIED' | 'USER_VERIFICATION_BYPASS' | 'ATTESTATION_KEY_COMPROMISE' | 'USER_KEY_REMOTE_COMPROMISE' | 'USER_KEY_PHYSICAL_COMPROMISE' | 'UPDATE_AVAILABLE' | 'REVOKED' | 'SELF_ASSERTION_SUBMITTED' | 'FIDO_CERTIFIED_L1' | 'FIDO_CERTIFIED_L1plus' | 'FIDO_CERTIFIED_L2' | 'FIDO_CERTIFIED_L2plus' | 'FIDO_CERTIFIED_L3' | 'FIDO_CERTIFIED_L3plus';
|
|
49
|
+
/**
|
|
50
|
+
* Types defined in the FIDO Metadata Statement spec
|
|
51
|
+
*
|
|
52
|
+
* See https://fidoalliance.org/specs/mds/fido-metadata-statement-v3.0-ps-20210518.html
|
|
53
|
+
*/
|
|
54
|
+
export type CodeAccuracyDescriptor = {
|
|
55
|
+
base: number;
|
|
56
|
+
minLength: number;
|
|
57
|
+
maxRetries?: number;
|
|
58
|
+
blockSlowdown?: number;
|
|
59
|
+
};
|
|
60
|
+
export type BiometricAccuracyDescriptor = {
|
|
61
|
+
selfAttestedFRR?: number;
|
|
62
|
+
selfAttestedFAR?: number;
|
|
63
|
+
maxTemplates?: number;
|
|
64
|
+
maxRetries?: number;
|
|
65
|
+
blockSlowdown?: number;
|
|
66
|
+
};
|
|
67
|
+
export type PatternAccuracyDescriptor = {
|
|
68
|
+
minComplexity: number;
|
|
69
|
+
maxRetries?: number;
|
|
70
|
+
blockSlowdown?: number;
|
|
71
|
+
};
|
|
72
|
+
export type VerificationMethodDescriptor = {
|
|
73
|
+
userVerificationMethod: UserVerify;
|
|
74
|
+
caDesc?: CodeAccuracyDescriptor;
|
|
75
|
+
baDesc?: BiometricAccuracyDescriptor;
|
|
76
|
+
paDesc?: PatternAccuracyDescriptor;
|
|
77
|
+
};
|
|
78
|
+
export type VerificationMethodANDCombinations = VerificationMethodDescriptor[];
|
|
79
|
+
export type rgbPaletteEntry = {
|
|
80
|
+
r: number;
|
|
81
|
+
g: number;
|
|
82
|
+
b: number;
|
|
83
|
+
};
|
|
84
|
+
export type DisplayPNGCharacteristicsDescriptor = {
|
|
85
|
+
width: number;
|
|
86
|
+
height: number;
|
|
87
|
+
bitDepth: number;
|
|
88
|
+
colorType: number;
|
|
89
|
+
compression: number;
|
|
90
|
+
filter: number;
|
|
91
|
+
interlace: number;
|
|
92
|
+
plte?: rgbPaletteEntry[];
|
|
93
|
+
};
|
|
94
|
+
export type EcdaaTrustAnchor = {
|
|
95
|
+
X: string;
|
|
96
|
+
Y: string;
|
|
97
|
+
c: string;
|
|
98
|
+
sx: string;
|
|
99
|
+
sy: string;
|
|
100
|
+
G1Curve: string;
|
|
101
|
+
};
|
|
102
|
+
export type ExtensionDescriptor = {
|
|
103
|
+
id: string;
|
|
104
|
+
tag?: number;
|
|
105
|
+
data?: string;
|
|
106
|
+
fail_if_unknown: boolean;
|
|
107
|
+
};
|
|
108
|
+
export type AlternativeDescriptions = {
|
|
109
|
+
[langCode: string]: string;
|
|
110
|
+
};
|
|
111
|
+
export type MetadataStatement = {
|
|
112
|
+
legalHeader?: string;
|
|
113
|
+
aaid?: string;
|
|
114
|
+
aaguid?: string;
|
|
115
|
+
attestationCertificateKeyIdentifiers?: string[];
|
|
116
|
+
description: string;
|
|
117
|
+
alternativeDescriptions?: AlternativeDescriptions;
|
|
118
|
+
authenticatorVersion: number;
|
|
119
|
+
protocolFamily: string;
|
|
120
|
+
schema: number;
|
|
121
|
+
upv: Version[];
|
|
122
|
+
authenticationAlgorithms: AlgSign[];
|
|
123
|
+
publicKeyAlgAndEncodings: AlgKey[];
|
|
124
|
+
attestationTypes: Attestation[];
|
|
125
|
+
userVerificationDetails: VerificationMethodANDCombinations[];
|
|
126
|
+
keyProtection: KeyProtection[];
|
|
127
|
+
isKeyRestricted?: boolean;
|
|
128
|
+
isFreshUserVerificationRequired?: boolean;
|
|
129
|
+
matcherProtection: MatcherProtection[];
|
|
130
|
+
cryptoStrength?: number;
|
|
131
|
+
attachmentHint?: AttachmentHint[];
|
|
132
|
+
tcDisplay: TransactionConfirmationDisplay[];
|
|
133
|
+
tcDisplayContentType?: string;
|
|
134
|
+
tcDisplayPNGCharacteristics?: DisplayPNGCharacteristicsDescriptor[];
|
|
135
|
+
attestationRootCertificates: string[];
|
|
136
|
+
ecdaaTrustAnchors?: EcdaaTrustAnchor[];
|
|
137
|
+
icon?: string;
|
|
138
|
+
supportedExtensions?: ExtensionDescriptor[];
|
|
139
|
+
authenticatorGetInfo?: AuthenticatorGetInfo;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Types declared in other specs
|
|
143
|
+
*/
|
|
144
|
+
/**
|
|
145
|
+
* USER_VERIFY
|
|
146
|
+
* https://fidoalliance.org/specs/common-specs/fido-registry-v2.2-ps-20220523.html#user-verification-methods
|
|
147
|
+
*/
|
|
148
|
+
export type UserVerify = 'presence_internal' | 'fingerprint_internal' | 'passcode_internal' | 'voiceprint_internal' | 'faceprint_internal' | 'location_internal' | 'eyeprint_internal' | 'pattern_internal' | 'handprint_internal' | 'passcode_external' | 'pattern_external' | 'none' | 'all';
|
|
149
|
+
/**
|
|
150
|
+
* ALG_SIGN
|
|
151
|
+
* https://fidoalliance.org/specs/common-specs/fido-registry-v2.2-ps-20220523.html#authentication-algorithms
|
|
152
|
+
*
|
|
153
|
+
* Using this helpful TS pattern here so that we can strongly enforce the existence of COSE info
|
|
154
|
+
* mappings in `algSignToCOSEInfoMap` in verifyAttestationWithMetadata.ts
|
|
155
|
+
*/
|
|
156
|
+
export type AlgSign = typeof AlgSign[number];
|
|
157
|
+
declare const AlgSign: readonly ["secp256r1_ecdsa_sha256_raw", "secp256r1_ecdsa_sha256_der", "rsassa_pss_sha256_raw", "rsassa_pss_sha256_der", "secp256k1_ecdsa_sha256_raw", "secp256k1_ecdsa_sha256_der", "rsassa_pss_sha384_raw", "rsassa_pkcsv15_sha256_raw", "rsassa_pkcsv15_sha384_raw", "rsassa_pkcsv15_sha512_raw", "rsassa_pkcsv15_sha1_raw", "secp384r1_ecdsa_sha384_raw", "secp512r1_ecdsa_sha256_raw", "ed25519_eddsa_sha512_raw"];
|
|
158
|
+
/**
|
|
159
|
+
* ALG_KEY
|
|
160
|
+
* https://fidoalliance.org/specs/common-specs/fido-registry-v2.2-ps-20220523.html#public-key-representation-formats
|
|
161
|
+
*/
|
|
162
|
+
export type AlgKey = 'ecc_x962_raw' | 'ecc_x962_der' | 'rsa_2048_raw' | 'rsa_2048_der' | 'cose';
|
|
163
|
+
/**
|
|
164
|
+
* ATTESTATION
|
|
165
|
+
* https://fidoalliance.org/specs/common-specs/fido-registry-v2.2-ps-20220523.html#authenticator-attestation-types
|
|
166
|
+
*/
|
|
167
|
+
export type Attestation = 'basic_full' | 'basic_surrogate' | 'ecdaa' | 'attca' | 'anonca' | 'none';
|
|
168
|
+
/**
|
|
169
|
+
* KEY_PROTECTION
|
|
170
|
+
* https://fidoalliance.org/specs/common-specs/fido-registry-v2.2-ps-20220523.html#key-protection-types
|
|
171
|
+
*/
|
|
172
|
+
export type KeyProtection = 'software' | 'hardware' | 'tee' | 'secure_element' | 'remote_handle';
|
|
173
|
+
/**
|
|
174
|
+
* MATCHER_PROTECTION
|
|
175
|
+
* https://fidoalliance.org/specs/common-specs/fido-registry-v2.2-ps-20220523.html#matcher-protection-types
|
|
176
|
+
*/
|
|
177
|
+
export type MatcherProtection = 'software' | 'tee' | 'on_chip';
|
|
178
|
+
/**
|
|
179
|
+
* ATTACHMENT_HINT
|
|
180
|
+
* https://fidoalliance.org/specs/common-specs/fido-registry-v2.2-ps-20220523.html#authenticator-attachment-hints
|
|
181
|
+
*/
|
|
182
|
+
export type AttachmentHint = 'internal' | 'external' | 'wired' | 'wireless' | 'nfc' | 'bluetooth' | 'network' | 'ready' | 'wifi_direct';
|
|
183
|
+
/**
|
|
184
|
+
* TRANSACTION_CONFIRMATION_DISPLAY
|
|
185
|
+
* https://fidoalliance.org/specs/common-specs/fido-registry-v2.2-ps-20220523.html#transaction-confirmation-display-types
|
|
186
|
+
*/
|
|
187
|
+
export type TransactionConfirmationDisplay = 'any' | 'privileged_software' | 'tee' | 'hardware' | 'remote';
|
|
188
|
+
/**
|
|
189
|
+
* https://fidoalliance.org/specs/fido-uaf-v1.2-ps-20201020/fido-uaf-protocol-v1.2-ps-20201020.html#version-interface
|
|
190
|
+
*/
|
|
191
|
+
export type Version = {
|
|
192
|
+
major: number;
|
|
193
|
+
minor: number;
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#authenticatorGetInfoz
|
|
197
|
+
*/
|
|
198
|
+
export type AuthenticatorGetInfo = {
|
|
199
|
+
versions: ('FIDO_2_0' | 'U2F_V2')[];
|
|
200
|
+
extensions?: string[];
|
|
201
|
+
aaguid: string;
|
|
202
|
+
options?: {
|
|
203
|
+
plat?: boolean;
|
|
204
|
+
rk?: boolean;
|
|
205
|
+
clientPin?: boolean;
|
|
206
|
+
up?: boolean;
|
|
207
|
+
uv?: boolean;
|
|
208
|
+
};
|
|
209
|
+
maxMsgSize?: number;
|
|
210
|
+
pinProtocols?: number[];
|
|
211
|
+
algorithms?: {
|
|
212
|
+
type: 'public-key';
|
|
213
|
+
alg: number;
|
|
214
|
+
}[];
|
|
215
|
+
};
|
|
216
|
+
export {};
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseJWT = void 0;
|
|
4
|
-
const
|
|
4
|
+
const index_js_1 = require("../helpers/iso/index.js");
|
|
5
5
|
/**
|
|
6
6
|
* Process a JWT into Javascript-friendly data structures
|
|
7
7
|
*/
|
|
8
8
|
function parseJWT(jwt) {
|
|
9
9
|
const parts = jwt.split('.');
|
|
10
10
|
return [
|
|
11
|
-
JSON.parse(
|
|
12
|
-
JSON.parse(
|
|
11
|
+
JSON.parse(index_js_1.isoBase64URL.toString(parts[0])),
|
|
12
|
+
JSON.parse(index_js_1.isoBase64URL.toString(parts[1])),
|
|
13
13
|
parts[2],
|
|
14
14
|
];
|
|
15
15
|
}
|
|
16
16
|
exports.parseJWT = parseJWT;
|
|
17
|
-
//# sourceMappingURL=parseJWT.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Base64URLString } from '../deps.js';
|
|
2
|
+
import type { AlgSign, MetadataStatement } from './mdsTypes.js';
|
|
3
|
+
import { COSEALG, COSECRV, COSEKTY } from '../helpers/cose.js';
|
|
4
|
+
/**
|
|
5
|
+
* Match properties of the authenticator's attestation statement against expected values as
|
|
6
|
+
* registered with the FIDO Alliance Metadata Service
|
|
7
|
+
*/
|
|
8
|
+
export declare function verifyAttestationWithMetadata({ statement, credentialPublicKey, x5c, attestationStatementAlg, }: {
|
|
9
|
+
statement: MetadataStatement;
|
|
10
|
+
credentialPublicKey: Uint8Array;
|
|
11
|
+
x5c: Uint8Array[] | Base64URLString[];
|
|
12
|
+
attestationStatementAlg?: number;
|
|
13
|
+
}): Promise<boolean>;
|
|
14
|
+
type COSEInfo = {
|
|
15
|
+
kty: COSEKTY;
|
|
16
|
+
alg: COSEALG;
|
|
17
|
+
crv?: COSECRV;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Convert ALG_SIGN values to COSE info
|
|
21
|
+
*
|
|
22
|
+
* Values pulled from `ALG_KEY_COSE` definitions in the FIDO Registry of Predefined Values
|
|
23
|
+
*
|
|
24
|
+
* https://fidoalliance.org/specs/common-specs/fido-registry-v2.2-ps-20220523.html#authentication-algorithms
|
|
25
|
+
*/
|
|
26
|
+
export declare const algSignToCOSEInfoMap: {
|
|
27
|
+
[key in AlgSign]: COSEInfo;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.algSignToCOSEInfoMap = exports.verifyAttestationWithMetadata = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
4
|
+
const convertCertBufferToPEM_js_1 = require("../helpers/convertCertBufferToPEM.js");
|
|
5
|
+
const validateCertificatePath_js_1 = require("../helpers/validateCertificatePath.js");
|
|
6
|
+
const decodeCredentialPublicKey_js_1 = require("../helpers/decodeCredentialPublicKey.js");
|
|
7
|
+
const cose_js_1 = require("../helpers/cose.js");
|
|
8
8
|
/**
|
|
9
9
|
* Match properties of the authenticator's attestation statement against expected values as
|
|
10
10
|
* registered with the FIDO Alliance Metadata Service
|
|
11
11
|
*/
|
|
12
12
|
async function verifyAttestationWithMetadata({ statement, credentialPublicKey, x5c, attestationStatementAlg, }) {
|
|
13
|
-
const { authenticationAlgorithms, authenticatorGetInfo, attestationRootCertificates } = statement;
|
|
13
|
+
const { authenticationAlgorithms, authenticatorGetInfo, attestationRootCertificates, } = statement;
|
|
14
14
|
// Make sure the alg in the attestation statement matches one of the ones specified in metadata
|
|
15
15
|
const keypairCOSEAlgs = new Set();
|
|
16
|
-
authenticationAlgorithms.forEach(algSign => {
|
|
16
|
+
authenticationAlgorithms.forEach((algSign) => {
|
|
17
17
|
// Map algSign string to { kty, alg, crv }
|
|
18
18
|
const algSignCOSEINFO = exports.algSignToCOSEInfoMap[algSign];
|
|
19
19
|
// Keeping this statement here just in case MDS returns something unexpected
|
|
@@ -22,9 +22,9 @@ async function verifyAttestationWithMetadata({ statement, credentialPublicKey, x
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
// Extract the public key's COSE info for comparison
|
|
25
|
-
const decodedPublicKey = (0,
|
|
26
|
-
const kty = decodedPublicKey.get(
|
|
27
|
-
const alg = decodedPublicKey.get(
|
|
25
|
+
const decodedPublicKey = (0, decodeCredentialPublicKey_js_1.decodeCredentialPublicKey)(credentialPublicKey);
|
|
26
|
+
const kty = decodedPublicKey.get(cose_js_1.COSEKEYS.kty);
|
|
27
|
+
const alg = decodedPublicKey.get(cose_js_1.COSEKEYS.alg);
|
|
28
28
|
if (!kty) {
|
|
29
29
|
throw new Error('Credential public key was missing kty');
|
|
30
30
|
}
|
|
@@ -36,8 +36,8 @@ async function verifyAttestationWithMetadata({ statement, credentialPublicKey, x
|
|
|
36
36
|
}
|
|
37
37
|
// Assume everything is a number because these values should be
|
|
38
38
|
const publicKeyCOSEInfo = { kty, alg };
|
|
39
|
-
if ((0,
|
|
40
|
-
const crv = decodedPublicKey.get(
|
|
39
|
+
if ((0, cose_js_1.isCOSEPublicKeyEC2)(decodedPublicKey)) {
|
|
40
|
+
const crv = decodedPublicKey.get(cose_js_1.COSEKEYS.crv);
|
|
41
41
|
publicKeyCOSEInfo.crv = crv;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
@@ -47,9 +47,10 @@ async function verifyAttestationWithMetadata({ statement, credentialPublicKey, x
|
|
|
47
47
|
let foundMatch = false;
|
|
48
48
|
for (const keypairAlg of keypairCOSEAlgs) {
|
|
49
49
|
// Make sure algorithm and key type match
|
|
50
|
-
if (keypairAlg.alg === publicKeyCOSEInfo.alg &&
|
|
50
|
+
if (keypairAlg.alg === publicKeyCOSEInfo.alg &&
|
|
51
|
+
keypairAlg.kty === publicKeyCOSEInfo.kty) {
|
|
51
52
|
// If not an RSA keypair then make sure curve numbers match too
|
|
52
|
-
if ((keypairAlg.kty ===
|
|
53
|
+
if ((keypairAlg.kty === cose_js_1.COSEKTY.EC2 || keypairAlg.kty === cose_js_1.COSEKTY.OKP) &&
|
|
53
54
|
keypairAlg.crv === publicKeyCOSEInfo.crv) {
|
|
54
55
|
foundMatch = true;
|
|
55
56
|
}
|
|
@@ -76,7 +77,7 @@ async function verifyAttestationWithMetadata({ statement, credentialPublicKey, x
|
|
|
76
77
|
* ]
|
|
77
78
|
* ```
|
|
78
79
|
*/
|
|
79
|
-
const debugMDSAlgs = authenticationAlgorithms.map(algSign => `'${algSign}' (COSE info: ${stringifyCOSEInfo(exports.algSignToCOSEInfoMap[algSign])})`);
|
|
80
|
+
const debugMDSAlgs = authenticationAlgorithms.map((algSign) => `'${algSign}' (COSE info: ${stringifyCOSEInfo(exports.algSignToCOSEInfoMap[algSign])})`);
|
|
80
81
|
const strMDSAlgs = JSON.stringify(debugMDSAlgs, null, 2).replace(/"/g, '');
|
|
81
82
|
/**
|
|
82
83
|
* Construct useful error output about the public key
|
|
@@ -87,27 +88,29 @@ async function verifyAttestationWithMetadata({ statement, credentialPublicKey, x
|
|
|
87
88
|
/**
|
|
88
89
|
* Confirm the attestation statement's algorithm is one supported according to metadata
|
|
89
90
|
*/
|
|
90
|
-
if (attestationStatementAlg !== undefined &&
|
|
91
|
-
|
|
91
|
+
if (attestationStatementAlg !== undefined &&
|
|
92
|
+
authenticatorGetInfo?.algorithms !== undefined) {
|
|
93
|
+
const getInfoAlgs = authenticatorGetInfo.algorithms.map((_alg) => _alg.alg);
|
|
92
94
|
if (getInfoAlgs.indexOf(attestationStatementAlg) < 0) {
|
|
93
95
|
throw new Error(`Attestation statement alg ${attestationStatementAlg} did not match one of ${getInfoAlgs}`);
|
|
94
96
|
}
|
|
95
97
|
}
|
|
96
98
|
// Prepare to check the certificate chain
|
|
97
|
-
const authenticatorCerts = x5c.map(
|
|
98
|
-
const statementRootCerts = attestationRootCertificates.map(
|
|
99
|
+
const authenticatorCerts = x5c.map(convertCertBufferToPEM_js_1.convertCertBufferToPEM);
|
|
100
|
+
const statementRootCerts = attestationRootCertificates.map(convertCertBufferToPEM_js_1.convertCertBufferToPEM);
|
|
99
101
|
/**
|
|
100
102
|
* If an authenticator returns exactly one certificate in its x5c, and that cert is found in the
|
|
101
103
|
* metadata statement then the authenticator is "self-referencing". In this case we forego
|
|
102
104
|
* certificate chain validation.
|
|
103
105
|
*/
|
|
104
106
|
let authenticatorIsSelfReferencing = false;
|
|
105
|
-
if (authenticatorCerts.length === 1 &&
|
|
107
|
+
if (authenticatorCerts.length === 1 &&
|
|
108
|
+
statementRootCerts.indexOf(authenticatorCerts[0]) >= 0) {
|
|
106
109
|
authenticatorIsSelfReferencing = true;
|
|
107
110
|
}
|
|
108
111
|
if (!authenticatorIsSelfReferencing) {
|
|
109
112
|
try {
|
|
110
|
-
await (0,
|
|
113
|
+
await (0, validateCertificatePath_js_1.validateCertificatePath)(authenticatorCerts, statementRootCerts);
|
|
111
114
|
}
|
|
112
115
|
catch (err) {
|
|
113
116
|
const _err = err;
|
|
@@ -150,7 +153,7 @@ exports.algSignToCOSEInfoMap = {
|
|
|
150
153
|
function stringifyCOSEInfo(info) {
|
|
151
154
|
const { kty, alg, crv } = info;
|
|
152
155
|
let toReturn = '';
|
|
153
|
-
if (kty !==
|
|
156
|
+
if (kty !== cose_js_1.COSEKTY.RSA) {
|
|
154
157
|
toReturn = `{ kty: ${kty}, alg: ${alg}, crv: ${crv} }`;
|
|
155
158
|
}
|
|
156
159
|
else {
|
|
@@ -158,4 +161,3 @@ function stringifyCOSEInfo(info) {
|
|
|
158
161
|
}
|
|
159
162
|
return toReturn;
|
|
160
163
|
}
|
|
161
|
-
//# sourceMappingURL=verifyAttestationWithMetadata.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightweight verification for FIDO MDS JWTs. Supports use of EC2 and RSA.
|
|
3
|
+
*
|
|
4
|
+
* If this ever needs to support more JWS algorithms, here's the list of them:
|
|
5
|
+
*
|
|
6
|
+
* https://www.rfc-editor.org/rfc/rfc7518.html#section-3.1
|
|
7
|
+
*
|
|
8
|
+
* (Pulled from https://www.rfc-editor.org/rfc/rfc7515#section-4.1.1)
|
|
9
|
+
*/
|
|
10
|
+
export declare function verifyJWT(jwt: string, leafCert: Uint8Array): Promise<boolean>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyJWT = void 0;
|
|
4
|
+
const convertX509PublicKeyToCOSE_js_1 = require("../helpers/convertX509PublicKeyToCOSE.js");
|
|
5
|
+
const index_js_1 = require("../helpers/iso/index.js");
|
|
6
|
+
const cose_js_1 = require("../helpers/cose.js");
|
|
7
|
+
const verifyEC2_js_1 = require("../helpers/iso/isoCrypto/verifyEC2.js");
|
|
8
|
+
const verifyRSA_js_1 = require("../helpers/iso/isoCrypto/verifyRSA.js");
|
|
9
|
+
/**
|
|
10
|
+
* Lightweight verification for FIDO MDS JWTs. Supports use of EC2 and RSA.
|
|
11
|
+
*
|
|
12
|
+
* If this ever needs to support more JWS algorithms, here's the list of them:
|
|
13
|
+
*
|
|
14
|
+
* https://www.rfc-editor.org/rfc/rfc7518.html#section-3.1
|
|
15
|
+
*
|
|
16
|
+
* (Pulled from https://www.rfc-editor.org/rfc/rfc7515#section-4.1.1)
|
|
17
|
+
*/
|
|
18
|
+
function verifyJWT(jwt, leafCert) {
|
|
19
|
+
const [header, payload, signature] = jwt.split('.');
|
|
20
|
+
const certCOSE = (0, convertX509PublicKeyToCOSE_js_1.convertX509PublicKeyToCOSE)(leafCert);
|
|
21
|
+
const data = index_js_1.isoUint8Array.fromUTF8String(`${header}.${payload}`);
|
|
22
|
+
const signatureBytes = index_js_1.isoBase64URL.toBuffer(signature);
|
|
23
|
+
if ((0, cose_js_1.isCOSEPublicKeyEC2)(certCOSE)) {
|
|
24
|
+
return (0, verifyEC2_js_1.verifyEC2)({
|
|
25
|
+
data,
|
|
26
|
+
signature: signatureBytes,
|
|
27
|
+
cosePublicKey: certCOSE,
|
|
28
|
+
shaHashOverride: cose_js_1.COSEALG.ES256,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
else if ((0, cose_js_1.isCOSEPublicKeyRSA)(certCOSE)) {
|
|
32
|
+
return (0, verifyRSA_js_1.verifyRSA)({
|
|
33
|
+
data,
|
|
34
|
+
signature: signatureBytes,
|
|
35
|
+
cosePublicKey: certCOSE,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const kty = certCOSE.get(cose_js_1.COSEKEYS.kty);
|
|
39
|
+
throw new Error(`JWT verification with public key of kty ${kty} is not supported by this method`);
|
|
40
|
+
}
|
|
41
|
+
exports.verifyJWT = verifyJWT;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { AttestationConveyancePreference, AuthenticationExtensionsClientInputs, AuthenticatorSelectionCriteria, COSEAlgorithmIdentifier, PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialDescriptorFuture } from '../deps.js';
|
|
2
|
+
export type GenerateRegistrationOptionsOpts = {
|
|
3
|
+
rpName: string;
|
|
4
|
+
rpID: string;
|
|
5
|
+
userID: string;
|
|
6
|
+
userName: string;
|
|
7
|
+
challenge?: string | Uint8Array;
|
|
8
|
+
userDisplayName?: string;
|
|
9
|
+
timeout?: number;
|
|
10
|
+
attestationType?: AttestationConveyancePreference;
|
|
11
|
+
excludeCredentials?: PublicKeyCredentialDescriptorFuture[];
|
|
12
|
+
authenticatorSelection?: AuthenticatorSelectionCriteria;
|
|
13
|
+
extensions?: AuthenticationExtensionsClientInputs;
|
|
14
|
+
supportedAlgorithmIDs?: COSEAlgorithmIdentifier[];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Supported crypto algo identifiers
|
|
18
|
+
* See https://w3c.github.io/webauthn/#sctn-alg-identifier
|
|
19
|
+
* and https://www.iana.org/assignments/cose/cose.xhtml#algorithms
|
|
20
|
+
*/
|
|
21
|
+
export declare const supportedCOSEAlgorithmIdentifiers: COSEAlgorithmIdentifier[];
|
|
22
|
+
/**
|
|
23
|
+
* Prepare a value to pass into navigator.credentials.create(...) for authenticator "registration"
|
|
24
|
+
*
|
|
25
|
+
* **Options:**
|
|
26
|
+
*
|
|
27
|
+
* @param rpName User-visible, "friendly" website/service name
|
|
28
|
+
* @param rpID Valid domain name (after `https://`)
|
|
29
|
+
* @param userID User's website-specific unique ID
|
|
30
|
+
* @param userName User's website-specific username (email, etc...)
|
|
31
|
+
* @param challenge Random value the authenticator needs to sign and pass back
|
|
32
|
+
* @param userDisplayName User's actual name
|
|
33
|
+
* @param timeout How long (in ms) the user can take to complete attestation
|
|
34
|
+
* @param attestationType Specific attestation statement
|
|
35
|
+
* @param excludeCredentials Authenticators registered by the user so the user can't register the
|
|
36
|
+
* same credential multiple times
|
|
37
|
+
* @param authenticatorSelection Advanced criteria for restricting the types of authenticators that
|
|
38
|
+
* may be used
|
|
39
|
+
* @param extensions Additional plugins the authenticator or browser should use during attestation
|
|
40
|
+
* @param supportedAlgorithmIDs Array of numeric COSE algorithm identifiers supported for
|
|
41
|
+
* attestation by this RP. See https://www.iana.org/assignments/cose/cose.xhtml#algorithms
|
|
42
|
+
*/
|
|
43
|
+
export declare function generateRegistrationOptions(options: GenerateRegistrationOptionsOpts): Promise<PublicKeyCredentialCreationOptionsJSON>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateRegistrationOptions = exports.supportedCOSEAlgorithmIdentifiers = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const generateChallenge_js_1 = require("../helpers/generateChallenge.js");
|
|
5
|
+
const index_js_1 = require("../helpers/iso/index.js");
|
|
6
6
|
/**
|
|
7
7
|
* Supported crypto algo identifiers
|
|
8
8
|
* See https://w3c.github.io/webauthn/#sctn-alg-identifier
|
|
@@ -69,12 +69,12 @@ const defaultSupportedAlgorithmIDs = [-8, -7, -257];
|
|
|
69
69
|
* @param supportedAlgorithmIDs Array of numeric COSE algorithm identifiers supported for
|
|
70
70
|
* attestation by this RP. See https://www.iana.org/assignments/cose/cose.xhtml#algorithms
|
|
71
71
|
*/
|
|
72
|
-
function generateRegistrationOptions(options) {
|
|
73
|
-
const { rpName, rpID, userID, userName, challenge = (0,
|
|
72
|
+
async function generateRegistrationOptions(options) {
|
|
73
|
+
const { rpName, rpID, userID, userName, challenge = await (0, generateChallenge_js_1.generateChallenge)(), userDisplayName = userName, timeout = 60000, attestationType = 'none', excludeCredentials = [], authenticatorSelection = defaultAuthenticatorSelection, extensions, supportedAlgorithmIDs = defaultSupportedAlgorithmIDs, } = options;
|
|
74
74
|
/**
|
|
75
75
|
* Prepare pubKeyCredParams from the array of algorithm ID's
|
|
76
76
|
*/
|
|
77
|
-
const pubKeyCredParams = supportedAlgorithmIDs.map(id => ({
|
|
77
|
+
const pubKeyCredParams = supportedAlgorithmIDs.map((id) => ({
|
|
78
78
|
alg: id,
|
|
79
79
|
type: 'public-key',
|
|
80
80
|
}));
|
|
@@ -116,10 +116,10 @@ function generateRegistrationOptions(options) {
|
|
|
116
116
|
*/
|
|
117
117
|
let _challenge = challenge;
|
|
118
118
|
if (typeof _challenge === 'string') {
|
|
119
|
-
_challenge =
|
|
119
|
+
_challenge = index_js_1.isoUint8Array.fromASCIIString(_challenge);
|
|
120
120
|
}
|
|
121
121
|
return {
|
|
122
|
-
challenge:
|
|
122
|
+
challenge: index_js_1.isoBase64URL.fromBuffer(_challenge),
|
|
123
123
|
rp: {
|
|
124
124
|
name: rpName,
|
|
125
125
|
id: rpID,
|
|
@@ -132,9 +132,9 @@ function generateRegistrationOptions(options) {
|
|
|
132
132
|
pubKeyCredParams,
|
|
133
133
|
timeout,
|
|
134
134
|
attestation: attestationType,
|
|
135
|
-
excludeCredentials: excludeCredentials.map(cred => ({
|
|
135
|
+
excludeCredentials: excludeCredentials.map((cred) => ({
|
|
136
136
|
...cred,
|
|
137
|
-
id:
|
|
137
|
+
id: index_js_1.isoBase64URL.fromBuffer(cred.id),
|
|
138
138
|
})),
|
|
139
139
|
authenticatorSelection,
|
|
140
140
|
extensions: {
|
|
@@ -144,4 +144,3 @@ function generateRegistrationOptions(options) {
|
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
146
|
exports.generateRegistrationOptions = generateRegistrationOptions;
|
|
147
|
-
//# sourceMappingURL=generateRegistrationOptions.js.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A whole lotta domain knowledge is captured here, with hazy connections to source
|
|
3
|
+
* documents. Good places to start searching for more info on these values are the
|
|
4
|
+
* following Trusted Computing Group TPM Library docs linked in the WebAuthn API:
|
|
5
|
+
*
|
|
6
|
+
* - https://www.trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-1-Architecture-01.38.pdf
|
|
7
|
+
* - https://www.trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-2-Structures-01.38.pdf
|
|
8
|
+
* - https://www.trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-3-Commands-01.38.pdf
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* 6.9 TPM_ST (Structure Tags)
|
|
12
|
+
*/
|
|
13
|
+
export declare const TPM_ST: {
|
|
14
|
+
[key: number]: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* 6.3 TPM_ALG_ID
|
|
18
|
+
*/
|
|
19
|
+
export declare const TPM_ALG: {
|
|
20
|
+
[key: number]: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* 6.4 TPM_ECC_CURVE
|
|
24
|
+
*/
|
|
25
|
+
export declare const TPM_ECC_CURVE: {
|
|
26
|
+
[key: number]: string;
|
|
27
|
+
};
|
|
28
|
+
type ManufacturerInfo = {
|
|
29
|
+
name: string;
|
|
30
|
+
id: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Sourced from https://trustedcomputinggroup.org/resource/vendor-id-registry/
|
|
34
|
+
*
|
|
35
|
+
* Latest version:
|
|
36
|
+
* https://trustedcomputinggroup.org/wp-content/uploads/TCG-TPM-Vendor-ID-Registry-Version-1.02-Revision-1.00.pdf
|
|
37
|
+
*/
|
|
38
|
+
export declare const TPM_MANUFACTURERS: {
|
|
39
|
+
[key: string]: ManufacturerInfo;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Match TPM public area curve ID's to `crv` numbers used in COSE public keys
|
|
43
|
+
*/
|
|
44
|
+
export declare const TPM_ECC_CURVE_COSE_CRV_MAP: {
|
|
45
|
+
[key: string]: number;
|
|
46
|
+
};
|
|
47
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
// deno-lint-ignore-file no-dupe-keys
|
|
3
3
|
/**
|
|
4
4
|
* A whole lotta domain knowledge is captured here, with hazy connections to source
|
|
5
5
|
* documents. Good places to start searching for more info on these values are the
|
|
@@ -183,4 +183,3 @@ exports.TPM_ECC_CURVE_COSE_CRV_MAP = {
|
|
|
183
183
|
TPM_ECC_BN_P256: 1,
|
|
184
184
|
TPM_ECC_SM2_P256: 1, // p256
|
|
185
185
|
};
|
|
186
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cut up a TPM attestation's certInfo into intelligible chunks
|
|
3
|
+
*/
|
|
4
|
+
export declare function parseCertInfo(certInfo: Uint8Array): ParsedCertInfo;
|
|
5
|
+
type ParsedCertInfo = {
|
|
6
|
+
magic: number;
|
|
7
|
+
type: string;
|
|
8
|
+
qualifiedSigner: Uint8Array;
|
|
9
|
+
extraData: Uint8Array;
|
|
10
|
+
clockInfo: {
|
|
11
|
+
clock: Uint8Array;
|
|
12
|
+
resetCount: number;
|
|
13
|
+
restartCount: number;
|
|
14
|
+
safe: boolean;
|
|
15
|
+
};
|
|
16
|
+
firmwareVersion: Uint8Array;
|
|
17
|
+
attested: {
|
|
18
|
+
nameAlg: string;
|
|
19
|
+
nameAlgBuffer: Uint8Array;
|
|
20
|
+
name: Uint8Array;
|
|
21
|
+
qualifiedName: Uint8Array;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export {};
|