Interface KeySource


public interface KeySource
  • Method Details

    • aliases

      Reads all key aliases from key source with corresponding key metadata
      Returns:
      stream of key aliases with metadata
    • aliasesFor

      <T extends ProvidedKeyTemplate> Stream<WithMetadata<String>> aliasesFor(Class<T> clazz)
      Reads key aliases with metadata filtered by key type
      Type Parameters:
      T - acts as a type-selector so can be safely used for KeyStore too
      Parameters:
      clazz - type of keys to filter
      Returns:
      aliases from keysource with given type of keys
    • asAliasWithMeta

      WithMetadata<String> asAliasWithMeta(String alias)
      Reads metadata by alias from keysource
      Parameters:
      alias - name used to find key
      Returns:
      alias with metadata
    • asEntry

      Finds key by alias and represents it as key entry with metadata
      Parameters:
      alias - name used to find entry
      Returns:
      selected by alias keystore entry
    • asPair

      WithMetadata<KeyPair> asPair(String alias)
      Finds key by alias and represents it as key pair with metadata
      Parameters:
      alias - name used to find key pair
      Returns:
      selected by alias key pair
    • asKey

      WithMetadata<Key> asKey(String alias)
      Finds key by alias and returns it with metadata
      Parameters:
      alias - ame used to find key
      Returns:
      selected by alias key
    • remove

      void remove(String keyId)
      Removes key by keyId from key source
      Parameters:
      keyId - key alias
    • addAndReturnId

      String addAndReturnId(ProvidedKeyTemplate keyTemplate)
      Adds key to key source
      Parameters:
      keyTemplate - keeps key, key metadata and acts as alias source (either generate alias or hardcode it) for the key
      Returns:
      generated key alias
    • updateMetadata

      void updateMetadata(AliasWithMeta aliasWithMetadata)
      Updates metadata for specified by alias key
      Parameters:
      aliasWithMetadata - new metadata and key alias
    • allAssociatedEntries

      Set<String> allAssociatedEntries(String keyId)
      List all child entries ids that are associated with given key id (i.e. metadata), INCLUDING itself