import { Token } from '../../token.js'; import { custom, customJson, Logger } from '../../util/logging.js'; /** Configures the process-safe YAML access-token cache. */ export interface TokenCacheOptions { /** Path to the YAML cache file. A leading `~` resolves to the home directory. */ cacheFile?: string; /** POSIX mode for a newly created cache file. Defaults to `0o600`. */ fileCreateMode?: number; /** * Optional destination for diagnostic events. * * Token diagnostic values are partly masked, but a short `v0` payload can * remain visible. */ logger?: Logger; } /** * Stores named access tokens in a process-safe YAML file. * * Operations use POSIX file locks, so cooperating SDK processes can share the * file without overwriting each other. Expired tokens are not returned and are * removed on the next write. The file contains unmasked credentials and must * be protected. * * @example * ```ts * import { TokenCache } from '@nebius/js-sdk/runtime/token/file_cache/token_cache'; * * const cache = new TokenCache({ * cacheFile: '~/.config/my-app/credentials.yaml', * }); * const token = await cache.get('developer-profile'); * ``` */ export declare class TokenCache { [custom]: () => string; /** Contains the fully qualified runtime type name. */ readonly $type = "nebius.sdk.TokenCache"; private cacheFile; private fileCreateMode; private logger?; /** Creates a cache. A new file uses owner-only mode (`0o600`) by default. */ constructor(options?: TokenCacheOptions); /** Returns a JSON-safe value for logs. */ [customJson](): unknown; private flock; private parseYaml; private dumpYaml; /** Returns a named, unexpired token, or `undefined` when it is absent or expired. */ get(name: string): Promise; /** Stores or replaces a named token while preserving other entries. */ set(name: string, token: Token): Promise; /** Removes a named token. Missing files and entries are accepted. */ remove(name: string): Promise; /** * Removes a named token only when both its value and expiration match. * * This compare-and-remove operation avoids deleting a newer token written by * another process. */ removeIfEqual(name: string, token: Token): Promise; } //# sourceMappingURL=token_cache.d.ts.map