diff options
author | Matthew Miller <matthew@millerti.me> | 2022-11-16 13:38:43 -0800 |
---|---|---|
committer | Matthew Miller <matthew@millerti.me> | 2022-11-16 13:39:09 -0800 |
commit | dc5c0307f34bb9136e0d708b1ae9f29ac194eb1d (patch) | |
tree | 2f635f7e9d61b9356915bd0cee617e827a459d7f /packages/server/src/helpers/iso/isoCrypto.ts | |
parent | 7eac8700c861a10774a24d329730055cecaa062b (diff) |
Define COSECRV as enums
Diffstat (limited to 'packages/server/src/helpers/iso/isoCrypto.ts')
-rw-r--r-- | packages/server/src/helpers/iso/isoCrypto.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/server/src/helpers/iso/isoCrypto.ts b/packages/server/src/helpers/iso/isoCrypto.ts index 4a39d55..d1abba0 100644 --- a/packages/server/src/helpers/iso/isoCrypto.ts +++ b/packages/server/src/helpers/iso/isoCrypto.ts @@ -3,7 +3,7 @@ import { ECDSASigValue } from "@peculiar/asn1-ecc"; import { AsnParser } from '@peculiar/asn1-schema'; import { isoUint8Array, isoBase64URL } from './index'; -import { COSEKEYS, COSEKTY, COSEPublicKey } from '../convertCOSEtoPKCS'; +import { COSECRV, coseCRV, COSEKEYS, COSEKTY, COSEPublicKey } from '../convertCOSEtoPKCS'; /** * Fill up the provided bytes array with random bytes equal to its length. @@ -188,15 +188,15 @@ function shouldRemoveLeadingZero(bytes: Uint8Array): boolean { * Convert a COSE crv ID into a corresponding string value that WebCrypto APIs expect */ function mapCoseCrvToWebCryptoCrv(crv: number): SubtleCryptoCrv { - if (crv === 1) { + if (crv === COSECRV.P256) { return 'P-256'; } - if (crv === 2) { + if (crv === COSECRV.P384) { return 'P-384'; } - if (crv === 3) { + if (crv === COSECRV.P521) { return 'P-521'; } |