Class OwnerIdentity

java.lang.Object
lol.trq.alts.vault.OwnerIdentity

public final class OwnerIdentity extends Object
The owner of a repository (AVP SPEC 3.1): the keys derived from a 24-word BIP39 phrase. The owner key is fixed for the repository's life; only it signs the manifest states that change the members, the refresh-token policy or the hosts. The owner's own device is also a member, whose keys derive from the same phrase.

This is a secret: whoever holds the phrase or the entropy owns the repository. A host persists it as its entropy() (for example in HostSecrets) and restores it with fromEntropy(byte[]), or shows the phrase() once and keeps nothing, and restores it with fromPhrase(String). A second owner device gets it without typing the phrase through a LinkSession. No method of the library sends the phrase, the entropy, the seed or a private key to a host, and toString() shows none of them.

Since:
1.0.0
  • Field Details

    • ENTROPY_BYTES

      public static final int ENTROPY_BYTES
      The length of the mnemonic entropy: 32 bytes, 24 words.
      Since:
      1.0.0
      See Also:
  • Method Details

    • generate

      public static OwnerIdentity generate()
      A new owner from fresh entropy. Show its phrase() to the owner to write down, or keep its entropy(), before creating a repository with it.
      Returns:
      the identity
      Since:
      1.0.0
    • fromPhrase

      public static OwnerIdentity fromPhrase(String phrase)
      The owner from a typed or pasted phrase. Case and the whitespace between and around the words do not matter; the words and the checksum are checked (SPEC 3.1).
      Parameters:
      phrase - the 24 words
      Returns:
      the identity
      Throws:
      AltsException - of kind INVALID_INPUT if the phrase is not 24 words of the BIP39 English list with a matching checksum
      Since:
      1.0.0
    • fromEntropy

      public static OwnerIdentity fromEntropy(byte[] entropy)
      The owner from the entropy a host persisted.
      Parameters:
      entropy - the 32 bytes entropy() returned; copied
      Returns:
      the identity
      Throws:
      AltsException - of kind INVALID_INPUT if it is not 32 bytes
      Since:
      1.0.0
    • phrase

      public String phrase()
      The 24-word phrase. A secret: show it to the owner, never log it.
      Returns:
      the words, separated by single spaces
      Since:
      1.0.0
    • entropy

      public byte[] entropy()
      The mnemonic entropy, the form a host persists. A secret.
      Returns:
      a copy of the 32 bytes, which the caller zeroes when done
      Since:
      1.0.0
    • memberId

      public String memberId()
      The owner key as a member id: the owner's Ed25519 public key, base64.
      Returns:
      the member id
      Since:
      1.0.0
    • fingerprint

      public String fingerprint()
      The owner fingerprint (SPEC 11.2), 16 hex digits, which a joiner's RepoLocator carries.
      Returns:
      the fingerprint
      Since:
      1.0.0
    • toString

      public String toString()
      The fingerprint only; never the phrase, the entropy or a key.
      Overrides:
      toString in class Object
      Returns:
      a description
      Since:
      1.0.0