has_secret
Check if a secret exists in the quantum-inspired vault without revealing its value. Returns true for valid secrets, false for missing or expired 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:246-261 (handler)The implementation of hasSecret checks if a secret exists and is not expired across the resolved 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; }