Skip to content

@fkn/lib/messages

const E2E_INTEGRITY_MESSAGE: "fkn:e2e-integrity: stored data failed its integrity check" = 'fkn:e2e-integrity: stored data failed its integrity check';

const E2E_LOCKED_MESSAGE: "fkn:e2e-locked" = 'fkn:e2e-locked';

const E2E_STALE_EPOCH_MESSAGE: "fkn:e2e-stale-epoch: this file is encrypted under a previous key you reset" = 'fkn:e2e-stale-epoch: this file is encrypted under a previous key you reset';

const STORAGE_NOT_FOUND: "FKN_STORAGE_NOT_FOUND" = 'FKN_STORAGE_NOT_FOUND';

“There is no object at this path”, as a thing a caller can TEST rather than parse.

osra’s error boxer ships name, message, stack and cause ONLY, so this code survives same-realm hops but NOT the SharedWorker boundary; the message fallback in src/lib/storage.ts’s rethrow is what carries absence across that hop and re-mints the coded error for apps. The message does not survive being reworded, which is the problem this exists to end: absence arrives in two completely different sentences depending on which half of the read failed, and every consumer was left regex-matching both. Ripple got one of them and missed the other, and a library quietly went un-backed-up for a day because a missing backup read as a transient error.


const STORAGE_UNREACHABLE: "FKN_API_UNREACHABLE" = 'FKN_API_UNREACHABLE';

“The api never answered”, as a thing a caller can TEST, for the same reason as above and one more: a caller that relaxes anything when the server cannot be reached must never relax it on an ANSWERED error, because an answered 500 lands exactly when a key rotation or a setting flip may be propagating. The MESSAGE prefix is the wire contract: osra’s error boxer ships name, message, stack and cause only, so a custom code does NOT survive the SharedWorker hop (the E2E_LOCKED_MESSAGE prefix match exists for exactly this reason). The code is still set for same-realm callers, which is the cheaper test when it is available.