Interface ISecretsStore

All Known Implementing Classes:
SecretsStore

public interface ISecretsStore
The secrets store as the property framework sees it: a map from a key (see ISecretsContext) to the value of a secret property in its element-string form, i.e. what toElementString would have written to the XML file. A PasswordProp thus stays obfuscated, a StringProp clear and a PKCS12IdentityProp its hexadecimal bytes: the store never needs the property class, and each class keeps its own codec.

An implementation never puts a value in a log line, an exception message or its toString. Whether and when a change reaches the file is the implementation's business; the property framework only calls these methods.

Author:
Christopher Mindus
  • Method Summary

    Modifier and Type
    Method
    Description
    get(String key)
    Gets the value of a key.
    default boolean
    has(String key)
    Tells whether the store has an entry for a key, without handing out its value: the Designer's Push page shows where a secret is, never what it is (ruling PP-D-4).
    boolean
    Checks if the store can be written to.
    void
    put(String key, String value)
    Puts a value under a key, replacing a previous one.
    default void
    putProp(String key, GProp<?> prop)
    Puts the value of a secret property under a key: its element-string form, and, for an implementation that keeps the class of an entry in its file (decision P-13), the class.
    void
    Removes a key.
  • Method Details

    • get

      String get(String key)
      Gets the value of a key.
      Parameters:
      key - The key.
      Returns:
      The element-string value, or null when the store has no entry for the key.
    • has

      default boolean has(String key)
      Tells whether the store has an entry for a key, without handing out its value: the Designer's Push page shows where a secret is, never what it is (ruling PP-D-4). The default asks get(String) and drops the answer; a store that can list its keys answers from them.
      Parameters:
      key - The key.
      Returns:
      true when the store has an entry for the key.
    • put

      void put(String key, String value)
      Puts a value under a key, replacing a previous one.
      Parameters:
      key - The key.
      value - The element-string value, never null: use remove(String) instead.
      Throws:
      IllegalStateException - if the store is read-only.
    • putProp

      default void putProp(String key, GProp<?> prop)
      Puts the value of a secret property under a key: its element-string form, and, for an implementation that keeps the class of an entry in its file (decision P-13), the class. The default puts prop.toElementString(value) through put(String,String); SecretsStores.commit calls this method (CC-SECRETS-SK2-STORE, decision SK2-D-4).
      Parameters:
      key - The key.
      prop - The property, whose value must not be null: use remove(String) instead.
      Throws:
      IllegalArgumentException - if the property has no value.
      IllegalStateException - if the store is read-only.
    • remove

      void remove(String key)
      Removes a key. Removing an absent key does nothing.
      Parameters:
      key - The key.
      Throws:
      IllegalStateException - if the store is read-only.
    • isReadOnly

      boolean isReadOnly()
      Checks if the store can be written to.
      Returns:
      true when the store is read-only, e.g. a mounted container secret, false otherwise.