···2233All notable changes to this project will be documented in this file.
4455+## [1.0.1] - 2025-11-28
66+77+### Fixed
88+99+- **Mobile token cookie compatibility**: `sealToken` now produces tokens that
1010+ are compatible with cookie-based session validation. Mobile tokens now include
1111+ `createdAt` and `lastAccessed` fields and use TTL, matching the cookie format.
1212+- **Defensive session extraction**: `getSessionFromRequest` now handles missing
1313+ `createdAt` field gracefully, providing a default value for backward
1414+ compatibility with older mobile tokens.
1515+516## [1.0.0] - 2025-11-28
617718### Breaking Changes
···154154155155 this.logger.info(
156156 `Session extracted: DID=${sessionData.did}, created=${
157157- new Date(sessionData.createdAt).toISOString()
157157+ sessionData.createdAt
158158+ ? new Date(sessionData.createdAt).toISOString()
159159+ : "N/A (mobile token)"
158160 }`,
159161 );
160162161163 // Create refreshed session with updated lastAccessed
164164+ // Provide defaults for missing fields (backward compatibility with old mobile tokens)
165165+ const now = Date.now();
162166 const refreshedData: CookieSessionData = {
163167 did: sessionData.did,
164164- createdAt: sessionData.createdAt,
165165- lastAccessed: Date.now(),
168168+ createdAt: sessionData.createdAt ?? now,
169169+ lastAccessed: now,
166170 };
167171168172 const setCookieHeader = await this.createSession(refreshedData);
···223227 /**
224228 * Seal data into a mobile Bearer token.
225229 *
230230+ * Creates a token that is compatible with cookie-based session validation,
231231+ * so mobile apps can use this token either as a Bearer token or as a cookie value.
232232+ *
226233 * @param data - Data to seal (typically just { did })
227234 * @returns Sealed token string
228235 */
229236 async sealToken(data: MobileTokenData): Promise<string> {
230230- return await sealData(data, {
237237+ // Include createdAt and lastAccessed for cookie compatibility
238238+ // This allows mobile tokens to work as cookie values
239239+ const now = Date.now();
240240+ const sessionData: CookieSessionData = {
241241+ did: data.did,
242242+ createdAt: now,
243243+ lastAccessed: now,
244244+ };
245245+ return await sealData(sessionData, {
231246 password: this.cookieSecret,
247247+ ttl: this.sessionTtl,
232248 });
233249 }
234250