@credo-ts/core
Version:
<p align="center"> <br /> <img alt="Credo Logo" src="https://github.com/openwallet-foundation/credo-ts/blob/c7886cb8377ceb8ee4efe8d264211e561a75072d/images/credo-logo.png" height="250px" /> </p> <h1 align="center"><b>Credo - Core</b></h1
1 lines • 1.24 kB
Source Map (JSON)
{"version":3,"file":"legacy.mjs","names":[],"sources":["../../../src/modules/kms/legacy.ts"],"sourcesContent":["import { TypedArrayEncoder } from '../../utils'\nimport { KeyManagementError } from './error/KeyManagementError'\nimport type { PublicJwk } from './jwk/PublicJwk'\n\n/**\n * Returns the legacy key id based on the public key encoded as base58\n *\n * This is what was has been used by askar\n */\nexport function legacyKeyIdFromPublicJwk(publicJwk: PublicJwk) {\n // Compressed public keys were used for legacy key ids\n const compressedPublicKey = publicJwk.compressedPublicKey\n if (compressedPublicKey) {\n return TypedArrayEncoder.toBase58(compressedPublicKey.publicKey)\n }\n\n const publicKey = publicJwk.publicKey\n if (publicKey.kty === 'RSA') {\n throw new KeyManagementError(\n 'Unable to derive legacy key id from RSA key. Support for RSA keys was only added after explicit key ids were added.'\n )\n }\n\n return TypedArrayEncoder.toBase58(publicKey.publicKey)\n}\n"],"mappings":";;;;;;;;;AASA,SAAgB,yBAAyB,WAAsB;CAE7D,MAAM,sBAAsB,UAAU;CACtC,IAAI,qBACF,OAAO,kBAAkB,SAAS,oBAAoB,SAAS;CAGjE,MAAM,YAAY,UAAU;CAC5B,IAAI,UAAU,QAAQ,OACpB,MAAM,IAAI,mBACR,qHACF;CAGF,OAAO,kBAAkB,SAAS,UAAU,SAAS;AACvD"}