@prmichaelsen/firebase-admin-sdk-v8 2.3.1 → 2.4.2

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/AGENT.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # Agent Context Protocol (ACP)
2
2
 
3
- **Also Known As**: The Agent Directory Pattern
4
- **Version**: 1.0.3
5
- **Created**: 2026-02-11
6
- **Status**: Production Pattern
3
+ **Also Known As**: The Agent Directory Pattern
4
+ **Version**: 1.4.3
5
+ **Created**: 2026-02-11
6
+ **Status**: Production Pattern
7
7
 
8
8
  ---
9
9
 
@@ -81,6 +81,14 @@ ACP solves these by:
81
81
  project-root/
82
82
  ├── AGENT.md # This file - ACP documentation
83
83
  ├── agent/ # Agent directory (ACP structure)
84
+ │ ├── commands/ # Command system
85
+ │ │ ├── .gitkeep
86
+ │ │ ├── command.template.md # Command template
87
+ │ │ ├── acp.init.md # @acp-init
88
+ │ │ ├── acp.proceed.md # @acp-proceed
89
+ │ │ ├── acp.status.md # @acp-status
90
+ │ │ └── ... # More commands
91
+ │ │
84
92
  │ ├── design/ # Design documents
85
93
  │ │ ├── .gitkeep
86
94
  │ │ ├── requirements.md # Core requirements
@@ -551,6 +559,91 @@ The Agent Pattern represents a **paradigm shift** in how we approach AI-assisted
551
559
 
552
560
  ---
553
561
 
562
+ ## ACP Commands
563
+
564
+ ACP supports a command system for common workflows. Commands are file-based triggers that provide standardized, discoverable interfaces for ACP operations.
565
+
566
+ ### What are ACP Commands?
567
+
568
+ Commands are markdown files in [`agent/commands/`](agent/commands/) that contain step-by-step instructions for AI agents. Instead of typing long prompts like "AGENT.md: Initialize", you can reference command files like `@acp.init` to trigger specific workflows.
569
+
570
+ **Benefits**:
571
+ - **Discoverable**: Browse [`agent/commands/`](agent/commands/) to see all available commands
572
+ - **Consistent**: All commands follow the same structure
573
+ - **Extensible**: Create custom commands for your project
574
+ - **Self-Documenting**: Each command file contains complete documentation
575
+ - **Autocomplete-Friendly**: Type `@acp.` to see all ACP commands
576
+
577
+ ### Core Commands
578
+
579
+ Core ACP commands use the `acp.` prefix and are available in [`agent/commands/`](agent/commands/):
580
+
581
+ - **[`@acp.init`](agent/commands/acp.init.md)** - Initialize agent context (replaces "AGENT.md: Initialize")
582
+ - **[`@acp.proceed`](agent/commands/acp.proceed.md)** - Continue with next task (replaces "AGENT.md: Proceed")
583
+ - **[`@acp.status`](agent/commands/acp.status.md)** - Display project status
584
+ - **[`@acp.version-check`](agent/commands/acp.version-check.md)** - Show current ACP version
585
+ - **[`@acp.version-check-for-updates`](agent/commands/acp.version-check-for-updates.md)** - Check for ACP updates
586
+ - **[`@acp.version-update`](agent/commands/acp.version-update.md)** - Update ACP to latest version
587
+
588
+ ### Command Invocation
589
+
590
+ Commands are invoked using the `@` syntax with dot notation:
591
+
592
+ ```
593
+ @acp.init → agent/commands/acp.init.md
594
+ @acp.proceed → agent/commands/acp.proceed.md
595
+ @acp.status → agent/commands/acp.status.md
596
+ @deploy.production → agent/commands/deploy.production.md
597
+ ```
598
+
599
+ **Format**: `@{namespace}.{action}` resolves to `agent/commands/{namespace}.{action}.md`
600
+
601
+ ### Creating Custom Commands
602
+
603
+ To create custom commands for your project:
604
+
605
+ 1. **Choose a namespace** (e.g., `deploy`, `test`, `custom`)
606
+ - ⚠️ The `acp` namespace is reserved for core commands
607
+ - Use descriptive, single-word namespaces
608
+
609
+ 2. **Copy the command template**:
610
+ ```bash
611
+ cp agent/commands/command.template.md agent/commands/{namespace}.{action}.md
612
+ ```
613
+
614
+ 3. **Fill in the template sections**:
615
+ - Purpose and description
616
+ - Prerequisites
617
+ - Step-by-step instructions
618
+ - Verification checklist
619
+ - Examples and troubleshooting
620
+
621
+ 4. **Invoke your command**: `@{namespace}.{action}`
622
+
623
+ **Example**: Creating a deployment command:
624
+ ```bash
625
+ # Create the command file
626
+ cp agent/commands/command.template.md agent/commands/deploy.production.md
627
+
628
+ # Edit the file with your deployment steps
629
+ # ...
630
+
631
+ # Invoke it
632
+ @deploy.production
633
+ ```
634
+
635
+ ### Command Template
636
+
637
+ See [`agent/commands/command.template.md`](agent/commands/command.template.md) for the complete command template with all sections and examples.
638
+
639
+ ### Installing Third-Party Commands
640
+
641
+ Use `@acp.install` to install command packages from git repositories (available in future release).
642
+
643
+ **Security Note**: Third-party commands can instruct agents to modify files and execute scripts. Always review command files before installation.
644
+
645
+ ---
646
+
554
647
  ## Sample Prompts for Using ACP
