@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
73 lines (72 loc) • 2.17 kB
JavaScript
import { z as z$1 } 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$1.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",
/**
* As is used in DIDComm v1
*/
"XSALSA20-POLY1305": "XSALSA20-POLY1305",
A128CBC_HS256: "A128CBC-HS256",
A192CBC_HS384: "A192CBC-HS384",
A256CBC_HS512: "A256CBC-HS512"
};
z$1.enum(recordToUnion(KnownJwaContentEncryptionAlgorithms));
const KnownJwaKeyEncryptionAlgorithms = {
A128KW: "A128KW",
A192KW: "A192KW",
A256KW: "A256KW"
};
z$1.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",
HPKE_0: "HPKE-0",
HPKE_3: "HPKE-3",
HPKE_7: "HPKE-7"
};
z$1.enum(recordToUnion(KnownJwaKeyAgreementAlgorithms));
const KnownJwaHpkeAlgorithms = [
KnownJwaKeyAgreementAlgorithms.HPKE_0,
KnownJwaKeyAgreementAlgorithms.HPKE_3,
KnownJwaKeyAgreementAlgorithms.HPKE_7
];
const zKnownJwaHpkeAlgorithm = z$1.enum(KnownJwaHpkeAlgorithms);
function isJwaHpkeAlgorithm(algorithm) {
return KnownJwaHpkeAlgorithms.includes(algorithm);
}
//#endregion
export { KnownJwaContentEncryptionAlgorithms, KnownJwaHpkeAlgorithms, KnownJwaKeyAgreementAlgorithms, KnownJwaKeyEncryptionAlgorithms, KnownJwaSignatureAlgorithms, isJwaHpkeAlgorithm, isKnownJwaSignatureAlgorithm, zKnownJwaHpkeAlgorithm, zKnownJwaSignatureAlgorithm };
//# sourceMappingURL=jwa.mjs.map