JavaScript SDK
Modern TypeScript/JavaScript client using native fetch. Typed with full type inference, zero runtime deps on browsers, minimal deps on Node.
Install#
bash
1 | |
Requires Node 18+ (for native fetch) or a modern browser.
Don't use the JavaScript SDK in browser code. Bundling ScaiVault tokens into a frontend exposes them to anyone who opens DevTools. Browsers should call your own backend, which in turn calls ScaiVault.
Authenticate#
typescript
1 2 3 4 5 6 | |
Client-credentials (auto-refreshing):
typescript
1 2 3 4 5 | |
Secrets#
typescript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
Policies#
typescript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
Rotation#
typescript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
PKI#
typescript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |
Dynamic secrets#
typescript
1 2 3 4 5 6 7 8 9 10 | |
Error handling#
typescript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
Retries and timeouts#
typescript
1 2 3 4 5 6 7 | |
Transient failures (rate-limits, connection errors, 5xx) retry with exponential backoff. Auth and validation failures raise immediately.
Environment variables#
| Variable | Default for |
|---|---|
SCAIVAULT_BASE_URL |
baseUrl |
SCAIVAULT_TOKEN |
token |
SCAIKEY_CLIENT_ID |
clientId |
SCAIKEY_CLIENT_SECRET |
clientSecret |
new ScaiVaultClient() with no options picks up env.
What's next#
- Python SDK
- .NET SDK
- Managing Secrets — underlying HTTP API.