Skip to content

@codesoul-co/hypha-memory / managed-credentials

Using this module

Use the Managed credentials module for using the public contracts and operations for this capability boundary. It exports 1 class, 1 function, 3 interfaces.

Import from the package entrypoint

ts
import {
  RenewableCredentialManager,
  staticCredentialProvider,
} from '@codesoul-co/hypha-memory';

import type {
  ManagedCredentialLease,
  RenewableCredentialManagerOptions,
  RenewableCredentialProvider,
} from '@codesoul-co/hypha-memory';

Usage patterns

  • Use the 3 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.
  • The module exposes 1 class as constructable runtime implementations. Each symbol entry lists its constructor and public methods.
  • The module exposes 1 function as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.

Public exports

SymbolKindSignatureDescription
RenewableCredentialManagerclassnew RenewableCredentialManager(options: RenewableCredentialManagerOptions): RenewableCredentialManagerRenewable Credential Manager class with 4 public constructor or member entries; its exact declarations are listed below.
staticCredentialProviderfunctionstaticCredentialProvider(token: string, tokenType: ManagedCredentialLease["tokenType"]): RenewableCredentialProviderStatic Credential Provider function with 1 public call signature; parameters and return types are listed below.
ManagedCredentialLeaseinterfaceinterface ManagedCredentialLeaseManaged Credential Lease interface with 3 public fields or methods.
RenewableCredentialManagerOptionsinterfaceinterface RenewableCredentialManagerOptionsRenewable Credential Manager Options interface with 3 public fields or methods.
RenewableCredentialProviderinterfaceinterface RenewableCredentialProviderRenewable Credential Provider interface with 3 public fields or methods.

RenewableCredentialManager

Renewable Credential Manager class with 4 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { RenewableCredentialManager } from '@codesoul-co/hypha-memory';
  • Source module: managed-credentials

Declaration

text
export declare class RenewableCredentialManager {
    constructor(options: RenewableCredentialManagerOptions);
    get(signal?: AbortSignal): Promise<ManagedCredentialLease>;
    invalidate(): void;
    close(signal?: AbortSignal): Promise<void>;
}

Public members

MemberKindSignatureDescription
closemethodclose(signal?: AbortSignal): Promise<void>Public method; parameters and return type are shown in the signature.
constructorconstructor(options: RenewableCredentialManagerOptions): RenewableCredentialManagerCreates an instance of this class.
getmethodget(signal?: AbortSignal): Promise<ManagedCredentialLease>Public method; parameters and return type are shown in the signature.
invalidatemethodinvalidate(): voidPublic method; parameters and return type are shown in the signature.

staticCredentialProvider

Static Credential Provider function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { staticCredentialProvider } from '@codesoul-co/hypha-memory';
  • Source module: managed-credentials

Declaration

text
export declare function staticCredentialProvider(token: string, tokenType: ManagedCredentialLease['tokenType']): RenewableCredentialProvider;

Call signature

text
staticCredentialProvider(token: string, tokenType: ManagedCredentialLease["tokenType"]): RenewableCredentialProvider

Parameters

ParameterTypeRequiredDescription
tokenstringYesRequired parameter; accepted values are defined by the type column.
tokenType"api_token" | "oauth_bearer"YesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: RenewableCredentialProvider
  • Description: The return contract is defined by the type shown above.

ManagedCredentialLease

Managed Credential Lease interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { ManagedCredentialLease } from '@codesoul-co/hypha-memory';
  • Source module: managed-credentials

Declaration

text
export interface ManagedCredentialLease {
    token: string;
    tokenType: 'api_token' | 'oauth_bearer';
    expiresAt?: string;
}

Contract members

MemberKindSignatureDescription
expiresAtpropertyexpiresAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
tokenpropertytoken: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
tokenTypepropertytokenType: "api_token" | "oauth_bearer"Public property; its type, readonly modifier and optionality are shown in the signature.

RenewableCredentialManagerOptions

Renewable Credential Manager Options interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { RenewableCredentialManagerOptions } from '@codesoul-co/hypha-memory';
  • Source module: managed-credentials

Declaration

text
export interface RenewableCredentialManagerOptions {
    provider: RenewableCredentialProvider;
    refreshSkewMs?: number;
    now?: () => Date;
}

Contract members

MemberKindSignatureDescription
nowmethodnow?(): DatePublic method; parameters and return type are shown in the signature.
providerpropertyprovider: RenewableCredentialProviderPublic property; its type, readonly modifier and optionality are shown in the signature.
refreshSkewMspropertyrefreshSkewMs?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

RenewableCredentialProvider

Renewable Credential Provider interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { RenewableCredentialProvider } from '@codesoul-co/hypha-memory';
  • Source module: managed-credentials

Declaration

text
export interface RenewableCredentialProvider {
    acquire(signal?: AbortSignal): Promise<ManagedCredentialLease>;
    revoke?(lease: ManagedCredentialLease, signal?: AbortSignal): Promise<void>;
    close?(): Promise<void>;
}

Contract members

MemberKindSignatureDescription
acquiremethodacquire(signal?: AbortSignal): Promise<ManagedCredentialLease>Public method; parameters and return type are shown in the signature.
closemethodclose?(): Promise<void>Public method; parameters and return type are shown in the signature.
revokemethodrevoke?(lease: ManagedCredentialLease, signal?: AbortSignal): Promise<void>Public method; parameters and return type are shown in the signature.