Skip to content
Plugins (183)

keyring

stable

Secure key-value secret storage organized by service name, persisted as a JSON file in the system temp directory.

use plugin keyring::{set_secret, get_secret, delete_secret, …}
9 functions Cryptography
Runs with the native Zolo host

Plugin snippets can be edited in the Playground, but native capabilities are executed locally with the Zolo CLI.

/ filter jk navigate Esc clear
Functions (9)
  1. set_secret Store a secret value for a service and key
  2. get_secret Retrieve a secret value by service and key
  3. delete_secret Remove a specific secret entry
  4. list_services List all registered service names
  5. list_keys List all key names for a service
  6. has_secret Check if a secret exists
  7. clear_service Remove all secrets for a service
  8. secret_count Count secrets stored for a service
  9. storage_path Get the path to the secrets storage file

From import to result

  1. 01Import only what you use
  2. 02Copy the smallest example
  3. 03Run it with the Zolo CLI

Store a secret value for a service and key

Stores a secret string under service + key. Creates the service namespace automatically if it does not exist. Use this to persist API tokens, passwords, or other sensitive strings across program runs.

use plugin keyring::{set_secret}

set_secret("myapp", "api_token", "sk-abc123")
set_secret("myapp", "db_password", "hunter2")

Retrieve a secret value by service and key

Retrieves the secret stored at service + key. Returns nil if the entry does not exist.

use plugin keyring::{set_secret, get_secret}

set_secret("myapp", "api_token", "sk-abc123")
let token = get_secret("myapp", "api_token")
print("Token: {token}")

Remove a specific secret entry

Removes a single secret entry. If the service becomes empty after deletion it is also removed. Does nothing if the key does not exist.

use plugin keyring::{delete_secret}

delete_secret("myapp", "old_token")

List all registered service names

Returns an array of all service names currently in the store. Useful for auditing which services have stored secrets.

use plugin keyring::{list_services}

let services = list_services()
print("Registered services: {services}")

List all key names for a service

Returns an array of all key names stored under service. Returns an empty table if the service does not exist.

use plugin keyring::{set_secret, list_keys}

set_secret("myapp", "api_token", "abc")
set_secret("myapp", "db_password", "xyz")
let keys = list_keys("myapp")
print("Keys: {keys}")

Check if a secret exists

Returns true if a secret exists for the given service and key, false otherwise. Use this before calling get_secret to avoid nil checks.

use plugin keyring::{has_secret, get_secret}

if has_secret("myapp", "api_token") {
  let token = get_secret("myapp", "api_token")
  print("Using token: {token}")
} else {
  print("No token configured")
}

Remove all secrets for a service

Removes all secrets stored under service. The service namespace is deleted entirely.

use plugin keyring::{clear_service}

clear_service("myapp")

Count secrets stored for a service

Returns the number of secrets stored for a service. Returns 0 if the service does not exist.

use plugin keyring::{secret_count}

let n = secret_count("myapp")
print("myapp has {n} secrets")

Get the path to the secrets storage file

Returns the absolute path to the JSON file used for persistent storage. Useful for debugging or backing up secrets.

use plugin keyring::{storage_path}

let path = storage_path()
print("Secrets stored at: {path}")

Global index

Find your way through Zolo

Try an idea

Start here

9 results

9 results

en