diff options
-rw-r--r-- | packages/server/src/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/server/src/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.ts b/packages/server/src/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.ts index 78876f8..a5bd921 100644 --- a/packages/server/src/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.ts +++ b/packages/server/src/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.ts @@ -6,13 +6,13 @@ import { COSEALG } from "../../cose"; * Convert a COSE alg ID into a corresponding string value that WebCrypto APIs expect */ export function mapCoseAlgToWebCryptoAlg(alg: COSEALG): SubtleCryptoAlg { - if ([-65535].indexOf(alg) >= 0) { + if ([COSEALG.RS1].indexOf(alg) >= 0) { return 'SHA-1'; - } else if ([-7, -37, -257].indexOf(alg) >= 0) { + } else if ([COSEALG.ES256, COSEALG.PS256, COSEALG.RS256].indexOf(alg) >= 0) { return 'SHA-256'; - } else if ([-35, -38, -258].indexOf(alg) >= 0) { + } else if ([COSEALG.ES384, COSEALG.PS384, COSEALG.RS384].indexOf(alg) >= 0) { return 'SHA-384' - } else if ([-8, -36, -39, -259].indexOf(alg) >= 0) { + } else if ([COSEALG.ES512, COSEALG.PS512, COSEALG.RS512, COSEALG.EdDSA,].indexOf(alg) >= 0) { return 'SHA-512'; } |