Skip to main content

Module unlock

Module unlock 

Source
Expand description

Deciding how to unlock an identity, and then unlocking it.

Everything comes from the environment; the CLI never prompts for secrets.

Resolution (see resolve_unlock_method):

  • Neither HASHIVERSE_KEYPHRASE nor HASHIVERSE_PROFILE set → read-only guest (the empty keyphrase, GUEST_CLIENT_ID). Reading posts and trending hashtags needs no identity; crate::commands::post refuses for guests.
  • Both set → error: they name potentially different identities.
  • Exactly one set → HASHIVERSE_PASSWORD must also be set (an empty value is allowed, but the variable must exist), otherwise it is an error.
    • HASHIVERSE_KEYPHRASE → derive the key from the keyphrase and save it to the data dir encrypted with the password, so later runs can use HASHIVERSE_PROFILE.
    • HASHIVERSE_PROFILE / --profile → load that stored key, decrypting with the password.

Enums§

UnlockMethod

Functions§

is_guest
resolve_unlock_method
unlock
Builds a Hashiverse client for the resolved identity.