@workos/authkit-session 0.3.1 → 0.3.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ironWebcryptoEncryption.d.ts","sourceRoot":"","sources":["../../../src/core/encryption/ironWebcryptoEncryption.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,IAAI,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"ironWebcryptoEncryption.d.ts","sourceRoot":"","sources":["../../../src/core/encryption/ironWebcryptoEncryption.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,IAAI,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAE3F;;GAEG;AACH,qBAAa,iBAAkB,YAAW,0BAA0B;IAClE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAO;IACxC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAK;IAGzC,OAAO,CAAC,SAAS;IAaX,QAAQ,CACZ,IAAI,EAAE,OAAO,EACb,EAAE,QAAQ,EAAE,GAAO,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE;IAgCjE,UAAU,CAAC,CAAC,GAAG,OAAO,EAC1B,aAAa,EAAE,MAAM,EACrB,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GACjC,OAAO,CAAC,CAAC,CAAC;CAoCd;AAED,QAAA,MAAM,uBAAuB,mBAA0B,CAAC;AAExD,eAAe,uBAAuB,CAAC"}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import { seal as sealData, unseal as unsealData } from 'iron-webcrypto';
|
|
2
|
-
// Cast globalThis.crypto to iron-webcrypto's expected type
|
|
3
|
-
// Runtime-safe: DOM Crypto is fully compatible with iron-webcrypto's _Crypto
|
|
4
|
-
// Type-level workaround: iron-webcrypto's _Crypto expects Uint8Array<ArrayBuffer>
|
|
5
|
-
// while DOM Crypto provides Uint8Array<ArrayBufferLike>
|
|
6
|
-
const ironCrypto = globalThis.crypto;
|
|
7
2
|
/**
|
|
8
3
|
* A compatible implementation that works with iron-session
|
|
9
4
|
*/
|
|
@@ -24,7 +19,7 @@ export class SessionEncryption {
|
|
|
24
19
|
secret: password,
|
|
25
20
|
};
|
|
26
21
|
// Seal the data using iron-webcrypto with properly formatted password
|
|
27
|
-
const seal = await sealData(
|
|
22
|
+
const seal = await sealData(data, passwordObj, {
|
|
28
23
|
encryption: {
|
|
29
24
|
saltBits: 256,
|
|
30
25
|
algorithm: 'aes-256-cbc',
|
|
@@ -51,7 +46,7 @@ export class SessionEncryption {
|
|
|
51
46
|
// Format password as a map like iron-session expects
|
|
52
47
|
const passwordMap = { 1: password };
|
|
53
48
|
// Use iron-webcrypto's unseal function
|
|
54
|
-
const data = await unsealData(
|
|
49
|
+
const data = await unsealData(sealWithoutVersion, passwordMap, {
|
|
55
50
|
encryption: {
|
|
56
51
|
saltBits: 256,
|
|
57
52
|
algorithm: 'aes-256-cbc',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ironWebcryptoEncryption.js","sourceRoot":"","sources":["../../../src/core/encryption/ironWebcryptoEncryption.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ironWebcryptoEncryption.js","sourceRoot":"","sources":["../../../src/core/encryption/ironWebcryptoEncryption.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGxE;;GAEG;AACH,MAAM,OAAO,iBAAiB;IACX,gBAAgB,GAAG,GAAG,CAAC;IACvB,mBAAmB,GAAG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C;QAC/C,MAAM,EAAE,kBAAkB,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QAE3E,qDAAqD;QACrD,MAAM,WAAW,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC;QAEpC,uCAAuC;QACvC,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,kBAAkB,EAAE,WAAW,EAAE;YAC7D,UAAU,EAAE;gBACV,QAAQ,EAAE,GAAG;gBACb,SAAS,EAAE,aAAa;gBACxB,UAAU,EAAE,CAAC;gBACb,iBAAiB,EAAE,EAAE;aACtB;YACD,SAAS,EAAE;gBACT,QAAQ,EAAE,GAAG;gBACb,SAAS,EAAE,QAAQ;gBACnB,UAAU,EAAE,CAAC;gBACb,iBAAiB,EAAE,EAAE;aACtB;YACD,GAAG,EAAE,CAAC;YACN,gBAAgB,EAAE,EAAE;YACpB,mBAAmB,EAAE,CAAC;SACvB,CAAC,CAAC;QAEH,oCAAoC;QACpC,IAAI,YAAY,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO,IAAS,CAAC;QACnB,CAAC;aAAM,IAAI,YAAY,KAAK,IAAI,EAAE,CAAC;YACjC,4DAA4D;YAC5D,OAAO,EAAE,GAAI,IAAY,CAAC,UAAU,EAAO,CAAC;QAC9C,CAAC;QAED,OAAO,IAAS,CAAC;IACnB,CAAC;CACF;AAED,MAAM,uBAAuB,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAExD,eAAe,uBAAuB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workos/authkit-session",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Framework-agnostic authentication library for WorkOS with pluggable storage adapters",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"vitest": "^4.0.10"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@workos-inc/node": "
|
|
39
|
-
"iron-webcrypto": "^
|
|
40
|
-
"jose": "^6.1.
|
|
38
|
+
"@workos-inc/node": "8.0.0-rc.5",
|
|
39
|
+
"iron-webcrypto": "^2.0.0",
|
|
40
|
+
"jose": "^6.1.3"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=20.0.0"
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { seal as sealData, unseal as unsealData } from 'iron-webcrypto';
|
|
2
2
|
import type { SessionEncryption as SessionEncryptionInterface } from '../session/types.js';
|
|
3
3
|
|
|
4
|
-
// Extract the precise Crypto type that iron-webcrypto expects
|
|
5
|
-
// This avoids importing iron-webcrypto's private _Crypto type
|
|
6
|
-
type IronCrypto = Parameters<typeof sealData>[0];
|
|
7
|
-
|
|
8
|
-
// Cast globalThis.crypto to iron-webcrypto's expected type
|
|
9
|
-
// Runtime-safe: DOM Crypto is fully compatible with iron-webcrypto's _Crypto
|
|
10
|
-
// Type-level workaround: iron-webcrypto's _Crypto expects Uint8Array<ArrayBuffer>
|
|
11
|
-
// while DOM Crypto provides Uint8Array<ArrayBufferLike>
|
|
12
|
-
const ironCrypto: IronCrypto = globalThis.crypto as unknown as IronCrypto;
|
|
13
|
-
|
|
14
4
|
/**
|
|
15
5
|
* A compatible implementation that works with iron-session
|
|
16
6
|
*/
|
|
@@ -43,7 +33,7 @@ export class SessionEncryption implements SessionEncryptionInterface {
|
|
|
43
33
|
};
|
|
44
34
|
|
|
45
35
|
// Seal the data using iron-webcrypto with properly formatted password
|
|
46
|
-
const seal = await sealData(
|
|
36
|
+
const seal = await sealData(data, passwordObj, {
|
|
47
37
|
encryption: {
|
|
48
38
|
saltBits: 256,
|
|
49
39
|
algorithm: 'aes-256-cbc',
|
|
@@ -77,7 +67,7 @@ export class SessionEncryption implements SessionEncryptionInterface {
|
|
|
77
67
|
const passwordMap = { 1: password };
|
|
78
68
|
|
|
79
69
|
// Use iron-webcrypto's unseal function
|
|
80
|
-
const data = await unsealData(
|
|
70
|
+
const data = await unsealData(sealWithoutVersion, passwordMap, {
|
|
81
71
|
encryption: {
|
|
82
72
|
saltBits: 256,
|
|
83
73
|
algorithm: 'aes-256-cbc',
|