@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
81 lines (80 loc) • 2.35 kB
JavaScript
import { zKnownJwaSignatureAlgorithm } from "../jwk/jwa.mjs";
import { zKmsJwkPublicEc } from "../jwk/kty/ec/ecJwk.mjs";
import { zKmsJwkPublicOct } from "../jwk/kty/oct/octJwk.mjs";
import { zKmsJwkPublicOkp } from "../jwk/kty/okp/okpJwk.mjs";
import { zKmsJwkPublicRsa } from "../jwk/kty/rsa/rsaJwk.mjs";
import { zKmsKeyId } from "./common.mjs";
import { z as z$1 } from "zod";
//#region src/modules/kms/options/KmsCreateKeyOptions.ts
const zKmsCreateKeyTypeEc = zKmsJwkPublicEc.pick({
kty: true,
crv: true
});
/**
* Octer key pair, commonly used for Ed25519 and X25519 key types
*/
const zKmsCreateKeyTypeOkp = zKmsJwkPublicOkp.pick({
kty: true,
crv: true
});
/**
* RSA key pair.
*/
const zKmsCreateKeyTypeRsa = zKmsJwkPublicRsa.pick({ kty: true }).extend({ modulusLength: z$1.union([
z$1.literal(2048),
z$1.literal(3072),
z$1.literal(4096)
]) });
/**
* Represents an octect sequence for symmetric keys
*/
const zKmsCreateKeyTypeOct = z$1.discriminatedUnion("algorithm", [
z$1.object({
kty: zKmsJwkPublicOct.shape.kty,
algorithm: z$1.literal("aes"),
length: z$1.union([
z$1.literal(128),
z$1.literal(192),
z$1.literal(256),
z$1.number().int().refine((length) => length % 8 === 0, "aes key length must be multiple of 8")
])
}),
z$1.object({
kty: zKmsJwkPublicOct.shape.kty,
algorithm: z$1.literal("hmac").describe("For usage with HS256, HS384 and HS512"),
length: z$1.union([
z$1.literal(256),
z$1.literal(384),
z$1.literal(512)
])
}),
z$1.object({
kty: zKmsJwkPublicOct.shape.kty,
/**
* For usage with ChaCha20-Poly1305 and XChaCha20-Poly1305
*/
algorithm: z$1.literal("C20P").describe("For usage with ChaCha20-Poly1305 and XChaCha20-Poly1305")
})
]);
z$1.union([
zKmsCreateKeyTypeEc,
zKmsCreateKeyTypeOkp,
zKmsCreateKeyTypeRsa
]);
const zKmsCreateKeyType = z$1.union([
zKmsCreateKeyTypeEc,
zKmsCreateKeyTypeOkp,
zKmsCreateKeyTypeRsa,
zKmsCreateKeyTypeOct
]);
const zKmsCreateKeyOptions = z$1.object({
keyId: z$1.optional(zKmsKeyId),
type: zKmsCreateKeyType
});
const zKmsCreateKeyForSignatureAlgorithmOptions = z$1.object({
keyId: z$1.optional(zKmsKeyId),
algorithm: zKnownJwaSignatureAlgorithm
});
//#endregion
export { zKmsCreateKeyForSignatureAlgorithmOptions, zKmsCreateKeyOptions, zKmsCreateKeyType, zKmsCreateKeyTypeOct };
//# sourceMappingURL=KmsCreateKeyOptions.mjs.map