API reference
Synchronous hush-hush client.
A single instance handles both read and write calls. The credential is only actually required by hush-hush on write operations (create/update/delete); reads (get, used-by, audit-log query) succeed without one, since hush-hush's confidentiality boundary is "who holds a matching private key," not who's calling the endpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_url
|
str
|
Base URL of the hush-hush instance to call, e.g.
|
required |
api_key
|
str | None
|
Bearer credential for write operations. Falls back to the
|
None
|
timeout
|
float
|
Per-request timeout, in seconds. |
DEFAULT_TIMEOUT
|
max_retries
|
int
|
How many times a request is retried after a network failure or a 5xx/429 response before the error is raised to the caller. Any other 4xx is never retried. |
3
|
create_object(slug, value, *, used_by=None, caller=None)
Stores an already-sealed value under a new, caller-chosen slug.
Requires a credential (see api_key/HUSH_HUSH_API_KEY).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slug
|
str
|
The new object's slug. Must match hush-hush's slug pattern
(lowercase alphanumeric, |
required |
value
|
bytes
|
The already-sealed (encrypted) value. This SDK never encrypts or decrypts anything — hush-hush stores whatever bytes it's given as opaque ciphertext. |
required |
used_by
|
list[str] | None
|
Consumers (repos or hosts) recorded as depending on this object. Set once, at creation; unaffected by later value updates. |
None
|
caller
|
str | None
|
Recorded in the audit log as the calling program's self-reported identity. Not verified by the server. |
None
|
Returns:
| Type | Description |
|---|---|
ObjectMetadata
|
The created object's metadata. |
Raises:
| Type | Description |
|---|---|
APIError
|
If the server responds with anything other than 201 (for example, 401 for a missing/invalid credential, or 409 if an object already exists under that slug). |
delete_object(slug, *, caller=None)
Permanently removes an object. A subsequent get by this slug returns a 404 APIError. Requires a credential.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slug
|
str
|
The object's slug. |
required |
caller
|
str | None
|
Recorded in the audit log as the calling program's self-reported identity. Not verified by the server. |
None
|
Raises:
| Type | Description |
|---|---|
APIError
|
If the server responds with anything other than 204 (for example, 401 or 404). |
get_object(slug, *, caller=None)
Fetches an object's sealed ciphertext exactly as stored — this SDK never decrypts it, the same as the server. Needs no credential.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slug
|
str
|
The object's slug. |
required |
caller
|
str | None
|
Recorded in the audit log as the calling program's self-reported identity. Not verified by the server. |
None
|
Returns:
| Type | Description |
|---|---|
bytes
|
The object's raw sealed ciphertext. |
Raises:
| Type | Description |
|---|---|
APIError
|
If the server responds with anything other than 200 (for example, 404 if no object exists under that slug). |
get_object_used_by(slug)
Returns the recorded list of consumers for an object — the "what depends on this" mapping set at creation. Needs no credential.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slug
|
str
|
The object's slug. |
required |
Returns:
| Type | Description |
|---|---|
UsedBy
|
The object's recorded consumers. |
Raises:
| Type | Description |
|---|---|
APIError
|
If the server responds with anything other than 200 (for example, 404 if no object exists under that slug). |
health()
query_audit_log(*, object_id=None, caller=None, from_=None, to=None, order='asc')
Queries the audit log — every create, read, update, and delete call is recorded here. Needs no credential. Filters combine with AND when more than one is given.
hush-hush's /audit-log endpoint has no pagination parameters, so
this always returns the full matching result set as a single list,
never a page plus a cursor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
object_id
|
str | None
|
Restrict to entries for this object id. |
None
|
caller
|
str | None
|
Restrict to entries recorded with this caller identity. |
None
|
from_
|
datetime | None
|
Restrict to entries at or after this time. |
None
|
to
|
datetime | None
|
Restrict to entries at or before this time. |
None
|
order
|
Literal['asc', 'desc']
|
"asc" (the default) returns oldest entries first, "desc" newest first. Only "asc" and "desc" are accepted, and a type checker rejects anything else. |
'asc'
|
Returns:
| Type | Description |
|---|---|
list[AuditLogEntry]
|
Matching audit log entries, in the requested order. |
Raises:
| Type | Description |
|---|---|
APIError
|
If the server responds with anything other than 200. |
update_object(slug, value, *, caller=None)
Replaces the stored ciphertext for an existing object. The object's slug and used-by metadata are unchanged. Requires a credential.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slug
|
str
|
The existing object's slug. |
required |
value
|
bytes
|
The new already-sealed (encrypted) value. |
required |
caller
|
str | None
|
Recorded in the audit log as the calling program's self-reported identity. Not verified by the server. |
None
|
Returns:
| Type | Description |
|---|---|
ObjectMetadata
|
The updated object's metadata. |
Raises:
| Type | Description |
|---|---|
APIError
|
If the server responds with anything other than 200 (for example, 401 or 404). |
Asynchronous hush-hush client — see Client for
the shared behavior every method here has an await-able equivalent of.
create_object(slug, value, *, used_by=None, caller=None)
async
See Client.create_object.
delete_object(slug, *, caller=None)
async
See Client.delete_object.
get_object(slug, *, caller=None)
async
See Client.get_object.
get_object_used_by(slug)
async
health()
async
See Client.health.
query_audit_log(*, object_id=None, caller=None, from_=None, to=None, order='asc')
async
update_object(slug, value, *, caller=None)
async
See Client.update_object.
Bases: Exception
Raised for any non-2xx response from hush-hush.
Attributes:
| Name | Type | Description |
|---|---|---|
status_code |
The HTTP status hush-hush responded with. |
|
request_id |
str | None
|
Populated when the response carries a documented
request-ID header; hush-hush's spec doesn't currently document
one, so this is usually |
message |
str | None
|
The parsed |
body |
bytes
|
The raw, unparsed response body, for a caller that needs more
than |
Models
Generated model types returned by Client/AsyncClient's own methods —
documented here so a reference to one elsewhere on this site links to a
real page instead of rendering as plain text.
Attributes:
| Name | Type | Description |
|---|---|---|
status |
Literal['ok']
|
|
version |
str
|
The running server's own version, as goreleaser stamped it -
"dev" for a plain |
environment |
str | Unset
|
The operator's own short label for this instance, from the
|
Attributes:
| Name | Type | Description |
|---|---|---|
id |
UUID
|
The object's UUID. Several objects can share a name (each is a variant, with its own value and
consumers), so this is what tells them apart and what |
slug |
str
|
A caller-chosen, unique identifier for an object - what every
documented request path (URL, CLI, API) addresses it by. Letters of
either case, digits, |
tags |
list[str]
|
Labels for grouping and filtering objects ( |
used_by |
list[str] | Unset
|
The consumers (repos or hosts) recorded as depending on this object. Set at creation, and replaceable later via UpdateObjectRequest's own used_by field - a plain value update that omits it leaves the list as it was. A consumer named more than once is recorded once. |
description |
str | Unset
|
A free-text label set at creation, for a reader who only knows the slug. Fixed at creation - there is no way to change it later. |
keep_readable_copy |
bool | Unset
|
Requests that the owner's own escrowed identity public key be included as an additional decrypt recipient, alongside whatever consumer recipients the client already resolved (specs/secret-objects/spec.md's "Opt-in owner-recipient inclusion at create time" requirement). Omitting this field (the default) means the owner is not added as a recipient - this service never makes ownership imply decrypt access on its own. This is a client-side sealing instruction, not something this
service enforces or verifies: it never decrypts, and never adds a
recipient to |
created_at |
datetime | Unset
|
When the object was created. Returned by |
updated_at |
datetime | Unset
|
When the object's value was last replaced - equal to
|
created_by |
Actor | Unset
|
Who performed an audited write. |
updated_by |
Actor | Unset
|
Who performed an audited write. |
Attributes:
| Name | Type | Description |
|---|---|---|
used_by |
list[str]
|
The consumers (repos or hosts) recorded as depending on this object. Set at creation, and replaceable later via UpdateObjectRequest's own used_by field - a plain value update that omits it leaves the list as it was. A consumer named more than once is recorded once. |
Attributes:
| Name | Type | Description |
|---|---|---|
id |
int
|
This entry's own id - stable and strictly increasing, so it
doubles as the cursor for the |
object_id |
str
|
A caller-chosen, unique identifier for an object - what every
documented request path (URL, CLI, API) addresses it by. Letters of
either case, digits, |
action |
AuditLogEntryAction
|
|
timestamp |
datetime
|
|
ip |
str
|
The request's source IP. Unlike caller, this is never self-reported - it's the one piece of the request nobody gets to lie about via a header. Currently the immediate TCP peer's address; this service isn't deployed behind a reverse proxy or load balancer, so X-Forwarded-For (or similar) support isn't implemented yet. |
variant_id |
UUID | Unset
|
The UUID of the object the entry is about. |
caller |
str | Unset
|
The caller's presented identity, if any. |
actor_type |
AuditLogEntryActorType | Unset
|
The kind of verified credential that authenticated this call - absent for an unauthenticated read. Unlike caller, this is never self-reported. |
actor_id |
str | Unset
|
The specific token id or admin account this call was authenticated as - absent for an unauthenticated read. |