Class RepoLocator

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

public final class RepoLocator extends Object
The token the owner gives a joiner (AVP SPEC 11.2): the repository id, the owner's home host (its key and its locator) and the fingerprint of the owner key. The joiner reaches the owner's home host with it, by key (VaultHosts.connect(RepoLocator)), and checks, once it has pulled the chain, that the genesis owner key matches the fingerprint (SharedVault.join(VaultHost, VaultIdentity, RepoLocator)).

It holds no secret: its text() is meant to be pasted to someone.

Since:
1.0.0
  • Method Details

    • parse

      public static RepoLocator parse(String text)
      Reads a repo locator from pasted text. Whitespace anywhere in the text (around it, or a line break a chat client inserted) is ignored.
      Parameters:
      text - the pasted text
      Returns:
      the locator
      Throws:
      AltsException - of kind INVALID_INPUT if the text is not a version 2 repo locator
      Since:
      1.0.0
    • text

      public String text()
      The token text to give the joiner: base64url without padding (SPEC 11.1).
      Returns:
      the text
      Since:
      1.0.0
    • repoId

      public String repoId()
      The repository id, 22 base64url characters; a repository's identity, which never names a host.
      Returns:
      the id
      Since:
      1.0.0
    • hostKey

      public String hostKey()
      The key of the owner's home host, base64.
      Returns:
      the host key
      Since:
      1.0.0
    • hostLocator

      public String hostLocator()
      Where the owner's home host is reached, host or host:port: a hint, never the host's identity, which is its key.
      Returns:
      the host locator
      Since:
      1.0.0
    • ownerFingerprint

      public String ownerFingerprint()
      The owner fingerprint, 16 hex digits of SHA-256(ownerKey), to compare with the one the owner sees (OwnerIdentity.fingerprint()).
      Returns:
      the fingerprint
      Since:
      1.0.0
    • avpUri

      public String avpUri()
      The avp://<hostLocator>/<repoId> address of the repository at the owner's home host.
      Returns:
      the address
      Since:
      1.0.0
    • equals

      public boolean equals(Object o)
      Whether o is a locator with the same text.
      Overrides:
      equals in class Object
      Parameters:
      o - the other object
      Returns:
      whether they are equal
      Since:
      1.0.0
    • hashCode

      public int hashCode()
      Hashes what equals(Object) compares.
      Overrides:
      hashCode in class Object
      Returns:
      the hash
      Since:
      1.0.0
    • toString

      public String toString()
      The address and the owner fingerprint.
      Overrides:
      toString in class Object
      Returns:
      a description
      Since:
      1.0.0