Skip to main content

blursec.auth

Operations on the API key the SDK was constructed with. Useful for diagnostics and key rotation — not part of the credential-check hot path.

whoami() → Promise<AuthPrincipal>

Returns information about the authenticated principal: which workspace the key belongs to, its scopes, and when it was created. Use this on app boot to verify the SDK is correctly configured.
Endpoint: GET /v1/auth/whoami Returns:

rotate() → Promise<RotatedApiKey>

Generates a new API key tied to the same principal and revokes the current key. The response contains the new key — store it before doing anything else, otherwise you’ll lock yourself out.
Endpoint: POST /v1/auth/rotate Returns:
Security note: Treat rotation as a destructive operation. There is no undo. Always confirm the secret was persisted to your secret store before taking down the previous client.