Secrets
Manage project- and org-scoped secrets with @tektona/sdk.
tek.secret manages secrets. A secret's scope is org (organization-wide),
project (shared with the project), or personal (only you, within the project).
Project is the default: methods resolve the org and project from the client scope
(or a per-call org/project). Pass scope: 'org' to target organization secrets.
Secret values are write-only: create and update accept a value, but responses
return only metadata (id, key, scope, type, owner_user_id, created_at,
updated_at).
List
list() returns one Page of entries. An entry is a
folder or a secret: it has a kind and a name, and a secret entry holds the
secret in secret. scope selects what to
list — omit it for all project secrets, project/personal to filter the
project's, or org for organization secrets:
const page = await tek.secret.list({ limit: 50 }); // the root level of all project secrets
await tek.secret.list({ scope: 'personal' }); // only yours
await tek.secret.list({ scope: 'org' }); // organization secrets
for await (const e of tek.secret.listAll({ q: 'api' })) console.log(e.secret?.key); // every key that contains "api"A key such as payments/live/api-key lies in the folder payments/live. Without
a filter, list() returns one level at the root: its folders first, then its
secrets. name is relative to the listed folder:
await tek.secret.list({ folder: 'payments/live' }); // one level under payments/live
await tek.secret.list({ q: 'live' }); // secrets whose key contains "live", every depth
await tek.secret.list({ key: 'payments/live/api-key' }); // exactly this keykey cannot be combined with folder or q. q returns no folders.
Create
The endpoint is chosen from the body's scope — org creates an organization
secret, otherwise a project secret. type is generic or git:
const secret = await tek.secret.create({
key: 'payments/live/api-key',
value: 'sk-...',
scope: 'project', // 'project' (shared) | 'personal' | 'org'
type: 'generic',
});Update & delete
Identified by the secret's unique id. Pass { scope: 'org' } for an organization
secret; project is the default:
await tek.secret.update(secret.id, { value: 'sk-new...', type: 'generic' });
await tek.secret.delete(secret.id); // idempotent: a missing secret resolves cleanly
// organization secret:
await tek.secret.update(orgSecretId, { value: 'v2', type: 'generic' }, { scope: 'org' });
await tek.secret.delete(orgSecretId, { scope: 'org' });