UNPKG

@squidcloud/client

Version:

A typescript implementation of the Squid client

83 lines (82 loc) 2.47 kB
/** * A type alias for an ApiKey. * @category Secret */ export type ApiKey = string; /** * The secret key, an alias for a string. * @category Secret */ export type SecretKey = string; /** * The secret value. * @category Secret */ export type SecretValue = string | number | boolean; /** * Metadata for a secret, including its key and last updated timestamp. * @category Secret */ export interface SecretMetadata { /** The key identifying the secret. */ key: SecretKey; /** The timestamp (in milliseconds) when the secret was last updated. */ lastUpdated: number; } /** * A secret entry combining metadata with a typed value. * @category Secret */ export interface SecretEntry<T extends SecretValue = SecretValue> extends SecretMetadata { /** The value of the secret, constrained to the specified type. */ value: T; } /** * An API key entry combining metadata with a string value. * @category Secret */ export interface ApiKeyEntry extends SecretMetadata { /** The string value of the API key. */ value: string; } /** * A request structure for setting a secret with a key-value pair. * @category Secret */ export interface SetSecretRequestEntry { /** The key identifying the secret to set. */ key: SecretKey; /** The value to assign to the secret. */ value: SecretValue; } /** * Public representation of a management API key. Never includes the plaintext value or hash. * @category Secret */ export interface ManagementApiKey { /** Stable key identifier. */ id: string; /** User that owns the key. */ userId: string; /** Optional human-readable description. */ description: string | null; /** Lower-case 'active' | 'suspended' | 'deleted'. */ status: string; /** ISO-8601 timestamp of creation. */ createdAt: string; /** ISO-8601 timestamp of the last status / metadata change. */ updatedAt: string; /** ISO-8601 timestamp of the last successful validation, or null if never used. */ lastUsedAt: string | null; } /** * Response returned when a management API key is created. The plaintext keyValue is only * returned at creation time — it is not retrievable afterwards. * @category Secret */ export interface CreateManagementApiKeyResponse { /** Public metadata of the new key. */ key: ManagementApiKey; /** Plaintext key value — only returned here, never persisted in clear, never returned again. */ keyValue: string; }