Record Class MnemonicKey

java.lang.Object
java.lang.Record
org.moera.lib.crypto.MnemonicKey

public record MnemonicKey(String secret, String mnemonic, ECPublicKey publicKey) extends Record
Represents a cryptographic key derived from a mnemonic phrase. This class is designed to store a secret, a mnemonic phrase, and the associated public key.

The mnemonic phrase is used as a human-readable representation of a cryptographic seed, which can be securely stored or transferred. The public key is derived from this key material and can be used in cryptographic operations.

Fields:
- secret: The secret key material associated with the mnemonic.
- mnemonic: The mnemonic phrase used as a human-friendly representation of the secret.
- publicKey: The elliptic curve public key generated from the secret.

  • Constructor Details

    • MnemonicKey

      public MnemonicKey(String secret, String mnemonic, ECPublicKey publicKey)
      Creates an instance of a MnemonicKey record class.
      Parameters:
      secret - the value for the secret record component
      mnemonic - the value for the mnemonic record component
      publicKey - the value for the publicKey record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • secret

      public String secret()
      Returns the value of the secret record component.
      Returns:
      the value of the secret record component
    • mnemonic

      public String mnemonic()
      Returns the value of the mnemonic record component.
      Returns:
      the value of the mnemonic record component
    • publicKey

      public ECPublicKey publicKey()
      Returns the value of the publicKey record component.
      Returns:
      the value of the publicKey record component