{"version":3,"file":"KmsKeyAgreementDecryptOptions.mjs","names":[],"sources":["../../../../src/modules/kms/options/KmsKeyAgreementDecryptOptions.ts"],"sourcesContent":["import { z } from 'zod'\nimport { zAnyUint8Array } from '../../../utils/zod'\nimport { zKmsJwkPublicOkp } from '../jwk/kty/okp/okpJwk'\nimport { zKmsKeyId } from './common'\nimport { zKmsEncryptedKey } from './KmsEncryptOptions'\nimport { zKmsJwkPublicEcdh, zKmsKeyAgreementEcdhEs } from './KmsKeyAgreementEncryptOptions'\n\nconst zKmsKeyAgreementDecryptEcdhEsKw = z.object({\n  /**\n   * The key id pointing to the ephemeral public key.\n   *\n   * The key type MUST match with the externalPublicJwk\n   */\n  keyId: zKmsKeyId,\n\n  algorithm: z.enum(['ECDH-ES+A128KW', 'ECDH-ES+A192KW', 'ECDH-ES+A256KW']),\n\n  externalPublicJwk: zKmsJwkPublicEcdh,\n\n  /**\n   * The encrypted content encryption key (cek)\n   */\n  encryptedKey: zKmsEncryptedKey,\n\n  apu: z.optional(zAnyUint8Array),\n  apv: z.optional(zAnyUint8Array),\n})\nexport type KmsKeyAgreementDecryptEcdhEsKw = z.output<typeof zKmsKeyAgreementDecryptEcdhEsKw>\n\nconst zKmsKeyAgreementDecryptEcdhHsalsa20 = z.object({\n  /**\n   * The key id to use for decrypting the content encryption key.\n   */\n  keyId: zKmsKeyId,\n\n  /**\n   * Perform key agreement based on the HSALSA20 as used in Libsodium's\n   * Cryptobox. This is not based on an official JWA algorithm, but is\n   * used primarily for DIDComm v1 messaging.\n   */\n  algorithm: z.literal('ECDH-HSALSA20'),\n\n  /**\n   * Can be undefined for anonymous encryption\n   */\n  externalPublicJwk: zKmsJwkPublicOkp.extend({ crv: zKmsJwkPublicOkp.shape.crv.extract(['X25519']) }).optional(),\n})\nexport type KmsKeyAgreementDecryptEcdhHsalsa20 = z.output<typeof zKmsKeyAgreementDecryptEcdhHsalsa20>\n\nexport const zKmsKeyAgreementDecryptOptions = z\n  .discriminatedUnion('algorithm', [\n    zKmsKeyAgreementEcdhEs,\n    zKmsKeyAgreementDecryptEcdhEsKw,\n    zKmsKeyAgreementDecryptEcdhHsalsa20,\n  ])\n  .describe('Options for key agreement based on an asymmetric key.')\nexport type KmsKeyAgreementDecryptOptions = z.output<typeof zKmsKeyAgreementDecryptOptions>\n"],"mappings":";;;;;;;;;;AAOA,MAAM,kCAAkC,EAAE,OAAO;CAM/C,OAAO;CAEP,WAAW,EAAE,KAAK;EAAC;EAAkB;EAAkB;EAAiB,CAAC;CAEzE,mBAAmB;CAKnB,cAAc;CAEd,KAAK,EAAE,SAAS,eAAe;CAC/B,KAAK,EAAE,SAAS,eAAe;CAChC,CAAC;AAGF,MAAM,sCAAsC,EAAE,OAAO;CAInD,OAAO;CAOP,WAAW,EAAE,QAAQ,gBAAgB;CAKrC,mBAAmB,iBAAiB,OAAO,EAAE,KAAK,iBAAiB,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,UAAU;CAC/G,CAAC;AAGF,MAAa,iCAAiC,EAC3C,mBAAmB,aAAa;CAC/B;CACA;CACA;CACD,CAAC,CACD,SAAS,wDAAwD"}