@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,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._decodeAttestationObjectInternals = exports.decodeAttestationObject = void 0;
|
|
4
|
+
const index_js_1 = require("./iso/index.js");
|
|
5
|
+
/**
|
|
6
|
+
* Convert an AttestationObject buffer to a proper object
|
|
7
|
+
*
|
|
8
|
+
* @param base64AttestationObject Attestation Object buffer
|
|
9
|
+
*/
|
|
10
|
+
function decodeAttestationObject(attestationObject) {
|
|
11
|
+
return exports._decodeAttestationObjectInternals.stubThis(index_js_1.isoCBOR.decodeFirst(attestationObject));
|
|
12
|
+
}
|
|
13
|
+
exports.decodeAttestationObject = decodeAttestationObject;
|
|
14
|
+
// Make it possible to stub the return value during testing
|
|
15
|
+
exports._decodeAttestationObjectInternals = {
|
|
16
|
+
stubThis: (value) => value,
|
|
17
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert authenticator extension data buffer to a proper object
|
|
3
|
+
*
|
|
4
|
+
* @param extensionData Authenticator Extension Data buffer
|
|
5
|
+
*/
|
|
6
|
+
export declare function decodeAuthenticatorExtensions(extensionData: Uint8Array): AuthenticationExtensionsAuthenticatorOutputs | undefined;
|
|
7
|
+
export type AuthenticationExtensionsAuthenticatorOutputs = {
|
|
8
|
+
devicePubKey?: DevicePublicKeyAuthenticatorOutput;
|
|
9
|
+
uvm?: UVMAuthenticatorOutput;
|
|
10
|
+
};
|
|
11
|
+
export type DevicePublicKeyAuthenticatorOutput = {
|
|
12
|
+
dpk?: Uint8Array;
|
|
13
|
+
sig?: string;
|
|
14
|
+
nonce?: Uint8Array;
|
|
15
|
+
scope?: Uint8Array;
|
|
16
|
+
aaguid?: Uint8Array;
|
|
17
|
+
};
|
|
18
|
+
export type UVMAuthenticatorOutput = {
|
|
19
|
+
uvm?: Uint8Array[];
|
|
20
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.decodeAuthenticatorExtensions = void 0;
|
|
4
|
-
const
|
|
4
|
+
const index_js_1 = require("./iso/index.js");
|
|
5
5
|
/**
|
|
6
6
|
* Convert authenticator extension data buffer to a proper object
|
|
7
7
|
*
|
|
@@ -10,7 +10,7 @@ const iso_1 = require("./iso");
|
|
|
10
10
|
function decodeAuthenticatorExtensions(extensionData) {
|
|
11
11
|
let toCBOR;
|
|
12
12
|
try {
|
|
13
|
-
toCBOR =
|
|
13
|
+
toCBOR = index_js_1.isoCBOR.decodeFirst(extensionData);
|
|
14
14
|
}
|
|
15
15
|
catch (err) {
|
|
16
16
|
const _err = err;
|
|
@@ -36,4 +36,3 @@ function convertMapToObjectDeep(input) {
|
|
|
36
36
|
}
|
|
37
37
|
return mapped;
|
|
38
38
|
}
|
|
39
|
-
//# sourceMappingURL=decodeAuthenticatorExtensions.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decode an authenticator's base64url-encoded clientDataJSON to JSON
|
|
3
|
+
*/
|
|
4
|
+
export declare function decodeClientDataJSON(data: string): ClientDataJSON;
|
|
5
|
+
export type ClientDataJSON = {
|
|
6
|
+
type: string;
|
|
7
|
+
challenge: string;
|
|
8
|
+
origin: string;
|
|
9
|
+
crossOrigin?: boolean;
|
|
10
|
+
tokenBinding?: {
|
|
11
|
+
id?: string;
|
|
12
|
+
status: 'present' | 'supported' | 'not-supported';
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare const _decodeClientDataJSONInternals: {
|
|
16
|
+
stubThis: (value: ClientDataJSON) => ClientDataJSON;
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._decodeClientDataJSONInternals = exports.decodeClientDataJSON = void 0;
|
|
4
|
+
const index_js_1 = require("./iso/index.js");
|
|
5
|
+
/**
|
|
6
|
+
* Decode an authenticator's base64url-encoded clientDataJSON to JSON
|
|
7
|
+
*/
|
|
8
|
+
function decodeClientDataJSON(data) {
|
|
9
|
+
const toString = index_js_1.isoBase64URL.toString(data);
|
|
10
|
+
const clientData = JSON.parse(toString);
|
|
11
|
+
return exports._decodeClientDataJSONInternals.stubThis(clientData);
|
|
12
|
+
}
|
|
13
|
+
exports.decodeClientDataJSON = decodeClientDataJSON;
|
|
14
|
+
// Make it possible to stub the return value during testing
|
|
15
|
+
exports._decodeClientDataJSONInternals = {
|
|
16
|
+
stubThis: (value) => value,
|
|
17
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._decodeCredentialPublicKeyInternals = exports.decodeCredentialPublicKey = void 0;
|
|
4
|
+
const index_js_1 = require("./iso/index.js");
|
|
5
|
+
function decodeCredentialPublicKey(publicKey) {
|
|
6
|
+
return exports._decodeCredentialPublicKeyInternals.stubThis(index_js_1.isoCBOR.decodeFirst(publicKey));
|
|
7
|
+
}
|
|
8
|
+
exports.decodeCredentialPublicKey = decodeCredentialPublicKey;
|
|
9
|
+
// Make it possible to stub the return value during testing
|
|
10
|
+
exports._decodeCredentialPublicKeyInternals = {
|
|
11
|
+
stubThis: (value) => value,
|
|
12
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A simple method for requesting data via standard `fetch`. Should work
|
|
3
|
+
* across multiple runtimes.
|
|
4
|
+
*/
|
|
5
|
+
export declare function fetch(url: string): Promise<Response>;
|
|
6
|
+
export declare const _fetchInternals: {
|
|
7
|
+
stubThis: (url: string) => Promise<Response>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._fetchInternals = exports.fetch = void 0;
|
|
4
|
+
const deps_js_1 = require("../deps.js");
|
|
5
|
+
/**
|
|
6
|
+
* A simple method for requesting data via standard `fetch`. Should work
|
|
7
|
+
* across multiple runtimes.
|
|
8
|
+
*/
|
|
9
|
+
function fetch(url) {
|
|
10
|
+
return exports._fetchInternals.stubThis(url);
|
|
11
|
+
}
|
|
12
|
+
exports.fetch = fetch;
|
|
13
|
+
// Make it possible to stub the return value during testing
|
|
14
|
+
exports._fetchInternals = {
|
|
15
|
+
stubThis: (url) => (0, deps_js_1.crossFetch)(url),
|
|
16
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate a suitably random value to be used as an attestation or assertion challenge
|
|
3
|
+
*/
|
|
4
|
+
export declare function generateChallenge(): Promise<Uint8Array>;
|
|
5
|
+
export declare const _generateChallengeInternals: {
|
|
6
|
+
stubThis: (value: Uint8Array) => Uint8Array;
|
|
7
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateChallenge = void 0;
|
|
4
|
-
const
|
|
3
|
+
exports._generateChallengeInternals = exports.generateChallenge = void 0;
|
|
4
|
+
const index_js_1 = require("./iso/index.js");
|
|
5
5
|
/**
|
|
6
6
|
* Generate a suitably random value to be used as an attestation or assertion challenge
|
|
7
7
|
*/
|
|
8
|
-
function generateChallenge() {
|
|
8
|
+
async function generateChallenge() {
|
|
9
9
|
/**
|
|
10
10
|
* WebAuthn spec says that 16 bytes is a good minimum:
|
|
11
11
|
*
|
|
@@ -15,8 +15,11 @@ function generateChallenge() {
|
|
|
15
15
|
* Just in case, let's double it
|
|
16
16
|
*/
|
|
17
17
|
const challenge = new Uint8Array(32);
|
|
18
|
-
|
|
19
|
-
return challenge;
|
|
18
|
+
await index_js_1.isoCrypto.getRandomValues(challenge);
|
|
19
|
+
return exports._generateChallengeInternals.stubThis(challenge);
|
|
20
20
|
}
|
|
21
21
|
exports.generateChallenge = generateChallenge;
|
|
22
|
-
|
|
22
|
+
// Make it possible to stub the return value during testing
|
|
23
|
+
exports._generateChallengeInternals = {
|
|
24
|
+
stubThis: (value) => value,
|
|
25
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Certificate } from '../deps.js';
|
|
2
|
+
export type CertificateInfo = {
|
|
3
|
+
issuer: Issuer;
|
|
4
|
+
subject: Subject;
|
|
5
|
+
version: number;
|
|
6
|
+
basicConstraintsCA: boolean;
|
|
7
|
+
notBefore: Date;
|
|
8
|
+
notAfter: Date;
|
|
9
|
+
parsedCertificate: Certificate;
|
|
10
|
+
};
|
|
11
|
+
type Issuer = {
|
|
12
|
+
C?: string;
|
|
13
|
+
O?: string;
|
|
14
|
+
OU?: string;
|
|
15
|
+
CN?: string;
|
|
16
|
+
combined: string;
|
|
17
|
+
};
|
|
18
|
+
type Subject = {
|
|
19
|
+
C?: string;
|
|
20
|
+
O?: string;
|
|
21
|
+
OU?: string;
|
|
22
|
+
CN?: string;
|
|
23
|
+
combined: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Extract PEM certificate info
|
|
27
|
+
*
|
|
28
|
+
* @param pemCertificate Result from call to `convertASN1toPEM(x5c[0])`
|
|
29
|
+
*/
|
|
30
|
+
export declare function getCertificateInfo(leafCertBuffer: Uint8Array): CertificateInfo;
|
|
31
|
+
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCertificateInfo = void 0;
|
|
4
|
-
const
|
|
5
|
-
const asn1_x509_1 = require("@peculiar/asn1-x509");
|
|
4
|
+
const deps_js_1 = require("../deps.js");
|
|
6
5
|
const issuerSubjectIDKey = {
|
|
7
6
|
'2.5.4.6': 'C',
|
|
8
7
|
'2.5.4.10': 'O',
|
|
@@ -15,7 +14,7 @@ const issuerSubjectIDKey = {
|
|
|
15
14
|
* @param pemCertificate Result from call to `convertASN1toPEM(x5c[0])`
|
|
16
15
|
*/
|
|
17
16
|
function getCertificateInfo(leafCertBuffer) {
|
|
18
|
-
const x509 =
|
|
17
|
+
const x509 = deps_js_1.AsnParser.parse(leafCertBuffer, deps_js_1.Certificate);
|
|
19
18
|
const parsedCert = x509.tbsCertificate;
|
|
20
19
|
// Issuer
|
|
21
20
|
const issuer = { combined: '' };
|
|
@@ -39,8 +38,8 @@ function getCertificateInfo(leafCertBuffer) {
|
|
|
39
38
|
if (parsedCert.extensions) {
|
|
40
39
|
// console.log(parsedCert.extensions);
|
|
41
40
|
for (const ext of parsedCert.extensions) {
|
|
42
|
-
if (ext.extnID ===
|
|
43
|
-
const basicConstraints =
|
|
41
|
+
if (ext.extnID === deps_js_1.id_ce_basicConstraints) {
|
|
42
|
+
const basicConstraints = deps_js_1.AsnParser.parse(ext.extnValue, deps_js_1.BasicConstraints);
|
|
44
43
|
basicConstraintsCA = basicConstraints.cA;
|
|
45
44
|
}
|
|
46
45
|
}
|
|
@@ -79,4 +78,3 @@ function issuerSubjectToString(input) {
|
|
|
79
78
|
}
|
|
80
79
|
return parts.join(' : ');
|
|
81
80
|
}
|
|
82
|
-
//# sourceMappingURL=getCertificateInfo.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { convertAAGUIDToString } from './convertAAGUIDToString.js';
|
|
2
|
+
import { convertCertBufferToPEM } from './convertCertBufferToPEM.js';
|
|
3
|
+
import { convertCOSEtoPKCS } from './convertCOSEtoPKCS.js';
|
|
4
|
+
import { decodeAttestationObject } from './decodeAttestationObject.js';
|
|
5
|
+
import { decodeClientDataJSON } from './decodeClientDataJSON.js';
|
|
6
|
+
import { decodeCredentialPublicKey } from './decodeCredentialPublicKey.js';
|
|
7
|
+
import { generateChallenge } from './generateChallenge.js';
|
|
8
|
+
import { getCertificateInfo } from './getCertificateInfo.js';
|
|
9
|
+
import { isCertRevoked } from './isCertRevoked.js';
|
|
10
|
+
import { parseAuthenticatorData } from './parseAuthenticatorData.js';
|
|
11
|
+
import { toHash } from './toHash.js';
|
|
12
|
+
import { validateCertificatePath } from './validateCertificatePath.js';
|
|
13
|
+
import { verifySignature } from './verifySignature.js';
|
|
14
|
+
import { isoBase64URL, isoCBOR, isoCrypto, isoUint8Array } from './iso/index.js';
|
|
15
|
+
import * as cose from './cose.js';
|
|
16
|
+
export { convertAAGUIDToString, convertCertBufferToPEM, convertCOSEtoPKCS, cose, decodeAttestationObject, decodeClientDataJSON, decodeCredentialPublicKey, generateChallenge, getCertificateInfo, isCertRevoked, isoBase64URL, isoCBOR, isoCrypto, isoUint8Array, parseAuthenticatorData, toHash, validateCertificatePath, verifySignature, };
|
|
17
|
+
import type { AttestationFormat, AttestationObject, AttestationStatement } from './decodeAttestationObject.js';
|
|
18
|
+
import type { CertificateInfo } from './getCertificateInfo.js';
|
|
19
|
+
import type { ClientDataJSON } from './decodeClientDataJSON.js';
|
|
20
|
+
import type { COSEPublicKey } from './cose.js';
|
|
21
|
+
import type { ParsedAuthenticatorData } from './parseAuthenticatorData.js';
|
|
22
|
+
export type { AttestationFormat, AttestationObject, AttestationStatement, CertificateInfo, ClientDataJSON, COSEPublicKey, ParsedAuthenticatorData, };
|
|
@@ -0,0 +1,59 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.verifySignature = exports.validateCertificatePath = exports.toHash = exports.parseAuthenticatorData = exports.isoUint8Array = exports.isoCrypto = exports.isoCBOR = exports.isoBase64URL = exports.isCertRevoked = exports.getCertificateInfo = exports.generateChallenge = exports.decodeCredentialPublicKey = exports.decodeClientDataJSON = exports.decodeAttestationObject = exports.cose = exports.convertCOSEtoPKCS = exports.convertCertBufferToPEM = exports.convertAAGUIDToString = void 0;
|
|
27
|
+
const convertAAGUIDToString_js_1 = require("./convertAAGUIDToString.js");
|
|
28
|
+
Object.defineProperty(exports, "convertAAGUIDToString", { enumerable: true, get: function () { return convertAAGUIDToString_js_1.convertAAGUIDToString; } });
|
|
29
|
+
const convertCertBufferToPEM_js_1 = require("./convertCertBufferToPEM.js");
|
|
30
|
+
Object.defineProperty(exports, "convertCertBufferToPEM", { enumerable: true, get: function () { return convertCertBufferToPEM_js_1.convertCertBufferToPEM; } });
|
|
31
|
+
const convertCOSEtoPKCS_js_1 = require("./convertCOSEtoPKCS.js");
|
|
32
|
+
Object.defineProperty(exports, "convertCOSEtoPKCS", { enumerable: true, get: function () { return convertCOSEtoPKCS_js_1.convertCOSEtoPKCS; } });
|
|
33
|
+
const decodeAttestationObject_js_1 = require("./decodeAttestationObject.js");
|
|
34
|
+
Object.defineProperty(exports, "decodeAttestationObject", { enumerable: true, get: function () { return decodeAttestationObject_js_1.decodeAttestationObject; } });
|
|
35
|
+
const decodeClientDataJSON_js_1 = require("./decodeClientDataJSON.js");
|
|
36
|
+
Object.defineProperty(exports, "decodeClientDataJSON", { enumerable: true, get: function () { return decodeClientDataJSON_js_1.decodeClientDataJSON; } });
|
|
37
|
+
const decodeCredentialPublicKey_js_1 = require("./decodeCredentialPublicKey.js");
|
|
38
|
+
Object.defineProperty(exports, "decodeCredentialPublicKey", { enumerable: true, get: function () { return decodeCredentialPublicKey_js_1.decodeCredentialPublicKey; } });
|
|
39
|
+
const generateChallenge_js_1 = require("./generateChallenge.js");
|
|
40
|
+
Object.defineProperty(exports, "generateChallenge", { enumerable: true, get: function () { return generateChallenge_js_1.generateChallenge; } });
|
|
41
|
+
const getCertificateInfo_js_1 = require("./getCertificateInfo.js");
|
|
42
|
+
Object.defineProperty(exports, "getCertificateInfo", { enumerable: true, get: function () { return getCertificateInfo_js_1.getCertificateInfo; } });
|
|
43
|
+
const isCertRevoked_js_1 = require("./isCertRevoked.js");
|
|
44
|
+
Object.defineProperty(exports, "isCertRevoked", { enumerable: true, get: function () { return isCertRevoked_js_1.isCertRevoked; } });
|
|
45
|
+
const parseAuthenticatorData_js_1 = require("./parseAuthenticatorData.js");
|
|
46
|
+
Object.defineProperty(exports, "parseAuthenticatorData", { enumerable: true, get: function () { return parseAuthenticatorData_js_1.parseAuthenticatorData; } });
|
|
47
|
+
const toHash_js_1 = require("./toHash.js");
|
|
48
|
+
Object.defineProperty(exports, "toHash", { enumerable: true, get: function () { return toHash_js_1.toHash; } });
|
|
49
|
+
const validateCertificatePath_js_1 = require("./validateCertificatePath.js");
|
|
50
|
+
Object.defineProperty(exports, "validateCertificatePath", { enumerable: true, get: function () { return validateCertificatePath_js_1.validateCertificatePath; } });
|
|
51
|
+
const verifySignature_js_1 = require("./verifySignature.js");
|
|
52
|
+
Object.defineProperty(exports, "verifySignature", { enumerable: true, get: function () { return verifySignature_js_1.verifySignature; } });
|
|
53
|
+
const index_js_1 = require("./iso/index.js");
|
|
54
|
+
Object.defineProperty(exports, "isoBase64URL", { enumerable: true, get: function () { return index_js_1.isoBase64URL; } });
|
|
55
|
+
Object.defineProperty(exports, "isoCBOR", { enumerable: true, get: function () { return index_js_1.isoCBOR; } });
|
|
56
|
+
Object.defineProperty(exports, "isoCrypto", { enumerable: true, get: function () { return index_js_1.isoCrypto; } });
|
|
57
|
+
Object.defineProperty(exports, "isoUint8Array", { enumerable: true, get: function () { return index_js_1.isoUint8Array; } });
|
|
58
|
+
const cose = __importStar(require("./cose.js"));
|
|
59
|
+
exports.cose = cose;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Certificate } from '../deps.js';
|
|
2
|
+
/**
|
|
3
|
+
* A method to pull a CRL from a certificate and compare its serial number to the list of revoked
|
|
4
|
+
* certificate serial numbers within the CRL.
|
|
5
|
+
*
|
|
6
|
+
* CRL certificate structure referenced from https://tools.ietf.org/html/rfc5280#page-117
|
|
7
|
+
*/
|
|
8
|
+
export declare function isCertRevoked(cert: Certificate): Promise<boolean>;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.isCertRevoked = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const iso_1 = require("./iso");
|
|
4
|
+
const deps_js_1 = require("../deps.js");
|
|
5
|
+
const index_js_1 = require("./iso/index.js");
|
|
6
|
+
const fetch_js_1 = require("./fetch.js");
|
|
11
7
|
const cacheRevokedCerts = {};
|
|
12
8
|
/**
|
|
13
9
|
* A method to pull a CRL from a certificate and compare its serial number to the list of revoked
|
|
@@ -16,7 +12,6 @@ const cacheRevokedCerts = {};
|
|
|
16
12
|
* CRL certificate structure referenced from https://tools.ietf.org/html/rfc5280#page-117
|
|
17
13
|
*/
|
|
18
14
|
async function isCertRevoked(cert) {
|
|
19
|
-
var _a, _b;
|
|
20
15
|
const { extensions } = cert.tbsCertificate;
|
|
21
16
|
if (!extensions) {
|
|
22
17
|
return false;
|
|
@@ -24,30 +19,30 @@ async function isCertRevoked(cert) {
|
|
|
24
19
|
let extAuthorityKeyID;
|
|
25
20
|
let extSubjectKeyID;
|
|
26
21
|
let extCRLDistributionPoints;
|
|
27
|
-
extensions.forEach(ext => {
|
|
28
|
-
if (ext.extnID ===
|
|
29
|
-
extAuthorityKeyID =
|
|
22
|
+
extensions.forEach((ext) => {
|
|
23
|
+
if (ext.extnID === deps_js_1.id_ce_authorityKeyIdentifier) {
|
|
24
|
+
extAuthorityKeyID = deps_js_1.AsnParser.parse(ext.extnValue, deps_js_1.AuthorityKeyIdentifier);
|
|
30
25
|
}
|
|
31
|
-
else if (ext.extnID ===
|
|
32
|
-
extSubjectKeyID =
|
|
26
|
+
else if (ext.extnID === deps_js_1.id_ce_subjectKeyIdentifier) {
|
|
27
|
+
extSubjectKeyID = deps_js_1.AsnParser.parse(ext.extnValue, deps_js_1.SubjectKeyIdentifier);
|
|
33
28
|
}
|
|
34
|
-
else if (ext.extnID ===
|
|
35
|
-
extCRLDistributionPoints =
|
|
29
|
+
else if (ext.extnID === deps_js_1.id_ce_cRLDistributionPoints) {
|
|
30
|
+
extCRLDistributionPoints = deps_js_1.AsnParser.parse(ext.extnValue, deps_js_1.CRLDistributionPoints);
|
|
36
31
|
}
|
|
37
32
|
});
|
|
38
33
|
// Check to see if we've got cached info for the cert's CA
|
|
39
34
|
let keyIdentifier = undefined;
|
|
40
35
|
if (extAuthorityKeyID && extAuthorityKeyID.keyIdentifier) {
|
|
41
|
-
keyIdentifier =
|
|
36
|
+
keyIdentifier = index_js_1.isoUint8Array.toHex(new Uint8Array(extAuthorityKeyID.keyIdentifier.buffer));
|
|
42
37
|
}
|
|
43
38
|
else if (extSubjectKeyID) {
|
|
44
39
|
/**
|
|
45
40
|
* We might be dealing with a self-signed root certificate. Check the
|
|
46
41
|
* Subject key Identifier extension next.
|
|
47
42
|
*/
|
|
48
|
-
keyIdentifier =
|
|
43
|
+
keyIdentifier = index_js_1.isoUint8Array.toHex(new Uint8Array(extSubjectKeyID.buffer));
|
|
49
44
|
}
|
|
50
|
-
const certSerialHex =
|
|
45
|
+
const certSerialHex = index_js_1.isoUint8Array.toHex(new Uint8Array(cert.tbsCertificate.serialNumber));
|
|
51
46
|
if (keyIdentifier) {
|
|
52
47
|
const cached = cacheRevokedCerts[keyIdentifier];
|
|
53
48
|
if (cached) {
|
|
@@ -58,7 +53,8 @@ async function isCertRevoked(cert) {
|
|
|
58
53
|
}
|
|
59
54
|
}
|
|
60
55
|
}
|
|
61
|
-
const crlURL =
|
|
56
|
+
const crlURL = extCRLDistributionPoints?.[0].distributionPoint?.fullName?.[0]
|
|
57
|
+
.uniformResourceIdentifier;
|
|
62
58
|
// If no URL is provided then we have nothing to check
|
|
63
59
|
if (!crlURL) {
|
|
64
60
|
return false;
|
|
@@ -66,17 +62,17 @@ async function isCertRevoked(cert) {
|
|
|
66
62
|
// Download and read the CRL
|
|
67
63
|
let certListBytes;
|
|
68
64
|
try {
|
|
69
|
-
const respCRL = await (0,
|
|
65
|
+
const respCRL = await (0, fetch_js_1.fetch)(crlURL);
|
|
70
66
|
certListBytes = await respCRL.arrayBuffer();
|
|
71
67
|
}
|
|
72
|
-
catch (
|
|
68
|
+
catch (_err) {
|
|
73
69
|
return false;
|
|
74
70
|
}
|
|
75
71
|
let data;
|
|
76
72
|
try {
|
|
77
|
-
data =
|
|
73
|
+
data = deps_js_1.AsnParser.parse(certListBytes, deps_js_1.CertificateList);
|
|
78
74
|
}
|
|
79
|
-
catch (
|
|
75
|
+
catch (_err) {
|
|
80
76
|
// Something was malformed with the CRL, so pass
|
|
81
77
|
return false;
|
|
82
78
|
}
|
|
@@ -92,7 +88,7 @@ async function isCertRevoked(cert) {
|
|
|
92
88
|
const revokedCerts = data.tbsCertList.revokedCertificates;
|
|
93
89
|
if (revokedCerts) {
|
|
94
90
|
for (const cert of revokedCerts) {
|
|
95
|
-
const revokedHex =
|
|
91
|
+
const revokedHex = index_js_1.isoUint8Array.toHex(new Uint8Array(cert.userCertificate));
|
|
96
92
|
newCached.revokedCerts.push(revokedHex);
|
|
97
93
|
}
|
|
98
94
|
// Cache the results
|
|
@@ -104,4 +100,3 @@ async function isCertRevoked(cert) {
|
|
|
104
100
|
return false;
|
|
105
101
|
}
|
|
106
102
|
exports.isCertRevoked = isCertRevoked;
|
|
107
|
-
//# sourceMappingURL=isCertRevoked.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A collection of methods for isomorphic manipulation of trickier data types
|
|
3
|
+
*
|
|
4
|
+
* The goal with these is to make it easier to replace dependencies later that might not play well
|
|
5
|
+
* with specific server-like runtimes that expose global Web APIs (CloudFlare Workers, Deno, Bun,
|
|
6
|
+
* etc...), while also supporting execution in Node.
|
|
7
|
+
*/
|
|
8
|
+
export * as isoBase64URL from './isoBase64URL.js';
|
|
9
|
+
export * as isoCBOR from './isoCBOR.js';
|
|
10
|
+
export * as isoCrypto from './isoCrypto/index.js';
|
|
11
|
+
export * as isoUint8Array from './isoUint8Array.js';
|
|
@@ -31,8 +31,7 @@ exports.isoUint8Array = exports.isoCrypto = exports.isoCBOR = exports.isoBase64U
|
|
|
31
31
|
* with specific server-like runtimes that expose global Web APIs (CloudFlare Workers, Deno, Bun,
|
|
32
32
|
* etc...), while also supporting execution in Node.
|
|
33
33
|
*/
|
|
34
|
-
exports.isoBase64URL = __importStar(require("./isoBase64URL"));
|
|
35
|
-
exports.isoCBOR = __importStar(require("./isoCBOR"));
|
|
36
|
-
exports.isoCrypto = __importStar(require("./isoCrypto"));
|
|
37
|
-
exports.isoUint8Array = __importStar(require("./isoUint8Array"));
|
|
38
|
-
//# sourceMappingURL=index.js.map
|
|
34
|
+
exports.isoBase64URL = __importStar(require("./isoBase64URL.js"));
|
|
35
|
+
exports.isoCBOR = __importStar(require("./isoCBOR.js"));
|
|
36
|
+
exports.isoCrypto = __importStar(require("./isoCrypto/index.js"));
|
|
37
|
+
exports.isoUint8Array = __importStar(require("./isoUint8Array.js"));
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decode from a Base64URL-encoded string to an ArrayBuffer. Best used when converting a
|
|
3
|
+
* credential ID from a JSON string to an ArrayBuffer, like in allowCredentials or
|
|
4
|
+
* excludeCredentials.
|
|
5
|
+
*
|
|
6
|
+
* @param buffer Value to decode from base64
|
|
7
|
+
* @param to (optional) The decoding to use, in case it's desirable to decode from base64 instead
|
|
8
|
+
*/
|
|
9
|
+
export declare function toBuffer(base64urlString: string, from?: 'base64' | 'base64url'): Uint8Array;
|
|
10
|
+
/**
|
|
11
|
+
* Encode the given array buffer into a Base64URL-encoded string. Ideal for converting various
|
|
12
|
+
* credential response ArrayBuffers to string for sending back to the server as JSON.
|
|
13
|
+
*
|
|
14
|
+
* @param buffer Value to encode to base64
|
|
15
|
+
* @param to (optional) The encoding to use, in case it's desirable to encode to base64 instead
|
|
16
|
+
*/
|
|
17
|
+
export declare function fromBuffer(buffer: Uint8Array, to?: 'base64' | 'base64url'): string;
|
|
18
|
+
/**
|
|
19
|
+
* Convert a base64url string into base64
|
|
20
|
+
*/
|
|
21
|
+
export declare function toBase64(base64urlString: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Encode a string to base64url
|
|
24
|
+
*/
|
|
25
|
+
export declare function fromString(ascii: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Decode a base64url string into its original string
|
|
28
|
+
*/
|
|
29
|
+
export declare function toString(base64urlString: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Confirm that the string is encoded into base64
|
|
32
|
+
*/
|
|
33
|
+
export declare function isBase64(input: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Confirm that the string is encoded into base64url, with support for optional padding
|
|
36
|
+
*/
|
|
37
|
+
export declare function isBase64url(input: string): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decode and return the first item in a sequence of CBOR-encoded values
|
|
3
|
+
*
|
|
4
|
+
* @param input The CBOR data to decode
|
|
5
|
+
* @param asObject (optional) Whether to convert any CBOR Maps into JavaScript Objects. Defaults to
|
|
6
|
+
* `false`
|
|
7
|
+
*/
|
|
8
|
+
export declare function decodeFirst<Type>(input: Uint8Array): Type;
|
|
9
|
+
/**
|
|
10
|
+
* Encode data to CBOR
|
|
11
|
+
*/
|
|
12
|
+
export declare function encode(input: unknown): Uint8Array;
|
|
@@ -1,31 +1,7 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.encode = exports.decodeFirst = void 0;
|
|
27
|
-
|
|
28
|
-
const cborx = __importStar(require("cbor-x"));
|
|
4
|
+
const deps_js_1 = require("../../deps.js");
|
|
29
5
|
/**
|
|
30
6
|
* This encoder should keep CBOR data the same length when data is re-encoded
|
|
31
7
|
*
|
|
@@ -36,7 +12,10 @@ const cborx = __importStar(require("cbor-x"));
|
|
|
36
12
|
* So long as these requirements are maintained, then CBOR sequences can be encoded and decoded
|
|
37
13
|
* freely while maintaining their lengths for the most accurate pointer movement across them.
|
|
38
14
|
*/
|
|
39
|
-
const encoder = new cborx.Encoder({
|
|
15
|
+
const encoder = new deps_js_1.cborx.Encoder({
|
|
16
|
+
mapsAsObjects: false,
|
|
17
|
+
tagUint8Array: false,
|
|
18
|
+
});
|
|
40
19
|
/**
|
|
41
20
|
* Decode and return the first item in a sequence of CBOR-encoded values
|
|
42
21
|
*
|
|
@@ -45,7 +24,9 @@ const encoder = new cborx.Encoder({ mapsAsObjects: false, tagUint8Array: false }
|
|
|
45
24
|
* `false`
|
|
46
25
|
*/
|
|
47
26
|
function decodeFirst(input) {
|
|
48
|
-
|
|
27
|
+
// Make a copy so we don't mutate the original
|
|
28
|
+
const _input = new Uint8Array(input);
|
|
29
|
+
const decoded = encoder.decodeMultiple(_input);
|
|
49
30
|
if (decoded === undefined) {
|
|
50
31
|
throw new Error('CBOR input data was empty');
|
|
51
32
|
}
|
|
@@ -66,4 +47,3 @@ function encode(input) {
|
|
|
66
47
|
return encoder.encode(input);
|
|
67
48
|
}
|
|
68
49
|
exports.encode = encode;
|
|
69
|
-
//# sourceMappingURL=isoCBOR.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { COSEALG } from '../../cose.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generate a digest of the provided data.
|
|
4
|
+
*
|
|
5
|
+
* @param data The data to generate a digest of
|
|
6
|
+
* @param algorithm A COSE algorithm ID that maps to a desired SHA algorithm
|
|
7
|
+
*/
|
|
8
|
+
export declare function digest(data: Uint8Array, algorithm: COSEALG): Promise<Uint8Array>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.digest = void 0;
|
|
4
|
+
const mapCoseAlgToWebCryptoAlg_js_1 = require("./mapCoseAlgToWebCryptoAlg.js");
|
|
5
|
+
const getWebCrypto_js_1 = require("./getWebCrypto.js");
|
|
6
|
+
/**
|
|
7
|
+
* Generate a digest of the provided data.
|
|
8
|
+
*
|
|
9
|
+
* @param data The data to generate a digest of
|
|
10
|
+
* @param algorithm A COSE algorithm ID that maps to a desired SHA algorithm
|
|
11
|
+
*/
|
|
12
|
+
async function digest(data, algorithm) {
|
|
13
|
+
const WebCrypto = await (0, getWebCrypto_js_1.getWebCrypto)();
|
|
14
|
+
const subtleAlgorithm = (0, mapCoseAlgToWebCryptoAlg_js_1.mapCoseAlgToWebCryptoAlg)(algorithm);
|
|
15
|
+
const hashed = await WebCrypto.subtle.digest(subtleAlgorithm, data);
|
|
16
|
+
return new Uint8Array(hashed);
|
|
17
|
+
}
|
|
18
|
+
exports.digest = digest;
|