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. 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 }); // all project secrets
await tek.secret.list({ scope: 'personal' }); // only yours
await tek.secret.list({ scope: 'org' }); // organization secrets
for await (const s of tek.secret.listAll()) console.log(s.key);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: 'OPENAI_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' });