[v8] Replace iron-session with iron-webcrypto v2#1416
Merged
Conversation
Contributor
Greptile OverviewGreptile SummaryReplaces Key changes:
The implementation handles backward compatibility by parsing version suffixes and extracting Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Client
participant UserManagement
participant CookieSession
participant SealWrapper as seal.ts
participant IronWebcrypto as iron-webcrypto v2
Note over Client,IronWebcrypto: Session Creation Flow
Client->>UserManagement: authenticateWithCode()
UserManagement->>SealWrapper: sealData(sessionData, {password, ttl})
SealWrapper->>IronWebcrypto: ironSeal(data, passwordObj, options)
IronWebcrypto-->>SealWrapper: encrypted seal
SealWrapper-->>UserManagement: seal + "~2" (version appended)
UserManagement-->>Client: return sealedSession
Note over Client,IronWebcrypto: Session Authentication Flow
Client->>CookieSession: authenticate()
CookieSession->>SealWrapper: unsealData(encryptedData, {password, ttl})
SealWrapper->>SealWrapper: parseSeal(encryptedData)
Note over SealWrapper: Extracts version and seal<br/>Handles v1/v2 compatibility
SealWrapper->>IronWebcrypto: ironUnseal(sealWithoutVersion, passwordMap)
IronWebcrypto-->>SealWrapper: decrypted data
alt tokenVersion === 2
SealWrapper-->>CookieSession: return data as-is
else tokenVersion !== null (v1)
SealWrapper-->>CookieSession: return record.persistent ?? data
else no version
SealWrapper-->>CookieSession: return data as-is
end
CookieSession->>CookieSession: validate JWT
CookieSession-->>Client: authentication result
|
cmatheson
approved these changes
Dec 15, 2025
src/common/crypto/seal.ts
Outdated
| data = | ||
| (await ironUnseal(sealWithoutVersion, passwordMap, { | ||
| ...defaults, | ||
| ttl: ttl * 1000, |
Contributor
There was a problem hiding this comment.
we don't really use ttl do we? i'd be ok with just implementing the interface we need if you want to drop that.
Member
Author
There was a problem hiding this comment.
Good catch. I'll simplify the interface to just password.
311bd00 to
713ee55
Compare
nicknisi
added a commit
that referenced
this pull request
Dec 16, 2025
## Summary - Replaces `iron-session` dependency with direct `iron-webcrypto` v2.0.0 - Creates lightweight `seal.ts` wrapper providing iron-session compatible API - Reduces dependency footprint while maintaining backwards compatibility ## Changes - Add `src/common/crypto/seal.ts` with `sealData` and `unsealData` functions - Update `package.json` to use `iron-webcrypto` ^2.0.0 - Update `jest.config.cjs` to transform ESM-only `uint8array-extras` dependency - Update imports in session and user-management modules
nicknisi
added a commit
that referenced
this pull request
Dec 22, 2025
## Summary - Replaces `iron-session` dependency with direct `iron-webcrypto` v2.0.0 - Creates lightweight `seal.ts` wrapper providing iron-session compatible API - Reduces dependency footprint while maintaining backwards compatibility ## Changes - Add `src/common/crypto/seal.ts` with `sealData` and `unsealData` functions - Update `package.json` to use `iron-webcrypto` ^2.0.0 - Update `jest.config.cjs` to transform ESM-only `uint8array-extras` dependency - Update imports in session and user-management modules
nicknisi
added a commit
that referenced
this pull request
Jan 8, 2026
- Replaces `iron-session` dependency with direct `iron-webcrypto` v2.0.0 - Creates lightweight `seal.ts` wrapper providing iron-session compatible API - Reduces dependency footprint while maintaining backwards compatibility - Add `src/common/crypto/seal.ts` with `sealData` and `unsealData` functions - Update `package.json` to use `iron-webcrypto` ^2.0.0 - Update `jest.config.cjs` to transform ESM-only `uint8array-extras` dependency - Update imports in session and user-management modules
nicknisi
added a commit
that referenced
this pull request
Jan 9, 2026
- Replaces `iron-session` dependency with direct `iron-webcrypto` v2.0.0 - Creates lightweight `seal.ts` wrapper providing iron-session compatible API - Reduces dependency footprint while maintaining backwards compatibility - Add `src/common/crypto/seal.ts` with `sealData` and `unsealData` functions - Update `package.json` to use `iron-webcrypto` ^2.0.0 - Update `jest.config.cjs` to transform ESM-only `uint8array-extras` dependency - Update imports in session and user-management modules
nicknisi
added a commit
that referenced
this pull request
Jan 12, 2026
- Replaces `iron-session` dependency with direct `iron-webcrypto` v2.0.0 - Creates lightweight `seal.ts` wrapper providing iron-session compatible API - Reduces dependency footprint while maintaining backwards compatibility - Add `src/common/crypto/seal.ts` with `sealData` and `unsealData` functions - Update `package.json` to use `iron-webcrypto` ^2.0.0 - Update `jest.config.cjs` to transform ESM-only `uint8array-extras` dependency - Update imports in session and user-management modules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
iron-sessiondependency with directiron-webcryptov2.0.0seal.tswrapper providing iron-session compatible APIChanges
src/common/crypto/seal.tswithsealDataandunsealDatafunctionspackage.jsonto useiron-webcrypto^2.0.0jest.config.cjsto transform ESM-onlyuint8array-extrasdependency