@prmichaelsen/firebase-admin-sdk-v8 2.2.0 → 2.2.1

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
@@ -514,8 +514,9 @@ For better query performance:
514
514
 
515
515
  | Feature | Supported | Notes |
516
516
  |---------|-----------|-------|
517
- | ID Token Verification | ✅ | Via firebase-auth-cloudflare-workers |
518
- | Custom Token Creation | | Not yet implemented |
517
+ | ID Token Verification | ✅ | Supports v9 and v10 token formats |
518
+ | Custom Token Creation | | createCustomToken() |
519
+ | Custom Token Exchange | ✅ | signInWithCustomToken() |
519
520
  | User Management | ❌ | Not yet implemented |
520
521
  | Firestore CRUD | ✅ | Full support |
521
522
  | Firestore Queries | ✅ | where, orderBy, limit, cursors |
@@ -524,7 +525,7 @@ For better query performance:
524
525
  | **Realtime Listeners** | **❌** | **See explanation below** |
525
526
  | Field Values | ✅ | increment, arrayUnion, serverTimestamp, etc. |
526
527
  | Realtime Database | ❌ | Not planned |
527
- | Cloud Storage | | Not yet implemented |
528
+ | Cloud Storage | | Upload, download, delete, signed URLs |
528
529
  | Cloud Messaging | ❌ | Not yet implemented |
529
530
 
530
531
  ## ⚠️ Realtime Listeners Not Supported
@@ -649,10 +650,12 @@ onSnapshot(doc(db, 'users', 'user123'), (snapshot) => {
649
650
 
650
651
  ## 🗺️ Roadmap
651
652
 
652
- - [ ] Custom token creation
653
+ - [x] Custom token creation ✅ (v2.2.0)
654
+ - [x] Custom token exchange ✅ (v2.2.0)
655
+ - [x] Cloud Storage operations ✅ (v2.2.0)
653
656
  - [ ] User management (create, update, delete users)
654
657
  - [ ] Firestore transactions
655
- - [ ] Cloud Storage operations
656
658
  - [ ] More comprehensive error handling
657
659
  - [ ] Rate limiting helpers
658
660
  - [ ] Retry logic for failed operations
661
+ - [ ] Storage unit tests (currently only e2e)
package/dist/index.js CHANGED
@@ -228,14 +228,12 @@ async function fetchPublicKeys(issuer) {
228
228
  if (publicKeysCache && Date.now() < publicKeysCacheExpiry) {
229
229
  return publicKeysCache;
230
230
  }
231
- console.log(`[fetchPublicKeys] Fetching from: ${endpoint}`);
232
231
  const response = await fetch(endpoint);
233
232
  if (!response.ok) {
234
233
  throw new Error(`Failed to fetch Firebase public keys from ${endpoint}`);
235
234
  }
236
235
  publicKeysCache = await response.json();
237
236
  publicKeysCacheExpiry = Date.now() + 36e5;
238
- console.log(`[fetchPublicKeys] Fetched ${Object.keys(publicKeysCache || {}).length} keys`);
239
237
  return publicKeysCache;
240
238
  }
241
239
  function base64UrlDecode(str) {
@@ -311,7 +309,6 @@ async function verifyIdToken(idToken) {
311
309
  let publicKeys = await fetchPublicKeys(payload.iss);
312
310
  let publicKeyPem = publicKeys[header.kid];
313
311
  if (!publicKeyPem) {
314
- console.log(`[verifyIdToken] Key ${header.kid} not found in cache, refreshing keys...`);
315
312
  publicKeysCache = null;
316
313
  publicKeysCacheExpiry = 0;
317
314
  publicKeys = await fetchPublicKeys(payload.iss);
@@ -578,7 +575,7 @@ function fromFirestoreValue(value) {
578
575
  if ("mapValue" in value) {
579
576
  return convertFromFirestoreFormat(value.mapValue.fields || {});
580
577
  }
581
- return null;
578
+ throw new Error(`Unknown Firestore value type: ${JSON.stringify(value)}`);
582
579
  }
583
580
  function convertFromFirestoreFormat(fields) {
584
581
  if (!fields) {
package/dist/index.mjs CHANGED
@@ -176,14 +176,12 @@ async function fetchPublicKeys(issuer) {
176
176
  if (publicKeysCache && Date.now() < publicKeysCacheExpiry) {
177
177
  return publicKeysCache;
178
178
  }
179
- console.log(`[fetchPublicKeys] Fetching from: ${endpoint}`);
180
179
  const response = await fetch(endpoint);
181
180
  if (!response.ok) {
182
181
  throw new Error(`Failed to fetch Firebase public keys from ${endpoint}`);
183
182
  }
184
183
  publicKeysCache = await response.json();
185
184
  publicKeysCacheExpiry = Date.now() + 36e5;
186
- console.log(`[fetchPublicKeys] Fetched ${Object.keys(publicKeysCache || {}).length} keys`);
187
185
  return publicKeysCache;
188
186
  }
189
187
  function base64UrlDecode(str) {
@@ -259,7 +257,6 @@ async function verifyIdToken(idToken) {
259
257
  let publicKeys = await fetchPublicKeys(payload.iss);
260
258
  let publicKeyPem = publicKeys[header.kid];
261
259
  if (!publicKeyPem) {
262
- console.log(`[verifyIdToken] Key ${header.kid} not found in cache, refreshing keys...`);
263
260
  publicKeysCache = null;
264
261
  publicKeysCacheExpiry = 0;
265
262
  publicKeys = await fetchPublicKeys(payload.iss);
@@ -526,7 +523,7 @@ function fromFirestoreValue(value) {
526
523
  if ("mapValue" in value) {
527
524
  return convertFromFirestoreFormat(value.mapValue.fields || {});
528
525
  }
529
- return null;
526
+ throw new Error(`Unknown Firestore value type: ${JSON.stringify(value)}`);
530
527
  }
531
528
  function convertFromFirestoreFormat(fields) {
532
529
  if (!fields) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prmichaelsen/firebase-admin-sdk-v8",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Firebase Admin SDK for Cloudflare Workers and edge runtimes using REST APIs",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",