Class: CryptoError
Defined in: errors.ts:116
A cryptographic operation failed. Also the class of the QS_INTERNAL_ERROR code, used for unclassified failures inside the WASM module.
Extends
Extended by
DecapsulationErrorDecryptionAuthenticationErrorVerificationErrorSigningErrorMalformedKeyErrorMalformedCiphertextErrorMalformedSignatureErrorAlgorithmMismatchErrorHkdfOutputTooLongErrorKdfError
Constructors
Constructor
new CryptoError(
message,code?,hint?):CryptoError
Defined in: errors.ts:75
Creates an error. name is set from code, and code and hint are stored as readonly properties.
Parameters
message
string
Human-readable description. Do not parse it; match on code or instanceof.
code?
QsErrorCode = 'QS_ERROR'
Stable error code. Default QS_ERROR.
hint?
string = ''
Static one-line suggestion for fixing the problem. Default: empty.
Returns
CryptoError
Inherited from
Properties
code
readonlycode:QsErrorCode
Defined in: errors.ts:65
Stable machine-readable identifier, e.g. QS_DECRYPTION_FAILED.
Inherited from
hint
readonlyhint:string
Defined in: errors.ts:67
One-line, static suggestion for fixing the problem. Contains no sensitive data.
Inherited from
Methods
toJSON()
toJSON():
object
Defined in: errors.ts:98
JSON-safe description, useful for logs and for coding agents.
Returns
object
name, code, message and hint; contains no key material.
code
code:
QsErrorCode
hint
hint:
string
message
message:
string
name
name:
string
Inherited from
is()
staticis(e):e is QuantumSafeError
Defined in: errors.ts:90
True for errors from any copy of this library. Prefer this to instanceof when an application might load both the ESM and the CommonJS build (each has its own class objects).
Parameters
e
unknown
Any value.
Returns
e is QuantumSafeError
true when e is an object carrying this library's error brand.