Skip to content

@codesoul-co/hypha-tools / secrets

Using this module

Use the Secrets module for passing governed secret references and resolution contracts. It exports 5 interfaces.

Import from the package entrypoint

ts
import type {
  CredentialLease,
  SecretProvider,
  SecretResolutionContext,
  SecretResolver,
  ToolSecretResolver,
} from '@codesoul-co/hypha-tools';

Usage patterns

  • Use the 5 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.

Public exports

SymbolKindSignatureDescription
CredentialLeaseinterfaceinterface CredentialLeaseCredential Lease interface with 5 public fields or methods.
SecretProviderinterfaceinterface SecretProviderSecret Provider interface with 2 public fields or methods.
SecretResolutionContextinterfaceinterface SecretResolutionContextSecret Resolution Context interface with 2 public fields or methods.
SecretResolverinterfaceinterface SecretResolverProvider-neutral boundary for resolving opaque references at the last responsible moment. Implementations must never persist or log lease values.
ToolSecretResolverinterfaceinterface ToolSecretResolverProvider-neutral boundary for resolving opaque references at the last responsible moment. Implementations must never persist or log lease values.

CredentialLease

Credential Lease interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { CredentialLease } from '@codesoul-co/hypha-tools';
  • Source module: secrets

Declaration

text
export interface CredentialLease {
    readonly expiresAt?: string;
    readonly renewable: boolean;
    read(): string;
    renew?(): Promise<CredentialLease>;
    release?(): Promise<void>;
}

Contract members

MemberKindSignatureDescription
expiresAtpropertyreadonly expiresAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
readmethodread(): stringPublic method; parameters and return type are shown in the signature.
releasemethodrelease?(): Promise<void>Public method; parameters and return type are shown in the signature.
renewmethodrenew?(): Promise<CredentialLease>Public method; parameters and return type are shown in the signature.
renewablepropertyreadonly renewable: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.

SecretProvider

Secret Provider interface with 2 public fields or methods.

  • Kind: interface
  • Import: import type { SecretProvider } from '@codesoul-co/hypha-tools';
  • Source module: secrets

Declaration

text
export interface SecretProvider {
    readonly scheme: string;
    acquire(reference: string, context?: SecretResolutionContext): Promise<CredentialLease | null>;
}

Contract members

MemberKindSignatureDescription
acquiremethodacquire(reference: string, context?: SecretResolutionContext): Promise<CredentialLease | null>Public method; parameters and return type are shown in the signature.
schemepropertyreadonly scheme: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

SecretResolutionContext

Secret Resolution Context interface with 2 public fields or methods.

  • Kind: interface
  • Import: import type { SecretResolutionContext } from '@codesoul-co/hypha-tools';
  • Source module: secrets

Declaration

text
export interface SecretResolutionContext {
    purpose?: 'tool' | 'mcp_authorization' | 'mcp_headers' | 'other';
    minimumValidityMs?: number;
}

Contract members

MemberKindSignatureDescription
minimumValidityMspropertyminimumValidityMs?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
purposepropertypurpose?: "tool" | "other" | "mcp_authorization" | "mcp_headers"Public property; its type, readonly modifier and optionality are shown in the signature.

SecretResolver

Provider-neutral boundary for resolving opaque references at the last responsible moment. Implementations must never persist or log lease values.

  • Kind: interface
  • Import: import type { SecretResolver } from '@codesoul-co/hypha-tools';
  • Source module: secrets

Declaration

text
export interface SecretResolver {
    acquire(reference: string, context?: SecretResolutionContext): Promise<CredentialLease | null>;
    resolve(reference: string, context?: SecretResolutionContext): Promise<string | null>;
}

Contract members

MemberKindSignatureDescription
acquiremethodacquire(reference: string, context?: SecretResolutionContext): Promise<CredentialLease | null>Public method; parameters and return type are shown in the signature.
resolvemethodresolve(reference: string, context?: SecretResolutionContext): Promise<string | null>Public method; parameters and return type are shown in the signature.

ToolSecretResolver

Provider-neutral boundary for resolving opaque references at the last responsible moment. Implementations must never persist or log lease values.

  • Kind: interface
  • Import: import type { ToolSecretResolver } from '@codesoul-co/hypha-tools';
  • Source module: secrets

Declaration

text
export interface SecretResolver {
    acquire(reference: string, context?: SecretResolutionContext): Promise<CredentialLease | null>;
    resolve(reference: string, context?: SecretResolutionContext): Promise<string | null>;
}

Contract members

MemberKindSignatureDescription
acquiremethodacquire(reference: string, context?: SecretResolutionContext): Promise<CredentialLease | null>Public method; parameters and return type are shown in the signature.
resolvemethodresolve(reference: string, context?: SecretResolutionContext): Promise<string | null>Public method; parameters and return type are shown in the signature.