Initial Commit

This commit is contained in:
2026-05-27 23:47:53 +01:00
parent fbc70f96e6
commit 9b28db724f
18103 changed files with 1600554 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
import { defineCodes } from "@suaveplan/error";
/**
* Stable error code registry for `@suaveplan/vault`.
*
* Every code is namespaced under `VAULT.<MODULE>.<REASON>`. The full set is
* frozen at module-load time and may never be removed without a major version
* bump — consumer code MAY assert on these literal strings to drive recovery
* logic (e.g. prompting the user to re-enter their password on
* `VAULT.INVALID_CREDENTIALS`).
*/
export const VAULT_CODES = defineCodes("VAULT", [
"LOCKED",
"INVALID_CREDENTIALS",
"ALREADY_OPEN",
"NOT_INITIALIZED",
"MANIFEST_INVALID",
"MANIFEST_VERSION_UNSUPPORTED",
"DECRYPT_FAILED",
"ITEM.NOT_FOUND",
"ITEM.VALIDATION_FAILED",
"ITEM.VERSION_CONFLICT",
"ATTACHMENT.NOT_FOUND",
"ATTACHMENT.TOO_LARGE",
"SHARE.NOT_FOUND",
"SHARE.REVOKED",
"SYNC.FAILED",
"OPAQUE_HANDLE_INVALID",
"DRIVE.FAILURE",
] as const);
/**
* Union of every fully-qualified error code emitted by `vault`. Use as the
* type parameter of {@link import("./vault-error.js").VaultError} for
* narrowed `code` checks.
*/
export type VaultErrorCode = (typeof VAULT_CODES)[keyof typeof VAULT_CODES];