Enum VaultError

java.lang.Object
java.lang.Enum<VaultError>
com.codename1.security.vault.VaultError
All Implemented Interfaces:
Comparable<VaultError>

public enum VaultError extends Enum<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 Constants
    Enum Constant
    Description
    The 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 -- plain http: on anything but localhost.
    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 Type
    Method
    Description
    static VaultError
    Returns the enum constant of this type with the specified name.
    static VaultError[]
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • STORAGE_UNAVAILABLE

      public static final VaultError 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

      public static final VaultError 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

      public static final VaultError 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

      public static final VaultError 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

      public static final VaultError LOCKED
      The vault exists but is locked. Unlock it and retry; nothing is wrong with the data.
    • CANCELLED

      public static final VaultError 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

      public static final VaultError 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

      public static final VaultError 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

      public static final VaultError 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

      public static final VaultError 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

      public static final VaultError 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

      public static final VaultError 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

      public static final VaultError 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

      public static final VaultError 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

      public static final VaultError 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

      public static final VaultError UNKNOWN
      Anything the codes above do not cover.
  • Method Details

    • values

      public static VaultError[] 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

      public static VaultError valueOf(String name)
      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 name
      NullPointerException - if the argument is null