summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2022-11-21 08:39:45 -0800
committerMatthew Miller <matthew@millerti.me>2022-11-21 08:39:45 -0800
commit9ae90a406587d6b0fa98e2c33c8dfce1faf2324f (patch)
tree362b1e34366df56515ff974344000c9dee32f715 /packages/server/src
parentc27ef1819c43c69a830e51da7a7e8bd96dc71723 (diff)
Make mapCoseAlgToWebCryptoAlg more readable
Diffstat (limited to 'packages/server/src')
-rw-r--r--packages/server/src/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.ts8
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';
}