Class LibSecretKeyring

java.lang.Object
org.tentackle.keyring.AbstractKeyring
org.tentackle.keyring.platform.LibSecretKeyring
All Implemented Interfaces:
Keyring

public class LibSecretKeyring extends AbstractKeyring
A keyring backed by the freedesktop.org Secret Service via libsecret.

Used on Linux and the other Unixes. It needs a Secret Service provider on the session bus, such as GNOME Keyring, KWallet, or KeePassXC. On a headless machine, over SSH without a session, or in a container, there usually is none, and the keyring is not available.

The secrets go to the default collection, "login" on most desktops, which the user's login unlocks. They show up in Seahorse ("Passwords and Keys") or KWalletManager with their label.

  • Field Details

  • Constructor Details

    • LibSecretKeyring

      public LibSecretKeyring()
      Creates the keyring.
      Throws:
      KeyringException - if libsecret is not installed
  • Method Details

    • getName

      public String getName()
    • isAvailable

      public boolean isAvailable()

      Looks up a secret that does not exist, which fails if there is no Secret Service on the session bus. Since nothing matches, no locked collection is unlocked, and the user is not prompted.

      Overrides:
      isAvailable in class AbstractKeyring
    • doStore

      protected void doStore(SecretId id, String label, char[] secret)
      Specified by:
      doStore in class AbstractKeyring
    • doLoad

      protected char[] doLoad(SecretId id)
      Specified by:
      doLoad in class AbstractKeyring
    • doRemove

      protected boolean doRemove(SecretId id)
      Specified by:
      doRemove in class AbstractKeyring