@carddb/browser 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -16,7 +16,7 @@ bun add @carddb/browser
16
16
  import { CardDBClient, BrowserCache, gte, ilike } from '@carddb/browser'
17
17
 
18
18
  const client = new CardDBClient({
19
- apiKey: 'carddb_xxx...', // Optional, increases rate limits
19
+ publishableKey: 'carddb_pk_xxx...', // Browser-safe public key
20
20
  cache: new BrowserCache(), // Optional localStorage-based caching
21
21
  defaultPublisher: 'pokemon',
22
22
  defaultGame: 'tcg',
@@ -34,6 +34,20 @@ for await (const card of cards) {
34
34
  }
35
35
  ```
36
36
 
37
+ Use `accessToken` instead of `publishableKey` for user-authorized OAuth deck workflows. `secretKey` is server-only and the browser client rejects it at construction time. The browser client also rejects legacy `apiKey` because it is ambiguous and can accidentally expose a secret key; use `publishableKey` explicitly for public browser reads.
38
+
39
+ ```typescript
40
+ const client = new CardDBClient({
41
+ accessToken: oauthAccessToken,
42
+ })
43
+
44
+ const decks = await client.decks.listMine()
45
+ const updated = await client.decks.updateMetadata(deck.id, {
46
+ expectedDraftRevision: deck.draftRevision,
47
+ title: 'Updated title',
48
+ })
49
+ ```
50
+
37
51
  ## BrowserCache
38
52
 
39
53
  Browser-based cache using localStorage or sessionStorage: