public enum VaultError

  1. Object
  2. Enum<VaultError>
  3. VaultError

ImplementsComparable<VaultError>

Why a vault or protected-storage operation failed, as a code rather than a message.

Every distinction here exists because acting on the wrong one destroys data. The pair that matters most is KEY_MISSING against TEMPORARILY_UNREADABLE: a caller that treats “I could not read the key” as “there is no key” generates a replacement, and every record the old key protected becomes unopenable. The same shape recurs for CORRUPT against AUTHENTICATION_FAILED and for LOCKED against CANCELLED.

Enum constants

STORAGE_UNAVAILABLEThe platform has no store to write to, or the store could not be opened at all.
CRYPTO_UNAVAILABLEThe cryptographic provider is missing or failed.
POLICY_NOT_METThe caller required protections this platform does not provide.
INSECURE_CONTEXTHardened storage was requested from an insecure context – plain http: on anything but localhost.
LOCKEDThe vault exists but is locked.
CANCELLEDThe user dismissed a prompt, or the operation was aborted.
KEY_MISSINGThe store answered, and the key or entry is definitely not there.
TEMPORARILY_UNREADABLEThe key or entry could not be read, and the store cannot say whether it exists.
CORRUPTThe stored bytes are not a well formed envelope: truncated, a bad magic, a length field that does not fit.
AUTHENTICATION_FAILEDThe envelope parsed and the authentication tag did not verify.
UNSUPPORTED_FORMATThe envelope is well formed and declares a version, suite or KDF this build does not implement.
QUOTA_EXCEEDEDThe store refused the write for space, or evicted what was already there.
CONFLICTTwo writers raced and this one lost, or the stored state moved under the operation.
NOT_SUPPORTEDThe requested mechanism is not implemented on this port – a passkey unlock where there is no authenticator, a hardware-backed key where there is no hardware.
IMPORT_COMMITTEDSync import reached committed state, but policy setup failed and rollback was unsafe or could not be confirmed.
UNKNOWNAnything the codes above do not cover.

Methods

public static VaultError[] values()
public static VaultError valueOf(String name)

Inherited methods

Enum constant details

STORAGE_UNAVAILABLE

STORAGE_UNAVAILABLE
The platform has no store to write to, or the store could not be opened at all. On the browser this covers private-browsing restrictions that refuse IndexedDB outright.

CRYPTO_UNAVAILABLE

CRYPTO_UNAVAILABLE
The cryptographic provider is missing or failed. On the browser, crypto.subtle absent – which is what an insecure context looks like from inside the page – or present and unable to complete the operation.

POLICY_NOT_MET

POLICY_NOT_MET

The caller required protections this platform does not provide. The refused protection is available from VaultException.getUnmetProtection().

Never downgraded silently: a request for encrypted storage on a platform that can only offer plaintext fails here rather than writing plaintext.

INSECURE_CONTEXT

INSECURE_CONTEXT
Hardened storage was requested from an insecure context – plain http: on anything but localhost. Web Crypto is unavailable there by specification, and a vault that pretended otherwise would be encrypting nothing.

LOCKED

LOCKED
The vault exists but is locked. Unlock it and retry; nothing is wrong with the data.

CANCELLED

CANCELLED
The user dismissed a prompt, or the operation was aborted. Distinct from AUTHENTICATION_FAILED: nobody failed a check, the check did not happen.

KEY_MISSING

KEY_MISSING
The store answered, and the key or entry is definitely not there. Only this code – never a null, never TEMPORARILY_UNREADABLE – justifies creating a replacement.

TEMPORARILY_UNREADABLE

TEMPORARILY_UNREADABLE
The key or entry could not be read, and the store cannot say whether it exists. A transient condition as far as any caller is concerned: retry, prompt, or give up, but do not write.

CORRUPT

CORRUPT
The stored bytes are not a well formed envelope: truncated, a bad magic, a length field that does not fit. Structural, decided before any key is involved.

AUTHENTICATION_FAILED

AUTHENTICATION_FAILED
The envelope parsed and the authentication tag did not verify. Either the ciphertext or its associated data was altered, or the key is the wrong one – a wrong password lands here. No plaintext is ever returned alongside this.

UNSUPPORTED_FORMAT

UNSUPPORTED_FORMAT
The envelope is well formed and declares a version, suite or KDF this build does not implement. Deliberately not a downgrade: an old client refuses a newer envelope rather than reading it with weaker rules.

QUOTA_EXCEEDED

QUOTA_EXCEEDED
The store refused the write for space, or evicted what was already there. On the browser this is also what a cleared-site-data or evicted-origin looks like after the fact.

CONFLICT

CONFLICT
Two writers raced and this one lost, or the stored state moved under the operation. The caller should re-read and retry rather than overwrite.

NOT_SUPPORTED

NOT_SUPPORTED
The requested mechanism is not implemented on this port – a passkey unlock where there is no authenticator, a hardware-backed key where there is no hardware.

IMPORT_COMMITTED

IMPORT_COMMITTED
Sync import reached committed state, but policy setup failed and rollback was unsafe or could not be confirmed. The session is locked. Re-read the persisted state and finish policy setup; do not assume that the previous password or data-key version is current.

UNKNOWN

UNKNOWN
Anything the codes above do not cover.

Method details

values

public static VaultError[] values()

valueOf

public static VaultError valueOf(String name)