{"version":3,"file":"format-hex.cjs","names":["HexFormatter: Format","Hex","CipherParams"],"sources":["../src/format-hex.ts"],"sourcesContent":["import {\n  CipherParams,\n  Format,\n} from './cipher-core';\nimport {\n  Hex,\n} from './core';\n\n/**\n * Hex formatter for cipher params.\n * Converts cipher params to/from hexadecimal strings.\n */\nexport const HexFormatter: Format = {\n  /**\n   * Converts the ciphertext of a cipher params object to a hexadecimally encoded string.\n   *\n   * @param cipherParams - The cipher params object.\n   * @returns The hexadecimally encoded string.\n   *\n   * @example\n   * ```js\n   * const hexString = HexFormatter.stringify(cipherParams);\n   * ```\n   */\n  stringify(cipherParams: CipherParams): string {\n    if (!cipherParams.ciphertext) {\n      throw new Error('Ciphertext is required');\n    }\n    return cipherParams.ciphertext.toString(Hex);\n  },\n\n  /**\n   * Converts a hexadecimally encoded ciphertext string to a cipher params object.\n   *\n   * @param input - The hexadecimally encoded string.\n   * @returns The cipher params object.\n   *\n   * @example\n   * ```js\n   * const cipherParams = HexFormatter.parse(hexString);\n   * ```\n   */\n  parse(input: string): CipherParams {\n    const ciphertext = Hex.parse(input);\n    return CipherParams.create({ ciphertext });\n  },\n};"],"mappings":";;;;;;;;AAYA,MAAaA,eAAuB;CAYlC,UAAU,cAAoC;AAC5C,MAAI,CAAC,aAAa,WAChB,OAAM,IAAI,MAAM;AAElB,SAAO,aAAa,WAAW,SAASC;CACzC;CAaD,MAAM,OAA6B;EACjC,MAAM,aAAaA,iBAAI,MAAM;AAC7B,SAAOC,iCAAa,OAAO,EAAE,YAAY;CAC1C;CACF"}