Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/keychain-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Run: pnpm tsx examples/keychain-setup.ts
*/

import { randomBytes } from 'node:crypto'
import { KeychainStore, resolveApiKey } from '../src/index.js'

async function main(): Promise<void> {
Expand All @@ -22,7 +23,7 @@ async function main(): Promise<void> {

// Store a test key
const provider = 'demo-provider'
const fakeKey = 'sk-example-' + Math.random().toString(36).slice(2, 10)
const fakeKey = 'sk-example-' + randomBytes(6).toString('base64url').slice(0, 8)
console.log(`Storing key for "${provider}"...`)
const ok = await chain.set(provider, fakeKey)
console.log(` ${ok ? '✓ stored' : '✗ failed'}`)
Expand Down
Loading