

const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.js');
const require_jwa = require('../jwk/jwa.js');
const require_ecJwk = require('../jwk/kty/ec/ecJwk.js');
const require_octJwk = require('../jwk/kty/oct/octJwk.js');
const require_okpJwk = require('../jwk/kty/okp/okpJwk.js');
const require_rsaJwk = require('../jwk/kty/rsa/rsaJwk.js');
const require_common = require('./common.js');
let zod = require("zod");
zod = require_rolldown_runtime.__toESM(zod);

//#region src/modules/kms/options/KmsCreateKeyOptions.ts
const zKmsCreateKeyTypeEc = require_ecJwk.zKmsJwkPublicEc.pick({
	kty: true,
	crv: true
});
/**
* Octer key pair, commonly used for Ed25519 and X25519 key types
*/
const zKmsCreateKeyTypeOkp = require_okpJwk.zKmsJwkPublicOkp.pick({
	kty: true,
	crv: true
});
/**
* RSA key pair.
*/
const zKmsCreateKeyTypeRsa = require_rsaJwk.zKmsJwkPublicRsa.pick({ kty: true }).extend({ modulusLength: zod.z.union([
	zod.z.literal(2048),
	zod.z.literal(3072),
	zod.z.literal(4096)
]) });
/**
* Represents an octect sequence for symmetric keys
*/
const zKmsCreateKeyTypeOct = zod.z.discriminatedUnion("algorithm", [
	zod.z.object({
		kty: require_octJwk.zKmsJwkPublicOct.shape.kty,
		algorithm: zod.z.literal("aes"),
		length: zod.z.union([
			zod.z.literal(128),
			zod.z.literal(192),
			zod.z.literal(256),
			zod.z.number().int().refine((length) => length % 8 === 0, "aes key length must be multiple of 8")
		])
	}),
	zod.z.object({
		kty: require_octJwk.zKmsJwkPublicOct.shape.kty,
		algorithm: zod.z.literal("hmac").describe("For usage with HS256, HS384 and HS512"),
		length: zod.z.union([
			zod.z.literal(256),
			zod.z.literal(384),
			zod.z.literal(512)
		])
	}),
	zod.z.object({
		kty: require_octJwk.zKmsJwkPublicOct.shape.kty,
		algorithm: zod.z.literal("C20P").describe("For usage with ChaCha20-Poly1305 and XChaCha20-Poly1305")
	})
]);
const zKmsCreateKeyTypeAssymetric = zod.z.union([
	zKmsCreateKeyTypeEc,
	zKmsCreateKeyTypeOkp,
	zKmsCreateKeyTypeRsa
]);
const zKmsCreateKeyType = zod.z.union([
	zKmsCreateKeyTypeEc,
	zKmsCreateKeyTypeOkp,
	zKmsCreateKeyTypeRsa,
	zKmsCreateKeyTypeOct
]);
const zKmsCreateKeyOptions = zod.z.object({
	keyId: zod.z.optional(require_common.zKmsKeyId),
	type: zKmsCreateKeyType
});
const zKmsCreateKeyForSignatureAlgorithmOptions = zod.z.object({
	keyId: zod.z.optional(require_common.zKmsKeyId),
	algorithm: require_jwa.zKnownJwaSignatureAlgorithm
});

//#endregion
exports.zKmsCreateKeyForSignatureAlgorithmOptions = zKmsCreateKeyForSignatureAlgorithmOptions;
exports.zKmsCreateKeyOptions = zKmsCreateKeyOptions;