555
648
 
556
649
  ### Initialize Prompt
@@ -782,7 +875,17 @@ Run ./agent/scripts/uninstall.sh to remove all ACP files (agent/ directory and A
782
875
  - Update percentages
783
876
  - Add recent work notes
784
877
 
785
- 7. **NEVER handle secrets or sensitive data**
878
+ 7. **CRITICAL: Always update CHANGELOG.md for version changes**
879
+ - ❌ **DO NOT** commit version changes without updating CHANGELOG.md
880
+ - ❌ **DO NOT** forget to update version numbers in all project files
881
+ - ✅ **DO** use [`@git.commit`](agent/commands/git.commit.md) for version-aware commits
882
+ - ✅ **DO** detect version impact: major (breaking), minor (features), patch (fixes)
883
+ - ✅ **DO** update CHANGELOG.md with clear, user-focused descriptions
884
+ - ✅ **DO** update all version files (package.json, AGENT.md, etc.)
885
+ - ✅ **DO** use Conventional Commits format for commit messages
886
+ - **Rationale**: CHANGELOG.md is the primary communication tool for users. Every version change must be documented with clear descriptions of what changed, why it changed, and how it affects users. Forgetting to update CHANGELOG.md breaks the project's version history and makes it impossible for users to understand what changed between versions.
887
+
888
+ 8. **NEVER handle secrets or sensitive data**
786
889
  - ❌ **DO NOT** read `.env` files, `.env.local`, or any environment files
787
890
  - ❌ **DO NOT** read files containing API keys, tokens, passwords, or credentials
788
891
  - ❌ **DO NOT** include secrets in messages, documentation, or code examples
@@ -793,6 +896,14 @@ Run ./agent/scripts/uninstall.sh to remove all ACP files (agent/ directory and A
793
896
  - ✅ **DO** create `.env.example` files with placeholder values only
794
897
  - **Rationale**: Secrets must never be exposed in chat logs, documentation, or version control. Agents should treat all credential files as off-limits to prevent accidental exposure.
795
898
 
899
+ 9. **CRITICAL: Respect user's intentional file edits**
900
+ - ❌ **DO NOT** assume missing content needs to be added back
901
+ - ❌ **DO NOT** revert changes without confirming with user
902
+ - ✅ **DO** read files before editing to see current state
903
+ - ✅ **DO** ask user if unexpected changes were intentional
904
+ - ✅ **DO** confirm before reverting user's manual edits
905
+ - **Rationale**: If you read a file and it is missing contents or has changed contents (i.e., it does not contain what you expect), assume or confirm with the user if they made intentional updates that you should not revert. Do not assume "The file is missing <xyz>, I need to add it back". The user may have edited files manually with intention.
906
+
796
907
  ---
797
908
 
798
909
  ## Best Practices
@@ -882,7 +993,7 @@ This repository is actively maintained with improvements to the ACP methodology
882
993
  ./agent/scripts/update.sh
883
994
 
884
995
  # Or download and run directly
885
- curl -fsSL https://raw.githubusercontent.com/prmichaelsen/agent-context-protocol/mainlin./agent/scripts/update.sh | bash
996
+ curl -fsSL https://raw.githubusercontent.com/prmichaelsen/agent-context-protocol/mainline/agent/scripts/update.sh | bash
886
997
  ```
887
998
 
888
999
  The update script will:
package/CHANGELOG.md CHANGED
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.4.0] - 2026-02-15
11
+
12
+ ### Added
13
+ - **Session Cookie Support**: Added `createSessionCookie()` and `verifySessionCookie()`
14
+ - Long-lived authentication sessions (up to 14 days) instead of 1-hour ID tokens
15
+ - Session cookie verification with proper issuer validation
16
+ - 15 new unit tests for session cookie functionality
17
+ - 3 new E2E tests for session cookie creation and verification
18
+ - Comprehensive session cookie documentation in README
19
+
20
+ ### Changed
21
+ - Auth module coverage improved from 63.18% to 97.51%
22
+ - Total tests increased from 418 to 433 (+15 tests)
23
+
10
24
  ## [2.3.1] - 2026-02-14
11
25
 
12
26
  ### Fixed
package/README.md CHANGED
@@ -15,6 +15,7 @@ This library provides Firebase Admin SDK functionality for Cloudflare Workers an
15
15
  - ✅ **Zero Dependencies** - No external dependencies, pure Web APIs (crypto.subtle, fetch)
16
16
  - ✅ **JWT Token Generation** - Service account authentication
17
17
  - ✅ **ID Token Verification** - Verify Firebase ID tokens (supports v9 and v10 formats)
18
+ - ✅ **Session Cookies** - Create and verify long-lived session cookies (up to 14 days)
18
19
  - ✅ **Firebase v10 Compatible** - Supports both old and new token issuer formats
19
20
  - ✅ **Firestore REST API** - Full CRUD operations via REST
20
21
  - ✅ **Field Value Operations** - increment, arrayUnion, arrayRemove, serverTimestamp, delete
@@ -94,7 +95,26 @@ try {
94
95
  }
95
96
  ```
96
97
 
97
- ### 3. Basic Firestore Operations
98
+ ### 3. Session Cookies (Long-Lived Sessions)
99
+
100
+ ```typescript
101
+ import { createSessionCookie, verifySessionCookie } from '@prmichaelsen/firebase-admin-sdk-v8';
102
+
103
+ // Create 14-day session cookie from ID token
104
+ const sessionCookie = await createSessionCookie(idToken, {
105
+ expiresIn: 60 * 60 * 24 * 14 * 1000
106
+ });
107
+
108
+ // Set as HTTP-only cookie
109
+ response.headers.set('Set-Cookie',
110
+ `session=${sessionCookie}; Max-Age=1209600; HttpOnly; Secure; SameSite=Strict`
111
+ );
112
+
113
+ // Verify session cookie
114
+ const user = await verifySessionCookie(cookie);
115
+ ```
116
+
117
+ ### 4. Basic Firestore Operations
98
118
 
99
119
  ```typescript
100
120
  import { setDocument, getDocument, updateDocument, FieldValue } from '@prmichaelsen/firebase-admin-sdk-v8';
@@ -0,0 +1,161 @@
1
+ // src/config.ts
2
+ var globalConfig = {};
3
+ function initializeApp(config) {
4
+ globalConfig = { ...config };
5
+ }
6
+ function getConfig() {
7
+ return globalConfig;
8
+ }
9
+ function clearConfig() {
10
+ globalConfig = {};
11
+ }
12
+ function getServiceAccount() {
13
+ if (globalConfig.serviceAccount) {
14
+ if (typeof globalConfig.serviceAccount === "string") {
15
+ return JSON.parse(globalConfig.serviceAccount);
16
+ }
17
+ return globalConfig.serviceAccount;
18
+ }
19
+ const key = typeof process !== "undefined" && process.env?.FIREBASE_ADMIN_SERVICE_ACCOUNT_KEY;
20
+ if (!key) {
21
+ throw new Error(
22
+ "Firebase service account not configured. Either call initializeApp({ serviceAccount: ... }) or set FIREBASE_ADMIN_SERVICE_ACCOUNT_KEY environment variable."
23
+ );
24
+ }
25
+ try {
26
+ const serviceAccount = JSON.parse(key);
27
+ const requiredFields = [
28
+ "type",
29
+ "project_id",
30
+ "private_key_id",
31
+ "private_key",
32
+ "client_email",
33
+ "client_id",
34
+ "token_uri"
35
+ ];
36
+ for (const field of requiredFields) {
37
+ if (!(field in serviceAccount)) {
38
+ throw new Error(`Service account is missing required field: ${field}`);
39
+ }
40
+ }
41
+ return serviceAccount;
42
+ } catch (error) {
43
+ if (error instanceof SyntaxError) {
44
+ throw new Error(
45
+ "Failed to parse FIREBASE_ADMIN_SERVICE_ACCOUNT_KEY. Ensure it contains valid JSON."
46
+ );
47
+ }
48
+ throw error;
49
+ }
50
+ }
51
+ function getProjectId() {
52
+ if (globalConfig.projectId) {
53
+ return globalConfig.projectId;
54
+ }
55
+ if (typeof process !== "undefined" && process.env) {
56
+ const projectId = process.env.FIREBASE_PROJECT_ID || process.env.PUBLIC_FIREBASE_PROJECT_ID;
57
+ if (projectId) {
58
+ return projectId;
59
+ }
60
+ }
61
+ throw new Error(
62
+ "Firebase project ID not configured. Either call initializeApp({ projectId: ... }) or set FIREBASE_PROJECT_ID environment variable."
63
+ );
64
+ }
65
+ function getFirebaseApiKey() {
66
+ if (globalConfig.apiKey) {
67
+ return globalConfig.apiKey;
68
+ }
69
+ if (typeof process !== "undefined" && process.env) {
70
+ const apiKey = process.env.FIREBASE_API_KEY || process.env.PUBLIC_FIREBASE_API_KEY;
71
+ if (apiKey) {
72
+ return apiKey;
73
+ }
74
+ }
75
+ throw new Error(
76
+ "Firebase API key not configured. Either call initializeApp({ apiKey: ... }) or set FIREBASE_API_KEY environment variable. Find your API key in Firebase Console > Project Settings > Web API Key."
77
+ );
78
+ }
79
+
80
+ // src/token-generation.ts
81
+ function base64UrlEncode(str) {
82
+ return btoa(str).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
83
+ }
84
+ function base64UrlEncodeBuffer(buffer) {
85
+ return btoa(String.fromCharCode(...buffer)).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
86
+ }
87
+ async function createJWT(serviceAccount) {
88
+ const now = Math.floor(Date.now() / 1e3);
89
+ const expiry = now + 3600;
90
+ const header = {
91
+ alg: "RS256",
92
+ typ: "JWT"
93
+ };
94
+ const payload = {
95
+ iss: serviceAccount.client_email,
96
+ sub: serviceAccount.client_email,
97
+ aud: serviceAccount.token_uri,
98
+ iat: now,
99
+ exp: expiry,
100
+ scope: "https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/datastore https://www.googleapis.com/auth/firebase"
101
+ };
102
+ const encodedHeader = base64UrlEncode(JSON.stringify(header));
103
+ const encodedPayload = base64UrlEncode(JSON.stringify(payload));
104
+ const unsignedToken = `${encodedHeader}.${encodedPayload}`;
105
+ const pemContents = serviceAccount.private_key.replace("-----BEGIN PRIVATE KEY-----", "").replace("-----END PRIVATE KEY-----", "").replace(/\s/g, "");
106
+ const binaryDer = Uint8Array.from(atob(pemContents), (c) => c.charCodeAt(0));
107
+ const cryptoKey = await crypto.subtle.importKey(
108
+ "pkcs8",
109
+ binaryDer,
110
+ { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" },
111
+ false,
112
+ ["sign"]
113
+ );
114
+ const signature = await crypto.subtle.sign(
115
+ "RSASSA-PKCS1-v1_5",
116
+ cryptoKey,
117
+ new TextEncoder().encode(unsignedToken)
118
+ );
119
+ const encodedSignature = base64UrlEncodeBuffer(new Uint8Array(signature));
120
+ return `${unsignedToken}.${encodedSignature}`;
121
+ }
122
+ var cachedAccessToken = null;
123
+ var tokenExpiry = 0;
124
+ async function getAdminAccessToken() {
125
+ if (cachedAccessToken && Date.now() < tokenExpiry) {
126
+ return cachedAccessToken;
127
+ }
128
+ const serviceAccount = getServiceAccount();
129
+ const jwt = await createJWT(serviceAccount);
130
+ const response = await fetch(serviceAccount.token_uri, {
131
+ method: "POST",
132
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
133
+ body: new URLSearchParams({
134
+ grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
135
+ assertion: jwt
136
+ })
137
+ });
138
+ if (!response.ok) {
139
+ const errorText = await response.text();
140
+ throw new Error(`Failed to get access token: ${errorText}`);
141
+ }
142
+ const data = await response.json();
143
+ cachedAccessToken = data.access_token;
144
+ tokenExpiry = Date.now() + data.expires_in * 1e3 - 6e4;
145
+ return cachedAccessToken;
146
+ }
147
+ function clearTokenCache() {
148
+ cachedAccessToken = null;
149
+ tokenExpiry = 0;
150
+ }
151
+
152
+ export {
153
+ initializeApp,
154
+ getConfig,
155
+ clearConfig,
156
+ getServiceAccount,
157
+ getProjectId,
158
+ getFirebaseApiKey,
159
+ getAdminAccessToken,
160
+ clearTokenCache
161
+ };
package/dist/index.d.mts CHANGED
@@ -335,6 +335,60 @@ declare function createCustomToken(uid: string, customClaims?: CustomClaims): Pr
335
335
  * ```
336
336
  */
337
337
  declare function signInWithCustomToken(customToken: string): Promise<CustomTokenSignInResponse>;
338
+ /**
339
+ * Options for creating a session cookie
340
+ */
341
+ interface SessionCookieOptions {
342
+ /**
343
+ * Session duration in milliseconds
344
+ * Maximum: 14 days (1,209,600,000 ms)
345
+ * Minimum: 5 minutes (300,000 ms)
346
+ */
347
+ expiresIn: number;
348
+ }
349
+ /**
350
+ * Create a session cookie from an ID token
351
+ *
352
+ * Session cookies can have a maximum duration of 14 days and are
353
+ * useful for maintaining long-lived authentication sessions.
354
+ *
355
+ * @param idToken - Valid Firebase ID token
356
+ * @param options - Session cookie options
357
+ * @returns Session cookie string
358
+ *
359
+ * @example
360
+ * ```typescript
361
+ * // Create 14-day session cookie
362
+ * const sessionCookie = await createSessionCookie(idToken, {
363
+ * expiresIn: 60 * 60 * 24 * 14 * 1000
364
+ * });
365
+ *
366
+ * // Set as HTTP-only cookie
367
+ * response.headers.set('Set-Cookie',
368
+ * `session=${sessionCookie}; Max-Age=1209600; HttpOnly; Secure; SameSite=Strict`
369
+ * );
370
+ * ```
371
+ */
372
+ declare function createSessionCookie(idToken: string, options: SessionCookieOptions): Promise<string>;
373
+ /**
374
+ * Verify a Firebase session cookie
375
+ *
376
+ * Session cookies are verified similarly to ID tokens but have
377
+ * different expiration times (up to 14 days) and issuer format.
378
+ *
379
+ * @param sessionCookie - Session cookie string to verify
380
+ * @param checkRevoked - Whether to check if the token has been revoked (not yet implemented)
381
+ * @returns Decoded token claims
382
+ *
383
+ * @example
384
+ * ```typescript
385
+ * // Verify session cookie from request
386
+ * const sessionCookie = request.cookies.get('session');
387
+ * const decodedToken = await verifySessionCookie(sessionCookie);
388
+ * console.log('User ID:', decodedToken.uid);
389
+ * ```
390
+ */
391
+ declare function verifySessionCookie(sessionCookie: string, checkRevoked?: boolean): Promise<DecodedIdToken>;
338
392
  /**
339
393
  * Get Auth instance (for compatibility, but not used in new implementation)
340
394
  * @deprecated Use verifyIdToken directly
@@ -925,4 +979,4 @@ declare function getAdminAccessToken(): Promise<string>;
925
979
  */
926
980
  declare function clearTokenCache(): void;
927
981
 
928
- export { type BatchWrite, type BatchWriteResult, type CustomClaims, type CustomTokenSignInResponse, type DataObject, type DecodedIdToken, type DocumentReference, type DownloadOptions, FieldValue, type FieldValue$1 as FieldValueSentinel, FieldValueType, type FileMetadata, type FirestoreDocument, type FirestoreValue, type ListFilesResult, type ListOptions, type QueryFilter, type QueryOptions, type QueryOrder, type ResumableUploadOptions, type ServiceAccount, type SetOptions, type SignedUrlOptions, type TokenResponse, type UpdateOptions, type UploadOptions, type UserInfo, type WhereFilterOp, addDocument, batchWrite, clearConfig, clearTokenCache, countDocuments, createCustomToken, deleteDocument, deleteFile, downloadFile, fileExists, generateSignedUrl, getAdminAccessToken, getAuth, getConfig, getDocument, getFileMetadata, getProjectId, getServiceAccount, getUserFromToken, initializeApp, iterateCollection, listDocuments, listFiles, queryDocuments, setDocument, signInWithCustomToken, updateDocument, uploadFile, uploadFileResumable, verifyIdToken };
982
+ export { type BatchWrite, type BatchWriteResult, type CustomClaims, type CustomTokenSignInResponse, type DataObject, type DecodedIdToken, type DocumentReference, type DownloadOptions, FieldValue, type FieldValue$1 as FieldValueSentinel, FieldValueType, type FileMetadata, type FirestoreDocument, type FirestoreValue, type ListFilesResult, type ListOptions, type QueryFilter, type QueryOptions, type QueryOrder, type ResumableUploadOptions, type ServiceAccount, type SessionCookieOptions, type SetOptions, type SignedUrlOptions, type TokenResponse, type UpdateOptions, type UploadOptions, type UserInfo, type WhereFilterOp, addDocument, batchWrite, clearConfig, clearTokenCache, countDocuments, createCustomToken, createSessionCookie, deleteDocument, deleteFile, downloadFile, fileExists, generateSignedUrl, getAdminAccessToken, getAuth, getConfig, getDocument, getFileMetadata, getProjectId, getServiceAccount, getUserFromToken, initializeApp, iterateCollection, listDocuments, listFiles, queryDocuments, setDocument, signInWithCustomToken, updateDocument, uploadFile, uploadFileResumable, verifyIdToken, verifySessionCookie };
package/dist/index.d.ts CHANGED
@@ -335,6 +335,60 @@ declare function createCustomToken(uid: string, customClaims?: CustomClaims): Pr
335
335
  * ```
336
336
  */
337
337
  declare function signInWithCustomToken(customToken: string): Promise<CustomTokenSignInResponse>;
338
+ /**
339
+ * Options for creating a session cookie
340
+ */
341
+ interface SessionCookieOptions {
342
+ /**
343
+ * Session duration in milliseconds
344
+ * Maximum: 14 days (1,209,600,000 ms)
345
+ * Minimum: 5 minutes (300,000 ms)
346
+ */
347
+ expiresIn: number;
348
+ }
349
+ /**
350
+ * Create a session cookie from an ID token
351
+ *
352
+ * Session cookies can have a maximum duration of 14 days and are
353
+ * useful for maintaining long-lived authentication sessions.
354
+ *
355
+ * @param idToken - Valid Firebase ID token
356
+ * @param options - Session cookie options
357
+ * @returns Session cookie string
358
+ *
359
+ * @example
360
+ * ```typescript
361
+ * // Create 14-day session cookie
362
+ * const sessionCookie = await createSessionCookie(idToken, {
363
+ * expiresIn: 60 * 60 * 24 * 14 * 1000
364
+ * });
365
+ *
366
+ * // Set as HTTP-only cookie
367
+ * response.headers.set('Set-Cookie',
368
+ * `session=${sessionCookie}; Max-Age=1209600; HttpOnly; Secure; SameSite=Strict`
369
+ * );
370
+ * ```
371
+ */
372
+ declare function createSessionCookie(idToken: string, options: SessionCookieOptions): Promise<string>;
373
+ /**
374
+ * Verify a Firebase session cookie
375
+ *
376
+ * Session cookies are verified similarly to ID tokens but have
377
+ * different expiration times (up to 14 days) and issuer format.
378
+ *
379
+ * @param sessionCookie - Session cookie string to verify
380
+ * @param checkRevoked - Whether to check if the token has been revoked (not yet implemented)
381
+ * @returns Decoded token claims
382
+ *
383
+ * @example
384
+ * ```typescript
385
+ * // Verify session cookie from request
386
+ * const sessionCookie = request.cookies.get('session');
387
+ * const decodedToken = await verifySessionCookie(sessionCookie);
388
+ * console.log('User ID:', decodedToken.uid);
389
+ * ```
390
+ */
391
+ declare function verifySessionCookie(sessionCookie: string, checkRevoked?: boolean): Promise<DecodedIdToken>;
338
392
  /**
339
393
  * Get Auth instance (for compatibility, but not used in new implementation)
340
394
  * @deprecated Use verifyIdToken directly
@@ -925,4 +979,4 @@ declare function getAdminAccessToken(): Promise<string>;
925
979
  */
926
980
  declare function clearTokenCache(): void;
927
981
 
928
- export { type BatchWrite, type BatchWriteResult, type CustomClaims, type CustomTokenSignInResponse, type DataObject, type DecodedIdToken, type DocumentReference, type DownloadOptions, FieldValue, type FieldValue$1 as FieldValueSentinel, FieldValueType, type FileMetadata, type FirestoreDocument, type FirestoreValue, type ListFilesResult, type ListOptions, type QueryFilter, type QueryOptions, type QueryOrder, type ResumableUploadOptions, type ServiceAccount, type SetOptions, type SignedUrlOptions, type TokenResponse, type UpdateOptions, type UploadOptions, type UserInfo, type WhereFilterOp, addDocument, batchWrite, clearConfig, clearTokenCache, countDocuments, createCustomToken, deleteDocument, deleteFile, downloadFile, fileExists, generateSignedUrl, getAdminAccessToken, getAuth, getConfig, getDocument, getFileMetadata, getProjectId, getServiceAccount, getUserFromToken, initializeApp, iterateCollection, listDocuments, listFiles, queryDocuments, setDocument, signInWithCustomToken, updateDocument, uploadFile, uploadFileResumable, verifyIdToken };
982
+ export { type BatchWrite, type BatchWriteResult, type CustomClaims, type CustomTokenSignInResponse, type DataObject, type DecodedIdToken, type DocumentReference, type DownloadOptions, FieldValue, type FieldValue$1 as FieldValueSentinel, FieldValueType, type FileMetadata, type FirestoreDocument, type FirestoreValue, type ListFilesResult, type ListOptions, type QueryFilter, type QueryOptions, type QueryOrder, type ResumableUploadOptions, type ServiceAccount, type SessionCookieOptions, type SetOptions, type SignedUrlOptions, type TokenResponse, type UpdateOptions, type UploadOptions, type UserInfo, type WhereFilterOp, addDocument, batchWrite, clearConfig, clearTokenCache, countDocuments, createCustomToken, createSessionCookie, deleteDocument, deleteFile, downloadFile, fileExists, generateSignedUrl, getAdminAccessToken, getAuth, getConfig, getDocument, getFileMetadata, getProjectId, getServiceAccount, getUserFromToken, initializeApp, iterateCollection, listDocuments, listFiles, queryDocuments, setDocument, signInWithCustomToken, updateDocument, uploadFile, uploadFileResumable, verifyIdToken, verifySessionCookie };