Class VaultSnapshot

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

public final class VaultSnapshot extends Object
What one member device keeps of a repository between runs, for the host to persist and pass back to SharedVault.resume(VaultHost, OwnerIdentity, VaultSnapshot): the verified chain as its state hashes, whose last is the pin a rollback must not go below (AVP SPEC 6.4); every data key this device has held, by epoch, so old-epoch heads stay readable; the clock (SPEC 5); the merged payload; whether this member left; the member it belongs to; and its home host, key and locator, so VaultHosts.connect(VaultSnapshot) reaches it by key.

It names the member by its member id and does not hold the identity: the host keeps the identity on its own (WrappedIdentity for a member, OwnerIdentity.entropy() for the owner) and passes it to resume, which refuses an identity that is not the one named here.

It holds secrets (the data keys and the accounts' credentials), so persist its toJson() encrypted, for example in HostSecrets, never in plain text. toString() shows neither.

Since:
1.0.0
  • Method Details

    • toJson

      public String toJson()
      The JSON form to persist. A secret.
      Returns:
      compact JSON
      Since:
      1.0.0
    • fromJson

      public static VaultSnapshot fromJson(String json)
      Reads a snapshot from its JSON form.
      Parameters:
      json - what toJson() returned
      Returns:
      the snapshot
      Throws:
      AltsException - of kind INVALID_INPUT if the text is not a snapshot of this version
      Since:
      1.0.0
    • repoId

      public String repoId()
      The repository.
      Returns:
      the repository id
      Since:
      1.0.0
    • memberId

      public String memberId()
      The member this snapshot belongs to.
      Returns:
      the member id
      Since:
      1.0.0
    • homeHost

      public HostRef homeHost()
      The member's home host, by key; VaultHosts.connect(VaultSnapshot) reaches it.
      Returns:
      the home host
      Since:
      1.0.0
    • pinnedSeq

      public long pinnedSeq()
      The seq of the pinned state, the highest this device verified.
      Returns:
      the seq
      Since:
      1.0.0
    • left

      public boolean left()
      Whether this member left the repository; such a snapshot does not resume.
      Returns:
      whether it left
      Since:
      1.0.0
    • toString

      public String toString()
      The repository, the pin and counts only; never a key or an account.
      Overrides:
      toString in class Object
      Returns:
      a description
      Since:
      1.0.0