Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: default to unsealed mode
Session cookies are written as plain JSON by default. PKCE state
remains iron-sealed (TTL > 0 guard). Consumers can pass
{ mode: 'sealed' } to re-enable encryption.
  • Loading branch information
nicknisi committed May 6, 2026
commit 6899e61eb3064c46efad02eb706badb40bc0e555
22 changes: 11 additions & 11 deletions src/core/encryption/sessionEncryption.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@ const testData = {
describe('SessionEncryptionAdapter', () => {
const iron = new IronEncryption();

describe('sealed mode (default)', () => {
describe('unsealed mode (default)', () => {
const adapter = new SessionEncryptionAdapter(iron);

it('writes iron-sealed data by default', async () => {
it('writes plain JSON by default', async () => {
const result = await adapter.sealData(testData, {
password: testPassword,
});
expect(result).toMatch(/^Fe26\.2\*/);
expect(JSON.parse(result)).toEqual(testData);
});

it('reads iron-sealed data', async () => {
const sealed = await adapter.sealData(testData, {
password: testPassword,
});
const result = await adapter.unsealData(sealed, {
it('reads plain JSON', async () => {
const json = JSON.stringify(testData);
const result = await adapter.unsealData(json, {
password: testPassword,
});
expect(result).toEqual(testData);
});

it('reads plain JSON (forward-compat with unsealed mode)', async () => {
const json = JSON.stringify(testData);
const result = await adapter.unsealData(json, {
it('reads legacy iron-sealed data', async () => {
const sealed = await iron.sealData(testData, {
password: testPassword,
});
const result = await adapter.unsealData(sealed, {
password: testPassword,
});
expect(result).toEqual(testData);
Expand Down
2 changes: 1 addition & 1 deletion src/core/encryption/sessionEncryption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class SessionEncryptionAdapter implements SessionEncryption {
options: SessionEncryptionAdapterOptions = {},
) {
this.ironEncryption = ironEncryption;
this.mode = options.mode ?? 'sealed';
this.mode = options.mode ?? 'unsealed';
}

async sealData(
Expand Down
Loading