@amedia/user 1.6.0 → 1.7.0

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,5 +1,14 @@
1
1
  # @amedia/user
2
2
 
3
+ ## 1.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1303](https://github.com/amedia/amedia-user-js/pull/1303) [`7a9bb4b`](https://github.com/amedia/amedia-user-js/commit/7a9bb4be65ff9ad8094dd2f169d254ea57b18805) Thanks [@hennikul](https://github.com/hennikul)! - Keep the session's verification set. `SessionSchema` dropped `verifications`,
8
+ which aID has answered since the per-class split, so a caller asking whether a
9
+ session proved an identity — and how recently — had only `verified_at`, the
10
+ newest proof of any class. `verifications[].source` is the class to branch on.
11
+
3
12
  ## 1.6.0
4
13
 
5
14
  ### Minor Changes
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "git+https://github.com/amedia/amedia-user-js.git"
7
7
  },
8
8
  "author": "Amedia Produkt og Teknologi AS (https://amedia.no)",
9
- "version": "1.6.0",
9
+ "version": "1.7.0",
10
10
  "type": "module",
11
11
  "exports": {
12
12
  ".": {
package/user.node.d.ts CHANGED
@@ -274,6 +274,51 @@ declare const SessionSchema: Omit<v.ObjectSchema<{
274
274
  readonly session_tracking_key: v.StringSchema<undefined>;
275
275
  readonly verified_at: v.NullishSchema<v.StringSchema<undefined>, undefined>;
276
276
  readonly verification_source: v.NullishSchema<v.StringSchema<undefined>, undefined>;
277
+ readonly verifications: v.ArraySchema<Omit<v.ObjectSchema<{
278
+ readonly source: v.StringSchema<undefined>;
279
+ readonly provider: v.StringSchema<undefined>;
280
+ readonly verified_at: v.NullishSchema<v.StringSchema<undefined>, undefined>;
281
+ readonly refreshed_at: v.NullishSchema<v.StringSchema<undefined>, undefined>;
282
+ }, undefined>, "~types" | "~run" | "~standard" | "entries"> & {
283
+ readonly entries: {
284
+ readonly source: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
285
+ readonly provider: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
286
+ readonly verified_at: v.OptionalSchema<v.NullishSchema<v.StringSchema<undefined>, undefined>, undefined>;
287
+ readonly refreshed_at: v.OptionalSchema<v.NullishSchema<v.StringSchema<undefined>, undefined>, undefined>;
288
+ };
289
+ readonly "~standard": v.StandardProps<{
290
+ source?: string | undefined;
291
+ provider?: string | undefined;
292
+ verified_at?: string | null | undefined;
293
+ refreshed_at?: string | null | undefined;
294
+ }, {
295
+ source?: string | undefined;
296
+ provider?: string | undefined;
297
+ verified_at?: string | null | undefined;
298
+ refreshed_at?: string | null | undefined;
299
+ }>;
300
+ readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
301
+ source?: string | undefined;
302
+ provider?: string | undefined;
303
+ verified_at?: string | null | undefined;
304
+ refreshed_at?: string | null | undefined;
305
+ }, v.StringIssue | v.ObjectIssue>;
306
+ readonly "~types"?: {
307
+ readonly input: {
308
+ source?: string | undefined;
309
+ provider?: string | undefined;
310
+ verified_at?: string | null | undefined;
311
+ refreshed_at?: string | null | undefined;
312
+ };
313
+ readonly output: {
314
+ source?: string | undefined;
315
+ provider?: string | undefined;
316
+ verified_at?: string | null | undefined;
317
+ refreshed_at?: string | null | undefined;
318
+ };
319
+ readonly issue: v.StringIssue | v.ObjectIssue;
320
+ } | undefined;
321
+ }, undefined>;
277
322
  }, undefined>, "~types" | "~run" | "~standard" | "entries"> & {
278
323
  readonly entries: {
279
324
  readonly user_uuid: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -281,6 +326,51 @@ declare const SessionSchema: Omit<v.ObjectSchema<{
281
326
  readonly session_tracking_key: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
282
327
  readonly verified_at: v.OptionalSchema<v.NullishSchema<v.StringSchema<undefined>, undefined>, undefined>;
283
328
  readonly verification_source: v.OptionalSchema<v.NullishSchema<v.StringSchema<undefined>, undefined>, undefined>;
329
+ readonly verifications: v.OptionalSchema<v.ArraySchema<Omit<v.ObjectSchema<{
330
+ readonly source: v.StringSchema<undefined>;
331
+ readonly provider: v.StringSchema<undefined>;
332
+ readonly verified_at: v.NullishSchema<v.StringSchema<undefined>, undefined>;
333
+ readonly refreshed_at: v.NullishSchema<v.StringSchema<undefined>, undefined>;
334
+ }, undefined>, "~types" | "~run" | "~standard" | "entries"> & {
335
+ readonly entries: {
336
+ readonly source: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
337
+ readonly provider: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
338
+ readonly verified_at: v.OptionalSchema<v.NullishSchema<v.StringSchema<undefined>, undefined>, undefined>;
339
+ readonly refreshed_at: v.OptionalSchema<v.NullishSchema<v.StringSchema<undefined>, undefined>, undefined>;
340
+ };
341
+ readonly "~standard": v.StandardProps<{
342
+ source?: string | undefined;
343
+ provider?: string | undefined;
344
+ verified_at?: string | null | undefined;
345
+ refreshed_at?: string | null | undefined;
346
+ }, {
347
+ source?: string | undefined;
348
+ provider?: string | undefined;
349
+ verified_at?: string | null | undefined;
350
+ refreshed_at?: string | null | undefined;
351
+ }>;
352
+ readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
353
+ source?: string | undefined;
354
+ provider?: string | undefined;
355
+ verified_at?: string | null | undefined;
356
+ refreshed_at?: string | null | undefined;
357
+ }, v.StringIssue | v.ObjectIssue>;
358
+ readonly "~types"?: {
359
+ readonly input: {
360
+ source?: string | undefined;
361
+ provider?: string | undefined;
362
+ verified_at?: string | null | undefined;
363
+ refreshed_at?: string | null | undefined;
364
+ };
365
+ readonly output: {
366
+ source?: string | undefined;
367
+ provider?: string | undefined;
368
+ verified_at?: string | null | undefined;
369
+ refreshed_at?: string | null | undefined;
370
+ };
371
+ readonly issue: v.StringIssue | v.ObjectIssue;
372
+ } | undefined;
373
+ }, undefined>, undefined>;
284
374
  };
285
375
  readonly "~standard": v.StandardProps<{
286
376
  user_uuid?: string | undefined;
@@ -288,12 +378,24 @@ declare const SessionSchema: Omit<v.ObjectSchema<{
288
378
  session_tracking_key?: string | undefined;
289
379
  verified_at?: string | null | undefined;
290
380
  verification_source?: string | null | undefined;
381
+ verifications?: {
382
+ source?: string | undefined;
383
+ provider?: string | undefined;
384
+ verified_at?: string | null | undefined;
385
+ refreshed_at?: string | null | undefined;
386
+ }[] | undefined;
291
387
  }, {
292
388
  user_uuid?: string | undefined;
293
389
  user_agent?: string | undefined;
294
390
  session_tracking_key?: string | undefined;
295
391
  verified_at?: string | null | undefined;
296
392
  verification_source?: string | null | undefined;
393
+ verifications?: {
394
+ source?: string | undefined;
395
+ provider?: string | undefined;
396
+ verified_at?: string | null | undefined;
397
+ refreshed_at?: string | null | undefined;
398
+ }[] | undefined;
297
399
  }>;
298
400
  readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
299
401
  user_uuid?: string | undefined;
@@ -301,7 +403,13 @@ declare const SessionSchema: Omit<v.ObjectSchema<{
301
403
  session_tracking_key?: string | undefined;
302
404
  verified_at?: string | null | undefined;
303
405
  verification_source?: string | null | undefined;
304
- }, v.StringIssue | v.ObjectIssue>;
406
+ verifications?: {
407
+ source?: string | undefined;
408
+ provider?: string | undefined;
409
+ verified_at?: string | null | undefined;
410
+ refreshed_at?: string | null | undefined;
411
+ }[] | undefined;
412
+ }, v.StringIssue | v.ArrayIssue | v.ObjectIssue>;
305
413
  readonly "~types"?: {
306
414
  readonly input: {
307
415
  user_uuid?: string | undefined;
@@ -309,6 +417,12 @@ declare const SessionSchema: Omit<v.ObjectSchema<{
309
417
  session_tracking_key?: string | undefined;
310
418
  verified_at?: string | null | undefined;
311
419
  verification_source?: string | null | undefined;
420
+ verifications?: {
421
+ source?: string | undefined;
422
+ provider?: string | undefined;
423
+ verified_at?: string | null | undefined;
424
+ refreshed_at?: string | null | undefined;
425
+ }[] | undefined;
312
426
  };
313
427
  readonly output: {
314
428
  user_uuid?: string | undefined;
@@ -316,8 +430,14 @@ declare const SessionSchema: Omit<v.ObjectSchema<{
316
430
  session_tracking_key?: string | undefined;
317
431
  verified_at?: string | null | undefined;
318
432
  verification_source?: string | null | undefined;
433
+ verifications?: {
434
+ source?: string | undefined;
435
+ provider?: string | undefined;
436
+ verified_at?: string | null | undefined;
437
+ refreshed_at?: string | null | undefined;
438
+ }[] | undefined;
319
439
  };
320
- readonly issue: v.StringIssue | v.ObjectIssue;
440
+ readonly issue: v.StringIssue | v.ArrayIssue | v.ObjectIssue;
321
441
  } | undefined;
322
442
  };
323
443
  type Session = v.InferOutput<typeof SessionSchema>;
package/user.node.js CHANGED
@@ -128,12 +128,22 @@ const ServiceUserSchema = v.partial(v.object({
128
128
  privacy_preferences: PrivacyPreferencesSchema,
129
129
  session_tracking_key: v.string(),
130
130
  }));
131
+ /** One proof a session holds. `source` is the class: `eid`, `otp` or `passkey`. */
132
+ const SessionVerificationSchema = v.partial(v.object({
133
+ source: v.string(),
134
+ provider: v.string(),
135
+ verified_at: v.nullish(v.string()),
136
+ refreshed_at: v.nullish(v.string()),
137
+ }));
131
138
  const SessionSchema = v.partial(v.object({
132
139
  user_uuid: v.string(),
133
140
  user_agent: v.string(),
134
141
  session_tracking_key: v.string(),
135
142
  verified_at: v.nullish(v.string()),
136
143
  verification_source: v.nullish(v.string()),
144
+ // A session holds one proof per class, and verified_at above is only the
145
+ // newest of them. Branch on verifications[].source, not on that pair.
146
+ verifications: v.array(SessionVerificationSchema),
137
147
  }));
138
148
  v.object({
139
149
  type: v.string(),