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

61 lines (57 loc) • 1.73 kB
import { z } from "zod"; //#region src/modules/kms/jwk/jwa.ts function recordToUnion(record) { return Object.values(record); } const KnownJwaSignatureAlgorithms = { HS256: "HS256", HS384: "HS384", HS512: "HS512", RS256: "RS256", RS384: "RS384", RS512: "RS512", ES256: "ES256", ES384: "ES384", ES512: "ES512", PS256: "PS256", PS384: "PS384", PS512: "PS512", EdDSA: "EdDSA", Ed25519: "Ed25519", ES256K: "ES256K" }; const zKnownJwaSignatureAlgorithm = z.enum(recordToUnion(KnownJwaSignatureAlgorithms)); function isKnownJwaSignatureAlgorithm(alg) { return Object.values(KnownJwaSignatureAlgorithms).includes(alg); } const KnownJwaContentEncryptionAlgorithms = { A128GCM: "A128GCM", A192GCM: "A192GCM", A256GCM: "A256GCM", A128CBC: "A128CBC", A256CBC: "A256CBC", C20P: "C20P", XC20P: "XC20P", "XSALSA20-POLY1305": "XSALSA20-POLY1305", A128CBC_HS256: "A128CBC-HS256", A192CBC_HS384: "A192CBC-HS384", A256CBC_HS512: "A256CBC-HS512" }; const zKnownJwaContentEncryptionAlgorithm = z.enum(recordToUnion(KnownJwaContentEncryptionAlgorithms)); const KnownJwaKeyEncryptionAlgorithms = { A128KW: "A128KW", A192KW: "A192KW", A256KW: "A256KW" }; z.enum(recordToUnion(KnownJwaKeyEncryptionAlgorithms)); const KnownJwaKeyAgreementAlgorithms = { ECDH_ES: "ECDH-ES", ECDH_ES_A128KW: "ECDH-ES+A128KW", ECDH_ES_A192KW: "ECDH-ES+A192KW", ECDH_ES_A256KW: "ECDH-ES+A256KW", ECDH_HSALSA20: "ECDH-HSALSA20" }; z.enum(recordToUnion(KnownJwaKeyAgreementAlgorithms)); //#endregion export { KnownJwaContentEncryptionAlgorithms, KnownJwaKeyAgreementAlgorithms, KnownJwaKeyEncryptionAlgorithms, KnownJwaSignatureAlgorithms, isKnownJwaSignatureAlgorithm, zKnownJwaSignatureAlgorithm }; //# sourceMappingURL=jwa.mjs.map