@simplewebauthn/server 11.0.0 → 13.0.0-alpha1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -12
- package/esm/authentication/generateAuthenticationOptions.d.ts +14 -13
- package/esm/authentication/generateAuthenticationOptions.d.ts.map +1 -0
- package/esm/authentication/verifyAuthenticationResponse.d.ts +19 -15
- package/esm/authentication/verifyAuthenticationResponse.d.ts.map +1 -0
- package/esm/helpers/convertAAGUIDToString.d.ts +1 -0
- package/esm/helpers/convertAAGUIDToString.d.ts.map +1 -0
- package/esm/helpers/convertAAGUIDToString.js +4 -4
- package/esm/helpers/convertCOSEtoPKCS.d.ts +1 -0
- package/esm/helpers/convertCOSEtoPKCS.d.ts.map +1 -0
- package/esm/helpers/convertCertBufferToPEM.d.ts +2 -1
- package/esm/helpers/convertCertBufferToPEM.d.ts.map +1 -0
- package/esm/helpers/convertPEMToBytes.d.ts +1 -0
- package/esm/helpers/convertPEMToBytes.d.ts.map +1 -0
- package/esm/helpers/convertX509PublicKeyToCOSE.d.ts +1 -0
- package/esm/helpers/convertX509PublicKeyToCOSE.d.ts.map +1 -0
- package/esm/helpers/convertX509PublicKeyToCOSE.js +4 -1
- package/esm/helpers/cose.d.ts +23 -0
- package/esm/helpers/cose.d.ts.map +1 -0
- package/esm/helpers/cose.js +20 -0
- package/esm/helpers/decodeAttestationObject.d.ts +5 -0
- package/esm/helpers/decodeAttestationObject.d.ts.map +1 -0
- package/esm/helpers/decodeAttestationObject.js +4 -1
- package/esm/helpers/decodeAuthenticatorExtensions.d.ts +1 -0
- package/esm/helpers/decodeAuthenticatorExtensions.d.ts.map +1 -0
- package/esm/helpers/decodeClientDataJSON.d.ts +6 -1
- package/esm/helpers/decodeClientDataJSON.d.ts.map +1 -0
- package/esm/helpers/decodeClientDataJSON.js +4 -1
- package/esm/helpers/decodeCredentialPublicKey.d.ts +5 -0
- package/esm/helpers/decodeCredentialPublicKey.d.ts.map +1 -0
- package/esm/helpers/decodeCredentialPublicKey.js +4 -1
- package/esm/helpers/fetch.d.ts +5 -0
- package/esm/helpers/fetch.d.ts.map +1 -0
- package/esm/helpers/fetch.js +5 -2
- package/esm/helpers/generateChallenge.d.ts +5 -0
- package/esm/helpers/generateChallenge.d.ts.map +1 -0
- package/esm/helpers/generateChallenge.js +4 -1
- package/esm/helpers/generateUserID.d.ts +5 -0
- package/esm/helpers/generateUserID.d.ts.map +1 -0
- package/esm/helpers/generateUserID.js +4 -1
- package/esm/helpers/getCertificateInfo.d.ts +2 -1
- package/esm/helpers/getCertificateInfo.d.ts.map +1 -0
- package/esm/helpers/getCertificateInfo.js +2 -1
- package/esm/helpers/index.d.ts +17 -23
- package/esm/helpers/index.d.ts.map +1 -0
- package/esm/helpers/index.js +16 -17
- package/esm/helpers/isCertRevoked.d.ts +2 -1
- package/esm/helpers/isCertRevoked.d.ts.map +1 -0
- package/esm/helpers/isCertRevoked.js +2 -1
- package/esm/helpers/iso/index.d.ts +1 -0
- package/esm/helpers/iso/index.d.ts.map +1 -0
- package/esm/helpers/iso/isoBase64URL.d.ts +2 -1
- package/esm/helpers/iso/isoBase64URL.d.ts.map +1 -0
- package/esm/helpers/iso/isoBase64URL.js +5 -1
- package/esm/helpers/iso/isoCBOR.d.ts +6 -1
- package/esm/helpers/iso/isoCBOR.d.ts.map +1 -0
- package/esm/helpers/iso/isoCBOR.js +5 -1
- package/esm/helpers/iso/isoCrypto/digest.d.ts +1 -0
- package/esm/helpers/iso/isoCrypto/digest.d.ts.map +1 -0
- package/esm/helpers/iso/isoCrypto/getRandomValues.d.ts +1 -0
- package/esm/helpers/iso/isoCrypto/getRandomValues.d.ts.map +1 -0
- package/esm/helpers/iso/isoCrypto/getWebCrypto.d.ts +2 -1
- package/esm/helpers/iso/isoCrypto/getWebCrypto.d.ts.map +1 -0
- package/esm/helpers/iso/isoCrypto/importKey.d.ts +1 -0
- package/esm/helpers/iso/isoCrypto/importKey.d.ts.map +1 -0
- package/esm/helpers/iso/isoCrypto/index.d.ts +5 -0
- package/esm/helpers/iso/isoCrypto/index.d.ts.map +1 -0
- package/esm/helpers/iso/isoCrypto/index.js +4 -0
- package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts +1 -0
- package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts.map +1 -0
- package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts +1 -0
- package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts.map +1 -0
- package/esm/helpers/iso/isoCrypto/structs.d.ts +1 -0
- package/esm/helpers/iso/isoCrypto/structs.d.ts.map +1 -0
- package/esm/helpers/iso/isoCrypto/unwrapEC2Signature.d.ts +1 -0
- package/esm/helpers/iso/isoCrypto/unwrapEC2Signature.d.ts.map +1 -0
- package/esm/helpers/iso/isoCrypto/unwrapEC2Signature.js +2 -1
- package/esm/helpers/iso/isoCrypto/verify.d.ts +1 -0
- package/esm/helpers/iso/isoCrypto/verify.d.ts.map +1 -0
- package/esm/helpers/iso/isoCrypto/verifyEC2.d.ts +1 -0
- package/esm/helpers/iso/isoCrypto/verifyEC2.d.ts.map +1 -0
- package/esm/helpers/iso/isoCrypto/verifyOKP.d.ts +1 -0
- package/esm/helpers/iso/isoCrypto/verifyOKP.d.ts.map +1 -0
- package/esm/helpers/iso/isoCrypto/verifyRSA.d.ts +1 -0
- package/esm/helpers/iso/isoCrypto/verifyRSA.d.ts.map +1 -0
- package/esm/helpers/iso/isoUint8Array.d.ts +5 -0
- package/esm/helpers/iso/isoUint8Array.d.ts.map +1 -0
- package/esm/helpers/iso/isoUint8Array.js +4 -0
- package/esm/helpers/logging.d.ts +1 -0
- package/esm/helpers/logging.d.ts.map +1 -0
- package/esm/helpers/logging.js +0 -1
- package/esm/helpers/mapX509SignatureAlgToCOSEAlg.d.ts +1 -0
- package/esm/helpers/mapX509SignatureAlgToCOSEAlg.d.ts.map +1 -0
- package/esm/helpers/matchExpectedRPID.d.ts +1 -0
- package/esm/helpers/matchExpectedRPID.d.ts.map +1 -0
- package/esm/helpers/parseAuthenticatorData.d.ts +5 -0
- package/esm/helpers/parseAuthenticatorData.d.ts.map +1 -0
- package/esm/helpers/parseAuthenticatorData.js +10 -7
- package/esm/helpers/parseBackupFlags.d.ts +2 -1
- package/esm/helpers/parseBackupFlags.d.ts.map +1 -0
- package/esm/helpers/toHash.d.ts +1 -0
- package/esm/helpers/toHash.d.ts.map +1 -0
- package/esm/helpers/validateCertificatePath.d.ts +4 -3
- package/esm/helpers/validateCertificatePath.d.ts.map +1 -0
- package/esm/helpers/validateCertificatePath.js +82 -59
- package/esm/helpers/validateExtFIDOGenCEAAGUID.d.ts +2 -1
- package/esm/helpers/validateExtFIDOGenCEAAGUID.d.ts.map +1 -0
- package/esm/helpers/validateExtFIDOGenCEAAGUID.js +1 -1
- package/esm/helpers/verifySignature.d.ts +5 -0
- package/esm/helpers/verifySignature.d.ts.map +1 -0
- package/esm/helpers/verifySignature.js +4 -1
- package/esm/index.d.ts +9 -17
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +8 -11
- package/esm/metadata/mdsTypes.d.ts +6 -1
- package/esm/metadata/mdsTypes.d.ts.map +1 -0
- package/esm/metadata/parseJWT.d.ts +1 -0
- package/esm/metadata/parseJWT.d.ts.map +1 -0
- package/esm/metadata/verifyAttestationWithMetadata.d.ts +3 -2
- package/esm/metadata/verifyAttestationWithMetadata.d.ts.map +1 -0
- package/esm/metadata/verifyAttestationWithMetadata.js +1 -1
- package/esm/metadata/verifyJWT.d.ts +1 -0
- package/esm/metadata/verifyJWT.d.ts.map +1 -0
- package/esm/registration/generateRegistrationOptions.d.ts +22 -19
- package/esm/registration/generateRegistrationOptions.d.ts.map +1 -0
- package/esm/registration/generateRegistrationOptions.js +22 -1
- package/esm/registration/verifications/tpm/constants.d.ts +1 -0
- package/esm/registration/verifications/tpm/constants.d.ts.map +1 -0
- package/esm/registration/verifications/tpm/constants.js +4 -4
- package/esm/registration/verifications/tpm/parseCertInfo.d.ts +1 -0
- package/esm/registration/verifications/tpm/parseCertInfo.d.ts.map +1 -0
- package/esm/registration/verifications/tpm/parsePubArea.d.ts +1 -0
- package/esm/registration/verifications/tpm/parsePubArea.d.ts.map +1 -0
- package/esm/registration/verifications/tpm/verifyAttestationTPM.d.ts +1 -0
- package/esm/registration/verifications/tpm/verifyAttestationTPM.d.ts.map +1 -0
- package/esm/registration/verifications/tpm/verifyAttestationTPM.js +2 -1
- package/esm/registration/verifications/verifyAttestationAndroidKey.d.ts +1 -0
- package/esm/registration/verifications/verifyAttestationAndroidKey.d.ts.map +1 -0
- package/esm/registration/verifications/verifyAttestationAndroidKey.js +3 -1
- package/esm/registration/verifications/verifyAttestationAndroidSafetyNet.d.ts +1 -0
- package/esm/registration/verifications/verifyAttestationAndroidSafetyNet.d.ts.map +1 -0
- package/esm/registration/verifications/verifyAttestationApple.d.ts +1 -0
- package/esm/registration/verifications/verifyAttestationApple.d.ts.map +1 -0
- package/esm/registration/verifications/verifyAttestationApple.js +2 -1
- package/esm/registration/verifications/verifyAttestationFIDOU2F.d.ts +1 -0
- package/esm/registration/verifications/verifyAttestationFIDOU2F.d.ts.map +1 -0
- package/esm/registration/verifications/verifyAttestationPacked.d.ts +1 -0
- package/esm/registration/verifications/verifyAttestationPacked.d.ts.map +1 -0
- package/esm/registration/verifyRegistrationResponse.d.ts +18 -14
- package/esm/registration/verifyRegistrationResponse.d.ts.map +1 -0
- package/esm/services/defaultRootCerts/android-key.d.ts +1 -0
- package/esm/services/defaultRootCerts/android-key.d.ts.map +1 -0
- package/esm/services/defaultRootCerts/android-safetynet.d.ts +1 -0
- package/esm/services/defaultRootCerts/android-safetynet.d.ts.map +1 -0
- package/esm/services/defaultRootCerts/apple.d.ts +1 -0
- package/esm/services/defaultRootCerts/apple.d.ts.map +1 -0
- package/esm/services/defaultRootCerts/mds.d.ts +1 -0
- package/esm/services/defaultRootCerts/mds.d.ts.map +1 -0
- package/esm/services/metadataService.d.ts +30 -11
- package/esm/services/metadataService.d.ts.map +1 -0
- package/esm/services/metadataService.js +8 -22
- package/esm/services/settingsService.d.ts +18 -5
- package/esm/services/settingsService.d.ts.map +1 -0
- package/esm/services/settingsService.js +14 -10
- package/esm/types/dom.d.ts +329 -0
- package/esm/types/dom.d.ts.map +1 -0
- package/esm/types/dom.js +1 -0
- package/esm/types/index.d.ts +205 -0
- package/esm/types/index.d.ts.map +1 -0
- package/esm/types/index.js +1 -0
- package/package.json +27 -32
- package/script/authentication/generateAuthenticationOptions.d.ts +14 -13
- package/script/authentication/generateAuthenticationOptions.d.ts.map +1 -0
- package/script/authentication/generateAuthenticationOptions.js +1 -2
- package/script/authentication/verifyAuthenticationResponse.d.ts +19 -15
- package/script/authentication/verifyAuthenticationResponse.d.ts.map +1 -0
- package/script/authentication/verifyAuthenticationResponse.js +1 -2
- package/script/helpers/convertAAGUIDToString.d.ts +1 -0
- package/script/helpers/convertAAGUIDToString.d.ts.map +1 -0
- package/script/helpers/convertAAGUIDToString.js +5 -6
- package/script/helpers/convertCOSEtoPKCS.d.ts +1 -0
- package/script/helpers/convertCOSEtoPKCS.d.ts.map +1 -0
- package/script/helpers/convertCOSEtoPKCS.js +1 -2
- package/script/helpers/convertCertBufferToPEM.d.ts +2 -1
- package/script/helpers/convertCertBufferToPEM.d.ts.map +1 -0
- package/script/helpers/convertCertBufferToPEM.js +1 -2
- package/script/helpers/convertPEMToBytes.d.ts +1 -0
- package/script/helpers/convertPEMToBytes.d.ts.map +1 -0
- package/script/helpers/convertPEMToBytes.js +1 -2
- package/script/helpers/convertX509PublicKeyToCOSE.d.ts +1 -0
- package/script/helpers/convertX509PublicKeyToCOSE.d.ts.map +1 -0
- package/script/helpers/convertX509PublicKeyToCOSE.js +11 -9
- package/script/helpers/cose.d.ts +23 -0
- package/script/helpers/cose.d.ts.map +1 -0
- package/script/helpers/cose.js +31 -11
- package/script/helpers/decodeAttestationObject.d.ts +5 -0
- package/script/helpers/decodeAttestationObject.d.ts.map +1 -0
- package/script/helpers/decodeAttestationObject.js +6 -3
- package/script/helpers/decodeAuthenticatorExtensions.d.ts +1 -0
- package/script/helpers/decodeAuthenticatorExtensions.d.ts.map +1 -0
- package/script/helpers/decodeAuthenticatorExtensions.js +1 -2
- package/script/helpers/decodeClientDataJSON.d.ts +6 -1
- package/script/helpers/decodeClientDataJSON.d.ts.map +1 -0
- package/script/helpers/decodeClientDataJSON.js +6 -3
- package/script/helpers/decodeCredentialPublicKey.d.ts +5 -0
- package/script/helpers/decodeCredentialPublicKey.d.ts.map +1 -0
- package/script/helpers/decodeCredentialPublicKey.js +6 -3
- package/script/helpers/fetch.d.ts +5 -0
- package/script/helpers/fetch.d.ts.map +1 -0
- package/script/helpers/fetch.js +8 -5
- package/script/helpers/generateChallenge.d.ts +5 -0
- package/script/helpers/generateChallenge.d.ts.map +1 -0
- package/script/helpers/generateChallenge.js +6 -3
- package/script/helpers/generateUserID.d.ts +5 -0
- package/script/helpers/generateUserID.d.ts.map +1 -0
- package/script/helpers/generateUserID.js +6 -3
- package/script/helpers/getCertificateInfo.d.ts +2 -1
- package/script/helpers/getCertificateInfo.d.ts.map +1 -0
- package/script/helpers/getCertificateInfo.js +6 -6
- package/script/helpers/index.d.ts +17 -23
- package/script/helpers/index.d.ts.map +1 -0
- package/script/helpers/index.js +20 -36
- package/script/helpers/isCertRevoked.d.ts +2 -1
- package/script/helpers/isCertRevoked.d.ts.map +1 -0
- package/script/helpers/isCertRevoked.js +10 -10
- package/script/helpers/iso/index.d.ts +1 -0
- package/script/helpers/iso/index.d.ts.map +1 -0
- package/script/helpers/iso/isoBase64URL.d.ts +2 -1
- package/script/helpers/iso/isoBase64URL.d.ts.map +1 -0
- package/script/helpers/iso/isoBase64URL.js +24 -18
- package/script/helpers/iso/isoCBOR.d.ts +6 -1
- package/script/helpers/iso/isoCBOR.d.ts.map +1 -0
- package/script/helpers/iso/isoCBOR.js +32 -6
- package/script/helpers/iso/isoCrypto/digest.d.ts +1 -0
- package/script/helpers/iso/isoCrypto/digest.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/digest.js +1 -2
- package/script/helpers/iso/isoCrypto/getRandomValues.d.ts +1 -0
- package/script/helpers/iso/isoCrypto/getRandomValues.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/getRandomValues.js +1 -2
- package/script/helpers/iso/isoCrypto/getWebCrypto.d.ts +2 -1
- package/script/helpers/iso/isoCrypto/getWebCrypto.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/getWebCrypto.js +2 -2
- package/script/helpers/iso/isoCrypto/importKey.d.ts +1 -0
- package/script/helpers/iso/isoCrypto/importKey.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/importKey.js +1 -2
- package/script/helpers/iso/isoCrypto/index.d.ts +5 -0
- package/script/helpers/iso/isoCrypto/index.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/index.js +4 -0
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts +1 -0
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.js +1 -2
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts +1 -0
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.js +1 -2
- package/script/helpers/iso/isoCrypto/structs.d.ts +1 -0
- package/script/helpers/iso/isoCrypto/structs.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/unwrapEC2Signature.d.ts +1 -0
- package/script/helpers/iso/isoCrypto/unwrapEC2Signature.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/unwrapEC2Signature.js +4 -4
- package/script/helpers/iso/isoCrypto/verify.d.ts +1 -0
- package/script/helpers/iso/isoCrypto/verify.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/verify.js +1 -2
- package/script/helpers/iso/isoCrypto/verifyEC2.d.ts +1 -0
- package/script/helpers/iso/isoCrypto/verifyEC2.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/verifyEC2.js +1 -2
- package/script/helpers/iso/isoCrypto/verifyOKP.d.ts +1 -0
- package/script/helpers/iso/isoCrypto/verifyOKP.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/verifyOKP.js +1 -2
- package/script/helpers/iso/isoCrypto/verifyRSA.d.ts +1 -0
- package/script/helpers/iso/isoCrypto/verifyRSA.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/verifyRSA.js +1 -2
- package/script/helpers/iso/isoUint8Array.d.ts +5 -0
- package/script/helpers/iso/isoUint8Array.d.ts.map +1 -0
- package/script/helpers/iso/isoUint8Array.js +12 -9
- package/script/helpers/logging.d.ts +1 -0
- package/script/helpers/logging.d.ts.map +1 -0
- package/script/helpers/logging.js +2 -4
- package/script/helpers/mapX509SignatureAlgToCOSEAlg.d.ts +1 -0
- package/script/helpers/mapX509SignatureAlgToCOSEAlg.d.ts.map +1 -0
- package/script/helpers/mapX509SignatureAlgToCOSEAlg.js +1 -2
- package/script/helpers/matchExpectedRPID.d.ts +1 -0
- package/script/helpers/matchExpectedRPID.d.ts.map +1 -0
- package/script/helpers/matchExpectedRPID.js +1 -2
- package/script/helpers/parseAuthenticatorData.d.ts +5 -0
- package/script/helpers/parseAuthenticatorData.d.ts.map +1 -0
- package/script/helpers/parseAuthenticatorData.js +12 -9
- package/script/helpers/parseBackupFlags.d.ts +2 -1
- package/script/helpers/parseBackupFlags.d.ts.map +1 -0
- package/script/helpers/parseBackupFlags.js +2 -2
- package/script/helpers/toHash.d.ts +1 -0
- package/script/helpers/toHash.d.ts.map +1 -0
- package/script/helpers/toHash.js +1 -2
- package/script/helpers/validateCertificatePath.d.ts +4 -3
- package/script/helpers/validateCertificatePath.d.ts.map +1 -0
- package/script/helpers/validateCertificatePath.js +83 -61
- package/script/helpers/validateExtFIDOGenCEAAGUID.d.ts +2 -1
- package/script/helpers/validateExtFIDOGenCEAAGUID.d.ts.map +1 -0
- package/script/helpers/validateExtFIDOGenCEAAGUID.js +3 -4
- package/script/helpers/verifySignature.d.ts +5 -0
- package/script/helpers/verifySignature.d.ts.map +1 -0
- package/script/helpers/verifySignature.js +6 -3
- package/script/index.d.ts +9 -17
- package/script/index.d.ts.map +1 -0
- package/script/index.js +22 -17
- package/script/metadata/mdsTypes.d.ts +6 -1
- package/script/metadata/mdsTypes.d.ts.map +1 -0
- package/script/metadata/parseJWT.d.ts +1 -0
- package/script/metadata/parseJWT.d.ts.map +1 -0
- package/script/metadata/parseJWT.js +1 -2
- package/script/metadata/verifyAttestationWithMetadata.d.ts +3 -2
- package/script/metadata/verifyAttestationWithMetadata.d.ts.map +1 -0
- package/script/metadata/verifyAttestationWithMetadata.js +2 -2
- package/script/metadata/verifyJWT.d.ts +1 -0
- package/script/metadata/verifyJWT.d.ts.map +1 -0
- package/script/metadata/verifyJWT.js +1 -2
- package/script/registration/generateRegistrationOptions.d.ts +22 -19
- package/script/registration/generateRegistrationOptions.d.ts.map +1 -0
- package/script/registration/generateRegistrationOptions.js +24 -3
- package/script/registration/verifications/tpm/constants.d.ts +1 -0
- package/script/registration/verifications/tpm/constants.d.ts.map +1 -0
- package/script/registration/verifications/tpm/constants.js +4 -4
- package/script/registration/verifications/tpm/parseCertInfo.d.ts +1 -0
- package/script/registration/verifications/tpm/parseCertInfo.d.ts.map +1 -0
- package/script/registration/verifications/tpm/parseCertInfo.js +1 -2
- package/script/registration/verifications/tpm/parsePubArea.d.ts +1 -0
- package/script/registration/verifications/tpm/parsePubArea.d.ts.map +1 -0
- package/script/registration/verifications/tpm/parsePubArea.js +1 -2
- package/script/registration/verifications/tpm/verifyAttestationTPM.d.ts +1 -0
- package/script/registration/verifications/tpm/verifyAttestationTPM.d.ts.map +1 -0
- package/script/registration/verifications/tpm/verifyAttestationTPM.js +8 -8
- package/script/registration/verifications/verifyAttestationAndroidKey.d.ts +1 -0
- package/script/registration/verifications/verifyAttestationAndroidKey.d.ts.map +1 -0
- package/script/registration/verifications/verifyAttestationAndroidKey.js +7 -6
- package/script/registration/verifications/verifyAttestationAndroidSafetyNet.d.ts +1 -0
- package/script/registration/verifications/verifyAttestationAndroidSafetyNet.d.ts.map +1 -0
- package/script/registration/verifications/verifyAttestationAndroidSafetyNet.js +1 -2
- package/script/registration/verifications/verifyAttestationApple.d.ts +1 -0
- package/script/registration/verifications/verifyAttestationApple.d.ts.map +1 -0
- package/script/registration/verifications/verifyAttestationApple.js +4 -4
- package/script/registration/verifications/verifyAttestationFIDOU2F.d.ts +1 -0
- package/script/registration/verifications/verifyAttestationFIDOU2F.d.ts.map +1 -0
- package/script/registration/verifications/verifyAttestationFIDOU2F.js +1 -2
- package/script/registration/verifications/verifyAttestationPacked.d.ts +1 -0
- package/script/registration/verifications/verifyAttestationPacked.d.ts.map +1 -0
- package/script/registration/verifications/verifyAttestationPacked.js +1 -2
- package/script/registration/verifyRegistrationResponse.d.ts +18 -14
- package/script/registration/verifyRegistrationResponse.d.ts.map +1 -0
- package/script/registration/verifyRegistrationResponse.js +1 -2
- package/script/services/defaultRootCerts/android-key.d.ts +1 -0
- package/script/services/defaultRootCerts/android-key.d.ts.map +1 -0
- package/script/services/defaultRootCerts/android-safetynet.d.ts +1 -0
- package/script/services/defaultRootCerts/android-safetynet.d.ts.map +1 -0
- package/script/services/defaultRootCerts/apple.d.ts +1 -0
- package/script/services/defaultRootCerts/apple.d.ts.map +1 -0
- package/script/services/defaultRootCerts/mds.d.ts +1 -0
- package/script/services/defaultRootCerts/mds.d.ts.map +1 -0
- package/script/services/metadataService.d.ts +30 -11
- package/script/services/metadataService.d.ts.map +1 -0
- package/script/services/metadataService.js +8 -22
- package/script/services/settingsService.d.ts +18 -5
- package/script/services/settingsService.d.ts.map +1 -0
- package/script/services/settingsService.js +14 -10
- package/script/types/dom.d.ts +329 -0
- package/script/types/dom.d.ts.map +1 -0
- package/script/types/dom.js +2 -0
- package/script/types/index.d.ts +205 -0
- package/script/types/index.d.ts.map +1 -0
- package/script/types/index.js +2 -0
- package/esm/deps.d.ts +0 -9
- package/esm/deps.js +0 -12
- package/script/deps.d.ts +0 -9
- package/script/deps.js +0 -70
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* A runtime-agnostic collection of methods for working with Uint8Arrays
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
2
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
7
|
+
exports.areEqual = areEqual;
|
|
8
|
+
exports.toHex = toHex;
|
|
9
|
+
exports.fromHex = fromHex;
|
|
10
|
+
exports.concat = concat;
|
|
11
|
+
exports.toUTF8String = toUTF8String;
|
|
12
|
+
exports.fromUTF8String = fromUTF8String;
|
|
13
|
+
exports.fromASCIIString = fromASCIIString;
|
|
14
|
+
exports.toDataView = toDataView;
|
|
4
15
|
/**
|
|
5
16
|
* Make sure two Uint8Arrays are deeply equivalent
|
|
6
17
|
*/
|
|
@@ -10,7 +21,6 @@ function areEqual(array1, array2) {
|
|
|
10
21
|
}
|
|
11
22
|
return array1.every((val, i) => val === array2[i]);
|
|
12
23
|
}
|
|
13
|
-
exports.areEqual = areEqual;
|
|
14
24
|
/**
|
|
15
25
|
* Convert a Uint8Array to Hexadecimal.
|
|
16
26
|
*
|
|
@@ -21,7 +31,6 @@ function toHex(array) {
|
|
|
21
31
|
// adce000235bcc60a648b0b25f1f05503
|
|
22
32
|
return hexParts.join('');
|
|
23
33
|
}
|
|
24
|
-
exports.toHex = toHex;
|
|
25
34
|
/**
|
|
26
35
|
* Convert a hexadecimal string to isoUint8Array.
|
|
27
36
|
*
|
|
@@ -39,7 +48,6 @@ function fromHex(hex) {
|
|
|
39
48
|
const byteStrings = hex.match(/.{1,2}/g) ?? [];
|
|
40
49
|
return Uint8Array.from(byteStrings.map((byte) => parseInt(byte, 16)));
|
|
41
50
|
}
|
|
42
|
-
exports.fromHex = fromHex;
|
|
43
51
|
/**
|
|
44
52
|
* Combine multiple Uint8Arrays into a single Uint8Array
|
|
45
53
|
*/
|
|
@@ -53,7 +61,6 @@ function concat(arrays) {
|
|
|
53
61
|
});
|
|
54
62
|
return toReturn;
|
|
55
63
|
}
|
|
56
|
-
exports.concat = concat;
|
|
57
64
|
/**
|
|
58
65
|
* Convert bytes into a UTF-8 string
|
|
59
66
|
*/
|
|
@@ -61,7 +68,6 @@ function toUTF8String(array) {
|
|
|
61
68
|
const decoder = new globalThis.TextDecoder('utf-8');
|
|
62
69
|
return decoder.decode(array);
|
|
63
70
|
}
|
|
64
|
-
exports.toUTF8String = toUTF8String;
|
|
65
71
|
/**
|
|
66
72
|
* Convert a UTF-8 string back into bytes
|
|
67
73
|
*/
|
|
@@ -69,18 +75,15 @@ function fromUTF8String(utf8String) {
|
|
|
69
75
|
const encoder = new globalThis.TextEncoder();
|
|
70
76
|
return encoder.encode(utf8String);
|
|
71
77
|
}
|
|
72
|
-
exports.fromUTF8String = fromUTF8String;
|
|
73
78
|
/**
|
|
74
79
|
* Convert an ASCII string to Uint8Array
|
|
75
80
|
*/
|
|
76
81
|
function fromASCIIString(value) {
|
|
77
82
|
return Uint8Array.from(value.split('').map((x) => x.charCodeAt(0)));
|
|
78
83
|
}
|
|
79
|
-
exports.fromASCIIString = fromASCIIString;
|
|
80
84
|
/**
|
|
81
85
|
* Prepare a DataView we can slice our way around in as we parse the bytes in a Uint8Array
|
|
82
86
|
*/
|
|
83
87
|
function toDataView(array) {
|
|
84
88
|
return new DataView(array.buffer, array.byteOffset, array.length);
|
|
85
89
|
}
|
|
86
|
-
exports.toDataView = toDataView;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../src/helpers/logging.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,CAGvF"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// import { debug, Debugger } from '../deps.ts';
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getLogger = void 0;
|
|
5
2
|
// const defaultLogger = debug('SimpleWebAuthn');
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getLogger = getLogger;
|
|
6
5
|
/**
|
|
7
6
|
* Generate an instance of a `debug` logger that extends off of the "simplewebauthn" namespace for
|
|
8
7
|
* consistent naming.
|
|
@@ -21,4 +20,3 @@ function getLogger(_name) {
|
|
|
21
20
|
// This is a noop for now while I search for a better debug logger technique
|
|
22
21
|
return (_message, ..._rest) => { };
|
|
23
22
|
}
|
|
24
|
-
exports.getLogger = getLogger;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapX509SignatureAlgToCOSEAlg.d.ts","sourceRoot":"","sources":["../../src/helpers/mapX509SignatureAlgToCOSEAlg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,kBAAkB,EAAE,MAAM,GACzB,OAAO,CAwBT"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mapX509SignatureAlgToCOSEAlg =
|
|
3
|
+
exports.mapX509SignatureAlgToCOSEAlg = mapX509SignatureAlgToCOSEAlg;
|
|
4
4
|
const cose_js_1 = require("./cose.js");
|
|
5
5
|
/**
|
|
6
6
|
* Map X.509 signature algorithm OIDs to COSE algorithm IDs
|
|
@@ -36,4 +36,3 @@ function mapX509SignatureAlgToCOSEAlg(signatureAlgorithm) {
|
|
|
36
36
|
}
|
|
37
37
|
return alg;
|
|
38
38
|
}
|
|
39
|
-
exports.mapX509SignatureAlgToCOSEAlg = mapX509SignatureAlgToCOSEAlg;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matchExpectedRPID.d.ts","sourceRoot":"","sources":["../../src/helpers/matchExpectedRPID.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,UAAU,EACpB,aAAa,EAAE,MAAM,EAAE,GACtB,OAAO,CAAC,MAAM,CAAC,CA8BjB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.matchExpectedRPID =
|
|
3
|
+
exports.matchExpectedRPID = matchExpectedRPID;
|
|
4
4
|
const toHash_js_1 = require("./toHash.js");
|
|
5
5
|
const index_js_1 = require("./iso/index.js");
|
|
6
6
|
/**
|
|
@@ -35,7 +35,6 @@ async function matchExpectedRPID(rpIDHash, expectedRPIDs) {
|
|
|
35
35
|
throw err;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
exports.matchExpectedRPID = matchExpectedRPID;
|
|
39
38
|
class UnexpectedRPIDHash extends Error {
|
|
40
39
|
constructor() {
|
|
41
40
|
const message = 'Unexpected RP ID hash';
|
|
@@ -23,6 +23,11 @@ export type ParsedAuthenticatorData = {
|
|
|
23
23
|
extensionsData?: AuthenticationExtensionsAuthenticatorOutputs;
|
|
24
24
|
extensionsDataBuffer?: Uint8Array;
|
|
25
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Make it possible to stub the return value during testing
|
|
28
|
+
* @ignore Don't include this in docs output
|
|
29
|
+
*/
|
|
26
30
|
export declare const _parseAuthenticatorDataInternals: {
|
|
27
31
|
stubThis: (value: ParsedAuthenticatorData) => ParsedAuthenticatorData;
|
|
28
32
|
};
|
|
33
|
+
//# sourceMappingURL=parseAuthenticatorData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseAuthenticatorData.d.ts","sourceRoot":"","sources":["../../src/helpers/parseAuthenticatorData.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4CAA4C,EAE7C,MAAM,oCAAoC,CAAC;AAI5C;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,UAAU,GACnB,uBAAuB,CAwHzB;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,UAAU,CAAC;IACrB,QAAQ,EAAE,UAAU,CAAC;IACrB,KAAK,EAAE;QACL,EAAE,EAAE,OAAO,CAAC;QACZ,EAAE,EAAE,OAAO,CAAC;QACZ,EAAE,EAAE,OAAO,CAAC;QACZ,EAAE,EAAE,OAAO,CAAC;QACZ,EAAE,EAAE,OAAO,CAAC;QACZ,EAAE,EAAE,OAAO,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,mBAAmB,CAAC,EAAE,UAAU,CAAC;IACjC,cAAc,CAAC,EAAE,4CAA4C,CAAC;IAC9D,oBAAoB,CAAC,EAAE,UAAU,CAAC;CACnC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gCAAgC;sBACzB,uBAAuB;CAC1C,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._parseAuthenticatorDataInternals =
|
|
3
|
+
exports._parseAuthenticatorDataInternals = void 0;
|
|
4
|
+
exports.parseAuthenticatorData = parseAuthenticatorData;
|
|
4
5
|
const decodeAuthenticatorExtensions_js_1 = require("./decodeAuthenticatorExtensions.js");
|
|
5
6
|
const index_js_1 = require("./iso/index.js");
|
|
6
7
|
/**
|
|
@@ -18,12 +19,12 @@ function parseAuthenticatorData(authData) {
|
|
|
18
19
|
// Bit positions can be referenced here:
|
|
19
20
|
// https://www.w3.org/TR/webauthn-2/#flags
|
|
20
21
|
const flags = {
|
|
21
|
-
up: !!(flagsInt & (1 << 0)),
|
|
22
|
-
uv: !!(flagsInt & (1 << 2)),
|
|
23
|
-
be: !!(flagsInt & (1 << 3)),
|
|
24
|
-
bs: !!(flagsInt & (1 << 4)),
|
|
25
|
-
at: !!(flagsInt & (1 << 6)),
|
|
26
|
-
ed: !!(flagsInt & (1 << 7)),
|
|
22
|
+
up: !!(flagsInt & (1 << 0)), // User Presence
|
|
23
|
+
uv: !!(flagsInt & (1 << 2)), // User Verified
|
|
24
|
+
be: !!(flagsInt & (1 << 3)), // Backup Eligibility
|
|
25
|
+
bs: !!(flagsInt & (1 << 4)), // Backup State
|
|
26
|
+
at: !!(flagsInt & (1 << 6)), // Attested Credential Data Present
|
|
27
|
+
ed: !!(flagsInt & (1 << 7)), // Extension Data Present
|
|
27
28
|
flagsInt,
|
|
28
29
|
};
|
|
29
30
|
const counterBuf = authData.slice(pointer, pointer + 4);
|
|
@@ -100,8 +101,10 @@ function parseAuthenticatorData(authData) {
|
|
|
100
101
|
extensionsDataBuffer,
|
|
101
102
|
});
|
|
102
103
|
}
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Make it possible to stub the return value during testing
|
|
106
|
+
* @ignore Don't include this in docs output
|
|
107
|
+
*/
|
|
105
108
|
exports._parseAuthenticatorDataInternals = {
|
|
106
109
|
stubThis: (value) => value,
|
|
107
110
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CredentialDeviceType } from '../
|
|
1
|
+
import type { CredentialDeviceType } from '../types/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Make sense of Bits 3 and 4 in authenticator indicating:
|
|
4
4
|
*
|
|
@@ -17,3 +17,4 @@ export declare function parseBackupFlags({ be, bs }: {
|
|
|
17
17
|
export declare class InvalidBackupFlags extends Error {
|
|
18
18
|
constructor(message: string);
|
|
19
19
|
}
|
|
20
|
+
//# sourceMappingURL=parseBackupFlags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseBackupFlags.d.ts","sourceRoot":"","sources":["../../src/helpers/parseBackupFlags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,EAAE,EAAE,OAAO,CAAA;CAAE,GAAG;IAC1E,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAeA;AAED,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM;CAI5B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InvalidBackupFlags =
|
|
3
|
+
exports.InvalidBackupFlags = void 0;
|
|
4
|
+
exports.parseBackupFlags = parseBackupFlags;
|
|
4
5
|
/**
|
|
5
6
|
* Make sense of Bits 3 and 4 in authenticator indicating:
|
|
6
7
|
*
|
|
@@ -20,7 +21,6 @@ function parseBackupFlags({ be, bs }) {
|
|
|
20
21
|
}
|
|
21
22
|
return { credentialDeviceType, credentialBackedUp };
|
|
22
23
|
}
|
|
23
|
-
exports.parseBackupFlags = parseBackupFlags;
|
|
24
24
|
class InvalidBackupFlags extends Error {
|
|
25
25
|
constructor(message) {
|
|
26
26
|
super(message);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toHash.d.ts","sourceRoot":"","sources":["../../src/helpers/toHash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;;GAGG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,UAAU,GAAG,MAAM,EACzB,SAAS,GAAE,OAAY,GACtB,OAAO,CAAC,UAAU,CAAC,CAQrB"}
|
package/script/helpers/toHash.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toHash =
|
|
3
|
+
exports.toHash = toHash;
|
|
4
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
|
|
@@ -13,4 +13,3 @@ function toHash(data, algorithm = -7) {
|
|
|
13
13
|
const digest = index_js_1.isoCrypto.digest(data, algorithm);
|
|
14
14
|
return digest;
|
|
15
15
|
}
|
|
16
|
-
exports.toHash = toHash;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Traverse an array of PEM certificates and ensure they form a proper chain
|
|
3
|
-
* @param
|
|
4
|
-
* @param
|
|
3
|
+
* @param x5cCertsPEM Typically the result of `x5c.map(convertASN1toPEM)`
|
|
4
|
+
* @param trustAnchorsPEM PEM-formatted certs that an attestation statement x5c may chain back to
|
|
5
5
|
*/
|
|
6
|
-
export declare function validateCertificatePath(
|
|
6
|
+
export declare function validateCertificatePath(x5cCertsPEM: string[], trustAnchorsPEM?: string[]): Promise<boolean>;
|
|
7
|
+
//# sourceMappingURL=validateCertificatePath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateCertificatePath.d.ts","sourceRoot":"","sources":["../../src/helpers/validateCertificatePath.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,MAAM,EAAE,EACrB,eAAe,GAAE,MAAM,EAAO,GAC7B,OAAO,CAAC,OAAO,CAAC,CAsClB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateCertificatePath =
|
|
4
|
-
const
|
|
3
|
+
exports.validateCertificatePath = validateCertificatePath;
|
|
4
|
+
const asn1_schema_1 = require("@peculiar/asn1-schema");
|
|
5
5
|
const isCertRevoked_js_1 = require("./isCertRevoked.js");
|
|
6
6
|
const verifySignature_js_1 = require("./verifySignature.js");
|
|
7
7
|
const mapX509SignatureAlgToCOSEAlg_js_1 = require("./mapX509SignatureAlgToCOSEAlg.js");
|
|
@@ -9,23 +9,22 @@ const getCertificateInfo_js_1 = require("./getCertificateInfo.js");
|
|
|
9
9
|
const convertPEMToBytes_js_1 = require("./convertPEMToBytes.js");
|
|
10
10
|
/**
|
|
11
11
|
* Traverse an array of PEM certificates and ensure they form a proper chain
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
12
|
+
* @param x5cCertsPEM Typically the result of `x5c.map(convertASN1toPEM)`
|
|
13
|
+
* @param trustAnchorsPEM PEM-formatted certs that an attestation statement x5c may chain back to
|
|
14
14
|
*/
|
|
15
|
-
async function validateCertificatePath(
|
|
16
|
-
if (
|
|
17
|
-
// We have no
|
|
18
|
-
// TODO: Is this going to be acceptable default behavior??
|
|
15
|
+
async function validateCertificatePath(x5cCertsPEM, trustAnchorsPEM = []) {
|
|
16
|
+
if (trustAnchorsPEM.length === 0) {
|
|
17
|
+
// We have no trust anchors to chain back to, so skip path validation
|
|
19
18
|
return true;
|
|
20
19
|
}
|
|
21
20
|
let invalidSubjectAndIssuerError = false;
|
|
22
21
|
let certificateNotYetValidOrExpiredErrorMessage = undefined;
|
|
23
|
-
for (const
|
|
22
|
+
for (const anchorPEM of trustAnchorsPEM) {
|
|
24
23
|
try {
|
|
25
|
-
const
|
|
26
|
-
await _validatePath(
|
|
24
|
+
const certsWithTrustAnchor = x5cCertsPEM.concat([anchorPEM]);
|
|
25
|
+
await _validatePath(certsWithTrustAnchor);
|
|
27
26
|
// If we successfully validated a path then there's no need to continue. Reset any existing
|
|
28
|
-
// errors that were thrown by earlier
|
|
27
|
+
// errors that were thrown by earlier trust anchors
|
|
29
28
|
invalidSubjectAndIssuerError = false;
|
|
30
29
|
certificateNotYetValidOrExpiredErrorMessage = undefined;
|
|
31
30
|
break;
|
|
@@ -42,7 +41,7 @@ async function validateCertificatePath(certificates, rootCertificates = []) {
|
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
|
-
// We tried multiple
|
|
44
|
+
// We tried multiple trust anchors and none of them worked
|
|
46
45
|
if (invalidSubjectAndIssuerError) {
|
|
47
46
|
throw new InvalidSubjectAndIssuer();
|
|
48
47
|
}
|
|
@@ -51,65 +50,81 @@ async function validateCertificatePath(certificates, rootCertificates = []) {
|
|
|
51
50
|
}
|
|
52
51
|
return true;
|
|
53
52
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
/**
|
|
54
|
+
* @param x5cCerts X.509 `x5c` certs in PEM string format
|
|
55
|
+
* @param anchorCert X.509 trust anchor cert in PEM string format
|
|
56
|
+
*/
|
|
57
|
+
async function _validatePath(x5cCertsWithTrustAnchorPEM) {
|
|
58
|
+
if (new Set(x5cCertsWithTrustAnchorPEM).size !== x5cCertsWithTrustAnchorPEM.length) {
|
|
57
59
|
throw new Error('Invalid certificate path: found duplicate certificates');
|
|
58
60
|
}
|
|
59
|
-
//
|
|
60
|
-
for (
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
issuerPem = certificates[i + 1];
|
|
70
|
-
}
|
|
61
|
+
// Make sure no certs are revoked, and all are within their time validity window
|
|
62
|
+
for (const certificatePEM of x5cCertsWithTrustAnchorPEM) {
|
|
63
|
+
const certInfo = (0, getCertificateInfo_js_1.getCertificateInfo)((0, convertPEMToBytes_js_1.convertPEMToBytes)(certificatePEM));
|
|
64
|
+
await assertCertNotRevoked(certInfo.parsedCertificate);
|
|
65
|
+
assertCertIsWithinValidTimeWindow(certInfo, certificatePEM);
|
|
66
|
+
}
|
|
67
|
+
// Make sure each x5c cert is issued by the next certificate in the chain
|
|
68
|
+
for (let i = 0; i < (x5cCertsWithTrustAnchorPEM.length - 1); i += 1) {
|
|
69
|
+
const subjectPem = x5cCertsWithTrustAnchorPEM[i];
|
|
70
|
+
const issuerPem = x5cCertsWithTrustAnchorPEM[i + 1];
|
|
71
71
|
const subjectInfo = (0, getCertificateInfo_js_1.getCertificateInfo)((0, convertPEMToBytes_js_1.convertPEMToBytes)(subjectPem));
|
|
72
72
|
const issuerInfo = (0, getCertificateInfo_js_1.getCertificateInfo)((0, convertPEMToBytes_js_1.convertPEMToBytes)(issuerPem));
|
|
73
|
-
|
|
74
|
-
// Check for certificate revocation
|
|
75
|
-
const subjectCertRevoked = await (0, isCertRevoked_js_1.isCertRevoked)(x509Subject);
|
|
76
|
-
if (subjectCertRevoked) {
|
|
77
|
-
throw new Error(`Found revoked certificate in certificate path`);
|
|
78
|
-
}
|
|
79
|
-
// Check that intermediate certificate is within its valid time window
|
|
80
|
-
const { notBefore, notAfter } = issuerInfo;
|
|
81
|
-
const now = new Date(Date.now());
|
|
82
|
-
if (notBefore > now || notAfter < now) {
|
|
83
|
-
if (isLeafCert) {
|
|
84
|
-
throw new CertificateNotYetValidOrExpired(`Leaf certificate is not yet valid or expired: ${issuerPem}`);
|
|
85
|
-
}
|
|
86
|
-
else if (isRootCert) {
|
|
87
|
-
throw new CertificateNotYetValidOrExpired(`Root certificate is not yet valid or expired: ${issuerPem}`);
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
throw new CertificateNotYetValidOrExpired(`Intermediate certificate is not yet valid or expired: ${issuerPem}`);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
73
|
+
// Make sure subject issuer is issuer subject
|
|
93
74
|
if (subjectInfo.issuer.combined !== issuerInfo.subject.combined) {
|
|
94
75
|
throw new InvalidSubjectAndIssuer();
|
|
95
76
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const verified = await (0, verifySignature_js_1.verifySignature)({
|
|
102
|
-
data: new Uint8Array(data),
|
|
103
|
-
signature: new Uint8Array(signature),
|
|
104
|
-
x509Certificate: issuerCertBytes,
|
|
105
|
-
hashAlgorithm: signatureAlgorithm,
|
|
106
|
-
});
|
|
107
|
-
if (!verified) {
|
|
108
|
-
throw new Error('Invalid certificate path: invalid signature');
|
|
77
|
+
const issuerCertIsRootCert = issuerInfo.issuer.combined === issuerInfo.subject.combined;
|
|
78
|
+
await assertSubjectIsSignedByIssuer(subjectInfo.parsedCertificate, issuerPem);
|
|
79
|
+
// Perform one final check if the issuer cert is also a root certificate
|
|
80
|
+
if (issuerCertIsRootCert) {
|
|
81
|
+
await assertSubjectIsSignedByIssuer(issuerInfo.parsedCertificate, issuerPem);
|
|
109
82
|
}
|
|
110
83
|
}
|
|
111
84
|
return true;
|
|
112
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Check if the certificate is revoked or not. If it is, raise an error
|
|
88
|
+
*/
|
|
89
|
+
async function assertCertNotRevoked(certificate) {
|
|
90
|
+
// Check for certificate revocation
|
|
91
|
+
const subjectCertRevoked = await (0, isCertRevoked_js_1.isCertRevoked)(certificate);
|
|
92
|
+
if (subjectCertRevoked) {
|
|
93
|
+
throw new Error(`Found revoked certificate in certificate path`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Require the cert to be within its notBefore and notAfter time window
|
|
98
|
+
*
|
|
99
|
+
* @param certInfo Parsed cert information
|
|
100
|
+
* @param certPEM PEM-formatted certificate, for error reporting
|
|
101
|
+
*/
|
|
102
|
+
function assertCertIsWithinValidTimeWindow(certInfo, certPEM) {
|
|
103
|
+
const { notBefore, notAfter } = certInfo;
|
|
104
|
+
const now = new Date(Date.now());
|
|
105
|
+
if (notBefore > now || notAfter < now) {
|
|
106
|
+
throw new CertificateNotYetValidOrExpired(`Certificate is not yet valid or expired: ${certPEM}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Ensure that the subject cert has been signed by the next cert in the chain
|
|
111
|
+
*/
|
|
112
|
+
async function assertSubjectIsSignedByIssuer(subjectCert, issuerPEM) {
|
|
113
|
+
// Verify the subject certificate's signature with the issuer cert's public key
|
|
114
|
+
const data = asn1_schema_1.AsnSerializer.serialize(subjectCert.tbsCertificate);
|
|
115
|
+
const signature = subjectCert.signatureValue;
|
|
116
|
+
const signatureAlgorithm = (0, mapX509SignatureAlgToCOSEAlg_js_1.mapX509SignatureAlgToCOSEAlg)(subjectCert.signatureAlgorithm.algorithm);
|
|
117
|
+
const issuerCertBytes = (0, convertPEMToBytes_js_1.convertPEMToBytes)(issuerPEM);
|
|
118
|
+
const verified = await (0, verifySignature_js_1.verifySignature)({
|
|
119
|
+
data: new Uint8Array(data),
|
|
120
|
+
signature: new Uint8Array(signature),
|
|
121
|
+
x509Certificate: issuerCertBytes,
|
|
122
|
+
hashAlgorithm: signatureAlgorithm,
|
|
123
|
+
});
|
|
124
|
+
if (!verified) {
|
|
125
|
+
throw new InvalidSubjectSignatureForIssuer();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
113
128
|
// Custom errors to help pass on certain errors
|
|
114
129
|
class InvalidSubjectAndIssuer extends Error {
|
|
115
130
|
constructor() {
|
|
@@ -118,6 +133,13 @@ class InvalidSubjectAndIssuer extends Error {
|
|
|
118
133
|
this.name = 'InvalidSubjectAndIssuer';
|
|
119
134
|
}
|
|
120
135
|
}
|
|
136
|
+
class InvalidSubjectSignatureForIssuer extends Error {
|
|
137
|
+
constructor() {
|
|
138
|
+
const message = 'Subject signature was invalid for issuer';
|
|
139
|
+
super(message);
|
|
140
|
+
this.name = 'InvalidSubjectSignatureForIssuer';
|
|
141
|
+
}
|
|
142
|
+
}
|
|
121
143
|
class CertificateNotYetValidOrExpired extends Error {
|
|
122
144
|
constructor(message) {
|
|
123
145
|
super(message);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Extensions } from '
|
|
1
|
+
import { Extensions } from '@peculiar/asn1-x509';
|
|
2
2
|
/**
|
|
3
3
|
* Look for the id-fido-gen-ce-aaguid certificate extension. If it's present then check it against
|
|
4
4
|
* the attestation statement AAGUID.
|
|
5
5
|
*/
|
|
6
6
|
export declare function validateExtFIDOGenCEAAGUID(certExtensions: Extensions | undefined, aaguid: Uint8Array): boolean;
|
|
7
|
+
//# sourceMappingURL=validateExtFIDOGenCEAAGUID.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateExtFIDOGenCEAAGUID.d.ts","sourceRoot":"","sources":["../../src/helpers/validateExtFIDOGenCEAAGUID.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAWjD;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,UAAU,GAAG,SAAS,EACtC,MAAM,EAAE,UAAU,GACjB,OAAO,CA6BT"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateExtFIDOGenCEAAGUID =
|
|
4
|
-
const
|
|
3
|
+
exports.validateExtFIDOGenCEAAGUID = validateExtFIDOGenCEAAGUID;
|
|
4
|
+
const asn1_schema_1 = require("@peculiar/asn1-schema");
|
|
5
5
|
const index_js_1 = require("./iso/index.js");
|
|
6
6
|
/**
|
|
7
7
|
* Attestation Certificate Extension OID: `id-fido-gen-ce-aaguid`
|
|
@@ -24,7 +24,7 @@ function validateExtFIDOGenCEAAGUID(certExtensions, aaguid) {
|
|
|
24
24
|
return true;
|
|
25
25
|
}
|
|
26
26
|
// Parse the extension value
|
|
27
|
-
const parsedExtFIDOGenCEAAGUID =
|
|
27
|
+
const parsedExtFIDOGenCEAAGUID = asn1_schema_1.AsnParser.parse(extFIDOGenCEAAGUID.extnValue, asn1_schema_1.OctetString);
|
|
28
28
|
const extValue = new Uint8Array(parsedExtFIDOGenCEAAGUID.buffer);
|
|
29
29
|
// Compare the two values
|
|
30
30
|
const aaguidAndExtAreEqual = index_js_1.isoUint8Array.areEqual(aaguid, extValue);
|
|
@@ -35,4 +35,3 @@ function validateExtFIDOGenCEAAGUID(certExtensions, aaguid) {
|
|
|
35
35
|
}
|
|
36
36
|
return true;
|
|
37
37
|
}
|
|
38
|
-
exports.validateExtFIDOGenCEAAGUID = validateExtFIDOGenCEAAGUID;
|
|
@@ -9,6 +9,11 @@ export declare function verifySignature(opts: {
|
|
|
9
9
|
x509Certificate?: Uint8Array;
|
|
10
10
|
hashAlgorithm?: COSEALG;
|
|
11
11
|
}): Promise<boolean>;
|
|
12
|
+
/**
|
|
13
|
+
* Make it possible to stub the return value during testing
|
|
14
|
+
* @ignore Don't include this in docs output
|
|
15
|
+
*/
|
|
12
16
|
export declare const _verifySignatureInternals: {
|
|
13
17
|
stubThis: (value: Promise<boolean>) => Promise<boolean>;
|
|
14
18
|
};
|
|
19
|
+
//# sourceMappingURL=verifySignature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifySignature.d.ts","sourceRoot":"","sources":["../../src/helpers/verifySignature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAiB,MAAM,WAAW,CAAC;AAKnD;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE;IACpC,SAAS,EAAE,UAAU,CAAC;IACtB,IAAI,EAAE,UAAU,CAAC;IACjB,mBAAmB,CAAC,EAAE,UAAU,CAAC;IACjC,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,OAAO,CAAC,OAAO,CAAC,CAmCnB;AAED;;;GAGG;AACH,eAAO,MAAM,yBAAyB;sBAClB,OAAO,CAAC,OAAO,CAAC;CACnC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._verifySignatureInternals =
|
|
3
|
+
exports._verifySignatureInternals = void 0;
|
|
4
|
+
exports.verifySignature = verifySignature;
|
|
4
5
|
const index_js_1 = require("./iso/index.js");
|
|
5
6
|
const decodeCredentialPublicKey_js_1 = require("./decodeCredentialPublicKey.js");
|
|
6
7
|
const convertX509PublicKeyToCOSE_js_1 = require("./convertX509PublicKeyToCOSE.js");
|
|
@@ -29,8 +30,10 @@ function verifySignature(opts) {
|
|
|
29
30
|
shaHashOverride: hashAlgorithm,
|
|
30
31
|
}));
|
|
31
32
|
}
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Make it possible to stub the return value during testing
|
|
35
|
+
* @ignore Don't include this in docs output
|
|
36
|
+
*/
|
|
34
37
|
exports._verifySignatureInternals = {
|
|
35
38
|
stubThis: (value) => value,
|
|
36
39
|
};
|
package/script/index.d.ts
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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, };
|
|
1
|
+
export * from './registration/generateRegistrationOptions.js';
|
|
2
|
+
export * from './registration/verifyRegistrationResponse.js';
|
|
3
|
+
export * from './authentication/generateAuthenticationOptions.js';
|
|
4
|
+
export * from './authentication/verifyAuthenticationResponse.js';
|
|
5
|
+
export * from './services/metadataService.js';
|
|
6
|
+
export * from './services/settingsService.js';
|
|
7
|
+
export * from './metadata/mdsTypes.js';
|
|
8
|
+
export * from './types/index.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+CAA+C,CAAC;AAC9D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,mDAAmD,CAAC;AAClE,cAAc,kDAAkD,CAAC;AACjE,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC"}
|
package/script/index.js
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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; } });
|
|
17
|
+
__exportStar(require("./registration/generateRegistrationOptions.js"), exports);
|
|
18
|
+
__exportStar(require("./registration/verifyRegistrationResponse.js"), exports);
|
|
19
|
+
__exportStar(require("./authentication/generateAuthenticationOptions.js"), exports);
|
|
20
|
+
__exportStar(require("./authentication/verifyAuthenticationResponse.js"), exports);
|
|
21
|
+
__exportStar(require("./services/metadataService.js"), exports);
|
|
22
|
+
__exportStar(require("./services/settingsService.js"), exports);
|
|
23
|
+
__exportStar(require("./metadata/mdsTypes.js"), exports);
|
|
24
|
+
__exportStar(require("./types/index.js"), exports);
|