Enum VaultError
- All Implemented Interfaces:
Comparable<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 Constant Summary
Enum ConstantsEnum ConstantDescriptionThe envelope parsed and the authentication tag did not verify.The user dismissed a prompt, or the operation was aborted.Two writers raced and this one lost, or the stored state moved under the operation.The stored bytes are not a well formed envelope: truncated, a bad magic, a length field that does not fit.The cryptographic provider is missing or failed.Sync import reached committed state, but policy setup failed and rollback was unsafe or could not be confirmed.Hardened storage was requested from an insecure context -- plainhttp:on anything butlocalhost.The store answered, and the key or entry is definitely not there.The vault exists but is locked.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.The caller required protections this platform does not provide.The store refused the write for space, or evicted what was already there.The platform has no store to write to, or the store could not be opened at all.The key or entry could not be read, and the store cannot say whether it exists.Anything the codes above do not cover.The envelope is well formed and declares a version, suite or KDF this build does not implement. -
Method Summary
Modifier and TypeMethodDescriptionstatic VaultErrorReturns the enum constant of this type with the specified name.static VaultError[]values()Returns an array containing the constants of this enum type, in the order they are declared.Methods inherited from class Enum
clone, compareTo, equals, getDeclaringClass, getEnumValues, hashCode, name, ordinal, setEnumValues, toString, valueOf
-
Enum Constant Details
-
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
The cryptographic provider is missing or failed. On the browser,crypto.subtleabsent -- which is what an insecure context looks like from inside the page -- or present and unable to complete the operation. -
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
Hardened storage was requested from an insecure context -- plainhttp:on anything butlocalhost. Web Crypto is unavailable there by specification, and a vault that pretended otherwise would be encrypting nothing. -
LOCKED
The vault exists but is locked. Unlock it and retry; nothing is wrong with the data. -
CANCELLED
The user dismissed a prompt, or the operation was aborted. Distinct fromAUTHENTICATION_FAILED: nobody failed a check, the check did not happen. -
KEY_MISSING
The store answered, and the key or entry is definitely not there. Only this code -- never a null, neverTEMPORARILY_UNREADABLE-- justifies creating a replacement. -
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
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
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
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
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
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
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
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
Anything the codes above do not cover.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-