Docs / Reference
Errors
pqlock fails closed with a small set of error types. Open and verify never say which check failed, so errors cannot be used as an oracle.
01Error types
| Meaning | TypeScript | Python | Go |
|---|---|---|---|
| Base class | PQLError | PQLError | wrapped errors |
| Envelope did not open | PQLOpenError | OpenError | pql.ErrOpen |
| Signature, token, webhook or call rejected | PQLVerifyError | VerifyError | pql.ErrVerify |
| Bad or wrong-purpose keyset | PQLError | KeysetError | pql.ErrKeyset |
| Bad policy file | PQLError | PolicyError | pql.ErrPolicy |
try { seal.open(keys, text); }
catch (err) { if (err instanceof PQLOpenError) return null; throw err; }try:
seal.open(text, keys)
except OpenError:
return Noneif _, err := seal.OpenText(keys, text); errors.Is(err, pql.ErrOpen) {
return nil
}02Errors with reasons
Webhook and agent-call rejections extend the verify error with a reason, because the receiver often needs to answer differently to a replay than to a bad signature:
| Error | Reasons |
|---|---|
WebhookError | malformed, unknown_key, expired, bad_signature, replay, cache_full |
CallError | malformed, args, agent, signature, stale, replay |
03What errors never do
- Return partial plaintext.
- Say which check of
openfailed. - Include key material in a message, a log line or a stack trace.
pqlock v0.1.0 · unaudited preview · source of truth: spec/