UNPKG

@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

24 lines (20 loc) • 916 B
import { TypedArrayEncoder } from "../../utils/TypedArrayEncoder.mjs"; import "../../utils/index.mjs"; import { KeyManagementError } from "./error/KeyManagementError.mjs"; import "./jwk/index.mjs"; //#region src/modules/kms/legacy.ts /** * Returns the legacy key id based on the public key encoded as base58 * * This is what was has been used by askar */ function legacyKeyIdFromPublicJwk(publicJwk) { const compresedPublicKey = publicJwk.compressedPublicKey; if (compresedPublicKey) return TypedArrayEncoder.toBase58(compresedPublicKey.publicKey); const publicKey = publicJwk.publicKey; if (publicKey.kty === "RSA") throw new KeyManagementError("Unable to derive legacy key id from RSA key. Support for RSA keys was only added after explit key ids were added."); return TypedArrayEncoder.toBase58(publicKey.publicKey); } //#endregion export { legacyKeyIdFromPublicJwk }; //# sourceMappingURL=legacy.mjs.map