@flink-app/bankid-plugin 0.14.1 → 2.0.0-alpha.100

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/CHANGELOG.md CHANGED
@@ -1,11 +1,380 @@
1
1
  # @flink-app/bankid-plugin
2
2
 
3
+ ## 2.0.0-alpha.100
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [6e8166a]
8
+ - @flink-app/flink@2.0.0-alpha.100
9
+
10
+ ## 2.0.0-alpha.99
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [ed9cd2c]
15
+ - @flink-app/flink@2.0.0-alpha.99
16
+
17
+ ## 2.0.0-alpha.98
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [2f4a132]
22
+ - @flink-app/flink@2.0.0-alpha.98
23
+
24
+ ## 2.0.0-alpha.97
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies [eed6bc1]
29
+ - @flink-app/flink@2.0.0-alpha.97
30
+
31
+ ## 2.0.0-alpha.96
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies
36
+ - @flink-app/flink@2.0.0-alpha.96
37
+
38
+ ## 2.0.0-alpha.95
39
+
40
+ ### Patch Changes
41
+
42
+ - @flink-app/flink@2.0.0-alpha.95
43
+
44
+ ## 2.0.0-alpha.94
45
+
46
+ ### Patch Changes
47
+
48
+ - @flink-app/flink@2.0.0-alpha.94
49
+
50
+ ## 2.0.0-alpha.93
51
+
52
+ ### Patch Changes
53
+
54
+ - @flink-app/flink@2.0.0-alpha.93
55
+
56
+ ## 2.0.0-alpha.92
57
+
58
+ ### Patch Changes
59
+
60
+ - Updated dependencies [8d23d56]
61
+ - @flink-app/flink@2.0.0-alpha.92
62
+
63
+ ## 2.0.0-alpha.91
64
+
65
+ ### Patch Changes
66
+
67
+ - @flink-app/flink@2.0.0-alpha.91
68
+
69
+ ## 2.0.0-alpha.90
70
+
71
+ ### Patch Changes
72
+
73
+ - Updated dependencies [0d84b5f]
74
+ - @flink-app/flink@2.0.0-alpha.90
75
+
76
+ ## 2.0.0-alpha.89
77
+
78
+ ### Patch Changes
79
+
80
+ - @flink-app/flink@2.0.0-alpha.89
81
+
82
+ ## 2.0.0-alpha.88
83
+
84
+ ### Patch Changes
85
+
86
+ - @flink-app/flink@2.0.0-alpha.88
87
+
88
+ ## 2.0.0-alpha.87
89
+
90
+ ### Patch Changes
91
+
92
+ - Updated dependencies
93
+ - @flink-app/flink@2.0.0-alpha.87
94
+
95
+ ## 2.0.0-alpha.86
96
+
97
+ ### Patch Changes
98
+
99
+ - @flink-app/flink@2.0.0-alpha.86
100
+
101
+ ## 2.0.0-alpha.85
102
+
103
+ ### Patch Changes
104
+
105
+ - @flink-app/flink@2.0.0-alpha.85
106
+
107
+ ## 2.0.0-alpha.84
108
+
109
+ ### Patch Changes
110
+
111
+ - @flink-app/flink@2.0.0-alpha.84
112
+
113
+ ## 2.0.0-alpha.83
114
+
115
+ ### Patch Changes
116
+
117
+ - Updated dependencies
118
+ - @flink-app/flink@2.0.0-alpha.83
119
+
120
+ ## 2.0.0-alpha.82
121
+
122
+ ### Patch Changes
123
+
124
+ - @flink-app/flink@2.0.0-alpha.82
125
+
126
+ ## 2.0.0-alpha.81
127
+
128
+ ### Patch Changes
129
+
130
+ - Pass ctx to onAuthSuccess and onSignSuccess callbacks, matching the OIDC plugin pattern. Callbacks now receive a params object as first argument and the Flink context (TCtx) as second argument. Plugin factory is now generic: `bankIdPlugin<TCtx>()`.
131
+ - @flink-app/flink@2.0.0-alpha.81
132
+
133
+ ## 2.0.0-alpha.80
134
+
135
+ ### Patch Changes
136
+
137
+ - @flink-app/flink@2.0.0-alpha.80
138
+
139
+ ## 2.0.0-alpha.79
140
+
141
+ ### Patch Changes
142
+
143
+ - @flink-app/flink@2.0.0-alpha.79
144
+
145
+ ## 2.0.0-alpha.78
146
+
147
+ ### Patch Changes
148
+
149
+ - @flink-app/flink@2.0.0-alpha.78
150
+
151
+ ## 2.0.0-alpha.77
152
+
153
+ ### Patch Changes
154
+
155
+ - @flink-app/flink@2.0.0-alpha.77
156
+
157
+ ## 2.0.0-alpha.76
158
+
159
+ ### Patch Changes
160
+
161
+ - @flink-app/flink@2.0.0-alpha.76
162
+
163
+ ## 2.0.0-alpha.75
164
+
165
+ ### Patch Changes
166
+
167
+ - @flink-app/flink@2.0.0-alpha.75
168
+
169
+ ## 2.0.0-alpha.74
170
+
171
+ ### Patch Changes
172
+
173
+ - Updated dependencies
174
+ - Updated dependencies
175
+ - @flink-app/flink@2.0.0-alpha.74
176
+
177
+ ## 2.0.0-alpha.73
178
+
179
+ ### Patch Changes
180
+
181
+ - Updated dependencies
182
+ - @flink-app/flink@2.0.0-alpha.73
183
+
184
+ ## 2.0.0-alpha.72
185
+
186
+ ### Patch Changes
187
+
188
+ - Updated dependencies
189
+ - @flink-app/flink@2.0.0-alpha.72
190
+
191
+ ## 2.0.0-alpha.71
192
+
193
+ ### Patch Changes
194
+
195
+ - @flink-app/flink@2.0.0-alpha.71
196
+
197
+ ## 2.0.0-alpha.70
198
+
199
+ ### Patch Changes
200
+
201
+ - @flink-app/flink@2.0.0-alpha.70
202
+
203
+ ## 2.0.0-alpha.69
204
+
205
+ ### Patch Changes
206
+
207
+ - @flink-app/flink@2.0.0-alpha.69
208
+
209
+ ## 2.0.0-alpha.68
210
+
211
+ ### Patch Changes
212
+
213
+ - @flink-app/flink@2.0.0-alpha.68
214
+
215
+ ## 2.0.0-alpha.67
216
+
217
+ ### Patch Changes
218
+
219
+ - Updated dependencies [418cb54]
220
+ - Updated dependencies [70d574c]
221
+ - @flink-app/flink@2.0.0-alpha.67
222
+
223
+ ## 2.0.0-alpha.66
224
+
225
+ ### Patch Changes
226
+
227
+ - Updated dependencies [5593d26]
228
+ - @flink-app/flink@2.0.0-alpha.66
229
+
230
+ ## 2.0.0-alpha.65
231
+
232
+ ### Patch Changes
233
+
234
+ - @flink-app/flink@2.0.0-alpha.65
235
+
236
+ ## 2.0.0-alpha.64
237
+
238
+ ### Patch Changes
239
+
240
+ - Updated dependencies [95b99ee]
241
+ - @flink-app/flink@2.0.0-alpha.64
242
+
243
+ ## 2.0.0-alpha.63
244
+
245
+ ### Patch Changes
246
+
247
+ - Updated dependencies [810df2c]
248
+ - Updated dependencies [8dd0752]
249
+ - @flink-app/flink@2.0.0-alpha.63
250
+
251
+ ## 2.0.0-alpha.62
252
+
253
+ ### Patch Changes
254
+
255
+ - Updated dependencies
256
+ - @flink-app/flink@2.0.0-alpha.62
257
+
258
+ ## 2.0.0-alpha.61
259
+
260
+ ### Patch Changes
261
+
262
+ - @flink-app/flink@2.0.0-alpha.61
263
+
264
+ ## 2.0.0-alpha.60
265
+
266
+ ### Patch Changes
267
+
268
+ - @flink-app/flink@2.0.0-alpha.60
269
+
270
+ ## 2.0.0-alpha.59
271
+
272
+ ### Patch Changes
273
+
274
+ - Updated dependencies [dbc2119]
275
+ - @flink-app/flink@2.0.0-alpha.59
276
+
277
+ ## 2.0.0-alpha.58
278
+
279
+ ### Patch Changes
280
+
281
+ - Updated dependencies
282
+ - @flink-app/flink@2.0.0-alpha.58
283
+
284
+ ## 2.0.0-alpha.57
285
+
286
+ ### Patch Changes
287
+
288
+ - Updated dependencies [ef7f495]
289
+ - Updated dependencies [2d53aa4]
290
+ - Updated dependencies [b3cc5d1]
291
+ - Updated dependencies [d377fac]
292
+ - Updated dependencies [4ad44c0]
293
+ - Updated dependencies [90f80c7]
294
+ - Updated dependencies [f0887e7]
295
+ - Updated dependencies [68c46d3]
296
+ - Updated dependencies [4ad44c0]
297
+ - Updated dependencies
298
+ - @flink-app/flink@2.0.0-alpha.57
299
+
300
+ ## 2.0.0-alpha.56
301
+
302
+ ### Patch Changes
303
+
304
+ - Zod 3.x compat
305
+ - Updated dependencies
306
+ - Updated dependencies [0203256]
307
+ - @flink-app/flink@2.0.0-alpha.56
308
+
309
+ ## 2.0.0-alpha.55
310
+
311
+ ### Patch Changes
312
+
313
+ - Updated dependencies [3267206]
314
+ - Updated dependencies [497b7c2]
315
+ - Updated dependencies [3267206]
316
+ - @flink-app/flink@2.0.0-alpha.55
317
+
318
+ ## 2.0.0-alpha.53
319
+
320
+ ### Patch Changes
321
+
322
+ - Updated dependencies [669c806]
323
+ - @flink-app/flink@2.0.0-alpha.53
324
+
325
+ ## 2.0.0-alpha.52
326
+
327
+ ### Patch Changes
328
+
329
+ - Updated dependencies [fe9f8f2]
330
+ - @flink-app/flink@2.0.0-alpha.52
331
+
332
+ ## 2.0.0-alpha.51
333
+
334
+ ### Patch Changes
335
+
336
+ - fix: add peerDependencies to all plugins and adapters
337
+
338
+ **Breaking Change Prevention:**
339
+
340
+ - Added "@flink-app/flink": ">=2.0.0-alpha.0" as peerDependency to all plugins
341
+ - Fixed oidc-plugin peerDependencies from "workspace:\*" to proper version ranges
342
+ - Fixed oauth-plugin to include @flink-app/flink peerDependency
343
+
344
+ **JWT Auth Plugin Interface Fix:**
345
+
346
+ - Removed redundant createToken declaration from JwtAuthPlugin interface
347
+ - The method is already inherited from FlinkAuthPlugin, this fixes TypeScript type checking issues
348
+
349
+ **Why this matters:**
350
+
351
+ - Ensures only one version of @flink-app/flink exists in node_modules
352
+ - Prevents type conflicts when TypeScript resolves interfaces across packages
353
+ - Follows standard plugin architecture best practices (same pattern as React, Webpack, etc.)
354
+ - Package managers now warn if incompatible versions are installed
355
+ - @flink-app/flink@2.0.0-alpha.51
356
+
357
+ ## 2.0.0-alpha.50
358
+
359
+ ## 2.0.0-alpha.49
360
+
361
+ ### Patch Changes
362
+
363
+ - Typescript include fix
364
+
365
+ ## 2.0.0-alpha.48
366
+
367
+ ## 1.0.0
368
+
369
+ ### Minor Changes
370
+
371
+ - Align minor version, from now all packages in monorepo will have same version
3
372
 
