@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
21 lines (20 loc) • 714 B
JavaScript
import { TypedArrayEncoder } from "../../../utils/TypedArrayEncoder.mjs";
import "../../../utils/index.mjs";
//#region src/modules/kms/jwk/humanDescription.ts
/**
* Gets text description of a key.
*
* - `EC key with crv '<crv>'`
* - `RSA key with bith length <bitLength>
* - `oct key`
* - `'<kty>' key`
*/
function getJwkHumanDescription(jwk) {
if (jwk.kty === "EC" || jwk.kty === "OKP") return `${jwk.kty} key with crv '${jwk.crv}'`;
if (jwk.kty === "RSA") return `RSA key with bit length ${TypedArrayEncoder.fromBase64Url(jwk.n).length * 8}`;
if (jwk.kty === "oct") return "oct key";
return `'${jwk.kty}' key'`;
}
//#endregion
export { getJwkHumanDescription };
//# sourceMappingURL=humanDescription.mjs.map