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

44 lines (40 loc) • 1.54 kB
import { KnownJwaKeyAgreementAlgorithms, KnownJwaSignatureAlgorithms } from "../../jwa.mjs"; import { ecPublicJwkToPublicKey, ecPublicKeyToPublicJwk } from "./ecPublicKey.mjs"; //#region src/modules/kms/jwk/kty/ec/Secp256k1PublicJwk.ts var Secp256k1PublicJwk = class Secp256k1PublicJwk { constructor(jwk) { this.jwk = jwk; this.supportedEncryptionKeyAgreementAlgorithms = Secp256k1PublicJwk.supportedEncryptionKeyAgreementAlgorithms; this.supportedSignatureAlgorithms = Secp256k1PublicJwk.supportedSignatureAlgorithms; this.multicodecPrefix = Secp256k1PublicJwk.multicodecPrefix; } get publicKey() { return { crv: this.jwk.crv, kty: this.jwk.kty, publicKey: ecPublicJwkToPublicKey(this.jwk) }; } get compressedPublicKey() { return { crv: this.jwk.crv, kty: this.jwk.kty, publicKey: ecPublicJwkToPublicKey(this.jwk, { compressed: true }) }; } get multicodec() { return ecPublicJwkToPublicKey(this.jwk, { compressed: true }); } static fromPublicKey(publicKey) { return new Secp256k1PublicJwk(ecPublicKeyToPublicJwk(publicKey, "secp256k1")); } static fromMulticodec(multicodec) { return new Secp256k1PublicJwk(ecPublicKeyToPublicJwk(multicodec, "secp256k1")); } }; Secp256k1PublicJwk.supportedSignatureAlgorithms = [KnownJwaSignatureAlgorithms.ES256K]; Secp256k1PublicJwk.supportedEncryptionKeyAgreementAlgorithms = [KnownJwaKeyAgreementAlgorithms.ECDH_ES]; Secp256k1PublicJwk.multicodecPrefix = 231; //#endregion export { Secp256k1PublicJwk }; //# sourceMappingURL=Secp256k1PublicJwk.mjs.map