4
373
  ## 0.14.1
5
374
 
6
375
  ### Patch Changes
7
376
 
8
- - fix: restore compatibility between core framework and plugins after 0.14.0 release
377
+ - fix: restore compatibility between core framework and plugins after 0.14.0 release
9
378
 
10
379
  ## 0.13.1
11
380
 
@@ -1,3 +1,3 @@
1
1
  import { FlinkPlugin } from "@flink-app/flink";
2
2
  import { BankIdPluginOptions } from "./BankIdPluginOptions";
3
- export declare function bankIdPlugin(options: BankIdPluginOptions): FlinkPlugin;
3
+ export declare function bankIdPlugin<TCtx = any>(options: BankIdPluginOptions<TCtx>): FlinkPlugin;
@@ -14,7 +14,7 @@ export interface AuthSuccessCallbackResponse {
14
14
  user: any;
15
15
  token: string;
16
16
  }
17
- export interface BankIdPluginOptions {
17
+ export interface BankIdPluginOptions<TCtx = any> {
18
18
  /**
19
19
  * BankID PFX certificate in base64 format
20
20
  */
@@ -46,22 +46,27 @@ export interface BankIdPluginOptions {
46
46
  * Callback invoked when BankID auth is successful.
47
47
  * Callback must return an object containing user information and
48
48
  * token. This will be relayed in the collect response to client.
49
- * @param userData
50
- * @param ip
51
- * @param payload
52
- * @returns
49
+ *
50
+ * @param params - Auth result data (user, ip, payload)
51
+ * @param ctx - Flink context with access to repos and plugins
52
+ * @returns User object and JWT token
53
53
  */
54
- onAuthSuccess: (userData: BankIdUserData, ip?: string, payload?: Record<string, any>) => Promise<AuthSuccessCallbackResponse>;
54
+ onAuthSuccess: (params: {
55
+ user: BankIdUserData;
56
+ ip?: string;
57
+ payload?: Record<string, any>;
58
+ }, ctx: TCtx) => Promise<AuthSuccessCallbackResponse>;
55
59
  /**
56
60
  * Callback invoked when BankID sign is successful.
57
- * Callback must return an object containing user information and
58
- * signature data. This will be relayed in the collect response to client.
59
- * @param userData
60
- * @param signature
61
- * @param payload
62
- * @returns
61
+ *
62
+ * @param params - Sign result data (user, signature, payload)
63
+ * @param ctx - Flink context with access to repos and plugins
63
64
  */
64
- onSignSuccess?: (userData: BankIdUserData, signature: BankIdSignature, payload?: Record<string, any>) => Promise<void>;
65
+ onSignSuccess?: (params: {
66
+ user: BankIdUserData;
67
+ signature: BankIdSignature;
68
+ payload?: Record<string, any>;
69
+ }, ctx: TCtx) => Promise<void>;
65
70
  /**
66
71
  * For how long to keep sessions in database.
67
72
  * This has nothing to do with how long the user is logged in, only
@@ -60,7 +60,7 @@ function getAuthStatus(ctx, options) {
60
60
  case 2:
61
61
  _c.sent();
62
62
  throw (0, flink_1.internalServerError)("Session is completed but user data is missing");
63
- case 3: return [4 /*yield*/, pluginOptions.onAuthSuccess(session.user, (_a = session.device) === null || _a === void 0 ? void 0 : _a.ipAddress, session.payload)];
63
+ case 3: return [4 /*yield*/, pluginOptions.onAuthSuccess({ user: session.user, ip: (_a = session.device) === null || _a === void 0 ? void 0 : _a.ipAddress, payload: session.payload }, ctx)];
64
64
  case 4:
65
65
  authCallbackRes = _c.sent();
66
66
  return [2 /*return*/, {
@@ -73,7 +73,7 @@ function getSignStatus(ctx, options) {
73
73
  throw new Error("Signature data is missing");
74
74
  case 5:
75
75
  // Invoke host app callback
76
- return [4 /*yield*/, pluginOptions.onSignSuccess(session.user, session.signature, session.payload)];
76
+ return [4 /*yield*/, pluginOptions.onSignSuccess({ user: session.user, signature: session.signature, payload: session.payload }, ctx)];
77
77
  case 6:
78
78
  // Invoke host app callback
79
79
  _b.sent();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flink-app/bankid-plugin",
3
- "version": "0.14.1",
3
+ "version": "2.0.0-alpha.100",
4
4
  "description": "Flink plugin for Swedish BankID authentication and document signing",
5
5
  "author": "joel@frost.se",
6
6
  "license": "MIT",
@@ -20,9 +20,12 @@
20
20
  "@types/node": "22.13.10",
21
21
  "ts-node": "^10.9.2",
22
22
  "tsc-watch": "^4.2.9",
23
- "@flink-app/flink": "0.14.1"
23
+ "@flink-app/flink": "2.0.0-alpha.100"
24
24
  },
25
25
  "gitHead": "4243e3b3cd6d4e1ca001a61baa8436bf2bbe4113",
26
+ "peerDependencies": {
27
+ "@flink-app/flink": ">=2.0.0-alpha.100"
28
+ },
26
29
  "scripts": {
27
30
  "test": "jasmine-ts --config=./spec/support/jasmine.json",
28
31
  "test:watch": "nodemon --ext ts --exec 'jasmine-ts --config=./spec/support/jasmine.json'",
@@ -13,7 +13,7 @@ import { getAuthStatus } from "./functions/getAuthStatus";
13
13
  import { getSignStatus } from "./functions/getSignStatus";
14
14
  import { cancelSession } from "./functions/cancelSession";
15
15
 
16
- export function bankIdPlugin(options: BankIdPluginOptions): FlinkPlugin {
16
+ export function bankIdPlugin<TCtx = any>(options: BankIdPluginOptions<TCtx>): FlinkPlugin {
17
17
  if (!options.pfxBase64) {
18
18
  throw new Error("BankID Plugin: pfxBase64 is required");
19
19
  }
@@ -18,7 +18,7 @@ export interface AuthSuccessCallbackResponse {
18
18
  token: string;
19
19
  }
20
20
 
21
- export interface BankIdPluginOptions {
21
+ export interface BankIdPluginOptions<TCtx = any> {
22
22
  /**
23
23
  * BankID PFX certificate in base64 format
24
24
  */
@@ -55,23 +55,34 @@ export interface BankIdPluginOptions {
55
55
  * Callback invoked when BankID auth is successful.
56
56
  * Callback must return an object containing user information and
57
57
  * token. This will be relayed in the collect response to client.
58
- * @param userData
59
- * @param ip
60
- * @param payload
61
- * @returns
58
+ *
59
+ * @param params - Auth result data (user, ip, payload)
60
+ * @param ctx - Flink context with access to repos and plugins
61
+ * @returns User object and JWT token
62
62
  */
63
- onAuthSuccess: (userData: BankIdUserData, ip?: string, payload?: Record<string, any>) => Promise<AuthSuccessCallbackResponse>;
63
+ onAuthSuccess: (
64
+ params: {
65
+ user: BankIdUserData;
66
+ ip?: string;
67
+ payload?: Record<string, any>;
68
+ },
69
+ ctx: TCtx
70
+ ) => Promise<AuthSuccessCallbackResponse>;
64
71
 
65
72
  /**
66
73
  * Callback invoked when BankID sign is successful.
67
- * Callback must return an object containing user information and
68
- * signature data. This will be relayed in the collect response to client.
69
- * @param userData
70
- * @param signature
71
- * @param payload
72
- * @returns
74
+ *
75
+ * @param params - Sign result data (user, signature, payload)
76
+ * @param ctx - Flink context with access to repos and plugins
73
77
  */
74
- onSignSuccess?: (userData: BankIdUserData, signature: BankIdSignature, payload?: Record<string, any>) => Promise<void>;
78
+ onSignSuccess?: (
79
+ params: {
80
+ user: BankIdUserData;
81
+ signature: BankIdSignature;
82
+ payload?: Record<string, any>;
83
+ },
84
+ ctx: TCtx
85
+ ) => Promise<void>;
75
86
 
76
87
  /**
77
88
  * For how long to keep sessions in database.
@@ -40,7 +40,10 @@ export async function getAuthStatus(ctx: BankIdInternalCtx, options: AuthStatusO
40
40
  // - Create user if not found
41
41
  // - Create access token
42
42
  // If host app throws for example notFound error, this will be propagated as response here
43
- const authCallbackRes = await pluginOptions.onAuthSuccess(session.user, session.device?.ipAddress, session.payload);
43
+ const authCallbackRes = await pluginOptions.onAuthSuccess(
44
+ { user: session.user, ip: session.device?.ipAddress, payload: session.payload },
45
+ ctx
46
+ );
44
47
 
45
48
  return {
46
49
  status: "complete",
@@ -48,7 +48,10 @@ export async function getSignStatus(ctx: BankIdInternalCtx, options: SignStatusO
48
48
  }
49
49
 
50
50
  // Invoke host app callback
51
- await pluginOptions.onSignSuccess(session.user, session.signature, session.payload);
51
+ await pluginOptions.onSignSuccess(
52
+ { user: session.user, signature: session.signature, payload: session.payload },
53
+ ctx
54
+ );
52
55
 
53
56
  return {
54
57
  status: "complete",