Secrets for components, sensitive values looked up by key.
Interfaces
storesince 0.1.0 โ A store of secrets, sensitive values looked up by key, e.g. passwords, tokens and keys.
Worlds
WIT
/// Secrets for components, sensitive values looked up by key.
package componentized:secrets@0.1.0;
/// A store of secrets, sensitive values looked up by key, e.g. passwords, tokens and keys.
@since(version = 0.1.0)
interface store {
/// The value of a secret.
variant secret {
/// A secret that is text.
%string(string),
/// A secret that is binary.
///
/// Encoded text is discouraged, favor a string.
bytes(list<u8>),
}
/// An error getting a secret.
variant error-code {
/// The store is not initialized, call `init()` first.
not-initialized,
/// The store has no secret for the key.
not-found,
/// Any other error, e.g. the store is unavailable or access to the secret is denied, with
/// a message describing the error, when there is one.
other(option<string>),
}
/// Initialize the store.
///
/// The store must be initialized before use. Secrets are immutable after
/// initialization completes. Subsequent calls to initialize are no-ops.
init: async func() -> result<_, error-code>;
/// Gets the secret for the key.
///
/// Returns `error-code::not-found` when the store has no secret for the
/// key. Returns `error-code::not-initialized` when the store is not
/// initialized, call `init()` first.
get: func(key: string) -> result<secret, error-code>;
}
/// A component that provides secrets, e.g. from a vault or another source of secrets.
world provider {
export store;
}
/// The interfaces to import to use secrets.
world imports {
import store;
}