@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
48 lines (44 loc) • 1.63 kB
JavaScript
import { KnownJwaSignatureAlgorithms } from "../../jwa.mjs";
import { okpPublicJwkToPublicKey, okpPublicKeyToPublicJwk } from "./okpPublicKey.mjs";
import { X25519PublicJwk } from "./X25519PublicJwk.mjs";
import { convertPublicKeyToX25519 } from "@stablelib/ed25519";
//#region src/modules/kms/jwk/kty/okp/Ed25519PublicJwk.ts
var Ed25519PublicJwk = class Ed25519PublicJwk {
constructor(jwk) {
this.jwk = jwk;
this.supportedEncryptionKeyAgreementAlgorithms = Ed25519PublicJwk.supportedEncryptionKeyAgreementAlgorithms;
this.supportedSignatureAlgorithms = Ed25519PublicJwk.supportedSignatureAlgorithms;
this.multicodecPrefix = Ed25519PublicJwk.multicodecPrefix;
}
get publicKey() {
return {
crv: this.jwk.crv,
kty: this.jwk.kty,
publicKey: okpPublicJwkToPublicKey(this.jwk)
};
}
/**
* Not supported for Ed25519
*/
get compressedPublicKey() {
return null;
}
get multicodec() {
return okpPublicJwkToPublicKey(this.jwk);
}
static fromPublicKey(publicKey) {
return new Ed25519PublicJwk(okpPublicKeyToPublicJwk(publicKey, "Ed25519"));
}
static fromMulticodec(multicodec) {
return new Ed25519PublicJwk(okpPublicKeyToPublicJwk(multicodec, "Ed25519"));
}
toX25519PublicJwk() {
return X25519PublicJwk.fromPublicKey(convertPublicKeyToX25519(this.publicKey.publicKey)).jwk;
}
};
Ed25519PublicJwk.supportedSignatureAlgorithms = [KnownJwaSignatureAlgorithms.EdDSA, KnownJwaSignatureAlgorithms.Ed25519];
Ed25519PublicJwk.supportedEncryptionKeyAgreementAlgorithms = [];
Ed25519PublicJwk.multicodecPrefix = 237;
//#endregion
export { Ed25519PublicJwk };
//# sourceMappingURL=Ed25519PublicJwk.mjs.map