{"version":3,"file":"errors.mjs","names":[],"sources":["../../../../../../encryption/src/errors.ts"],"sourcesContent":["/**\n * Base class for every error thrown by this package.\n *\n * Consumers can catch `EncryptionError` to handle any crypto failure, or the\n * narrower subclasses below when the distinction matters.\n */\nexport class EncryptionError extends Error {\n  constructor(message: string) {\n    super(message);\n    this.name = \"EncryptionError\";\n    // Keeps `instanceof` working when the package is transpiled down to ES5.\n    Object.setPrototypeOf(this, new.target.prototype);\n  }\n}\n\n/**\n * Thrown when no encryption key was supplied, per call or in configurations.\n */\nexport class MissingEncryptionKeyError extends EncryptionError {\n  constructor(\n    message = \"Missing Encryption key, please define it or set it in encryption configurations\"\n  ) {\n    super(message);\n    this.name = \"MissingEncryptionKeyError\";\n  }\n}\n\n/**\n * Thrown when the runtime does not expose a usable WebCrypto implementation.\n *\n * There is deliberately no fallback: silently downgrading to a non-CSPRNG or a\n * hand-rolled cipher would defeat the point of the AEAD migration.\n */\nexport class UnsupportedRuntimeError extends EncryptionError {\n  constructor(message: string) {\n    super(message);\n    this.name = \"UnsupportedRuntimeError\";\n  }\n}\n\n/**\n * Thrown when a ciphertext cannot be decrypted.\n *\n * The message intentionally does NOT distinguish \"wrong key\" from \"tampered\n * ciphertext\" for the AES-GCM path — the two are indistinguishable to the\n * cipher itself, and keeping them indistinguishable to the caller avoids\n * handing an attacker a decryption oracle.\n */\nexport class DecryptionError extends EncryptionError {\n  constructor(message: string) {\n    super(message);\n    this.name = \"DecryptionError\";\n  }\n}\n"],"mappings":";;;;;;;AAMA,IAAa,kBAAb,cAAqC,MAAM;CACzC,YAAY,SAAiB;EAC3B,MAAM,OAAO;EACb,KAAK,OAAO;EAEZ,OAAO,eAAe,MAAM,IAAI,OAAO,SAAS;CAClD;AACF;;;;AAKA,IAAa,4BAAb,cAA+C,gBAAgB;CAC7D,YACE,UAAU,mFACV;EACA,MAAM,OAAO;EACb,KAAK,OAAO;CACd;AACF;;;;;;;AAQA,IAAa,0BAAb,cAA6C,gBAAgB;CAC3D,YAAY,SAAiB;EAC3B,MAAM,OAAO;EACb,KAAK,OAAO;CACd;AACF;;;;;;;;;AAUA,IAAa,kBAAb,cAAqC,gBAAgB;CACnD,YAAY,SAAiB;EAC3B,MAAM,OAAO;EACb,KAAK,OAAO;CACd;AACF"}