has_secret
Check if a secret exists in your vault without revealing its value. Returns true for valid secrets, false for expired or missing ones.
Instructions
Check if a secret exists. Returns boolean. Never reveals the value. Respects decay — expired secrets return false.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | The secret key name | |
| scope | No | Scope: global or project | |
| projectPath | No | Project root path for project-scoped secrets |
Implementation Reference
- src/core/keyring.ts:280-295 (handler)The actual implementation of hasSecret which checks for the existence of an unexpired secret envelope within the provided scopes.
export function hasSecret( key: string, opts: KeyringOptions = {}, ): boolean { const scopes = resolveScope(opts); for (const { service } of scopes) { const envelope = readEnvelope(service, key); if (envelope) { const decay = checkDecay(envelope); if (!decay.isExpired) return true; } } return false; }