Class IdentityManager


public final class IdentityManager extends Object
Utility class for writing an Identity to a Path and vice versa.
  • Method Details

    • isIdentityFilePresent

      public static boolean isIdentityFilePresent(Path path)
      Returns true if the identity file path exists. Otherwise false is returned.
      path - path to identity file
      true if file exists
    • readIdentityFile

      public static Identity readIdentityFile(Path path) throws IOException
      Reads the identity from code. Throws IOException if file cannot be read or file has unexpected content.
      path - path to identity file
      The identity contained in the file
      IOException - if identity could not be read from file or has an invalid proof of work
    • writeIdentityFile

      public static void writeIdentityFile(Path path, Identity identity) throws IOException
      Writes the identity identity to the file path. Attention: If path already contains an identity, it will be overwritten without warning.
      path - path where the identity should be written to
      identity - this identity is written to the file
      IOException - if the identity could not be written to the file
    • deleteIdentityFile

      public static void deleteIdentityFile(Path path) throws IOException
      Deletes the identity file specified in the configuration.

      ATTENTION: Messages directed to the present identity can then no longer be decrypted and read. This step is irreversible. Should only be used if the present identity should never be used again!

      IOException - if identity file could not be deleted