jin-frame / interfaces/security/SecurityKey / SecurityKey
Type Alias: SecurityKey
SecurityKey =
string| () =>string|Promise<string>
Defined in: packages/jin-frame/src/interfaces/security/SecurityKey.ts:17
A security key that can be a static string or a function that returns a string asynchronously. Supports lazy resolution from environment variables, secret managers (e.g. HashiCorp Vault), etc.
Example
ts
// Static string
const key: SecurityKey = 'my-bearer-token';
// From dotenv at request time
const key: SecurityKey = () => process.env.API_TOKEN ?? '';
// Async from secret manager
const key: SecurityKey = async () => vault.getSecret('api-token');