@interop/wallet-core 0.51.0 → 0.53.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.
Files changed (292) hide show
  1. package/README.md +7 -11
  2. package/dist/clientAnnex/credentialAnchoredGenesis.d.ts +2 -2
  3. package/dist/clientAnnex/credentialAnchoredGenesis.d.ts.map +1 -1
  4. package/dist/clientAnnex/credentialAnchoredGenesis.js +1 -1
  5. package/dist/clientAnnex/forget.d.ts +18 -6
  6. package/dist/clientAnnex/forget.d.ts.map +1 -1
  7. package/dist/clientAnnex/forget.js +19 -6
  8. package/dist/clientAnnex/forget.js.map +1 -1
  9. package/dist/clientAnnex/forgetLast.d.ts +51 -30
  10. package/dist/clientAnnex/forgetLast.d.ts.map +1 -1
  11. package/dist/clientAnnex/forgetLast.js +72 -26
  12. package/dist/clientAnnex/forgetLast.js.map +1 -1
  13. package/dist/clientAnnex/gc.d.ts +3 -3
  14. package/dist/clientAnnex/gc.d.ts.map +1 -1
  15. package/dist/clientAnnex/gc.js +2 -2
  16. package/dist/clientAnnex/gc.js.map +1 -1
  17. package/dist/clientAnnex/index.d.ts +6 -6
  18. package/dist/clientAnnex/index.d.ts.map +1 -1
  19. package/dist/clientAnnex/index.js +5 -5
  20. package/dist/clientAnnex/index.js.map +1 -1
  21. package/dist/clientAnnex/ladder.d.ts +19 -11
  22. package/dist/clientAnnex/ladder.d.ts.map +1 -1
  23. package/dist/clientAnnex/ladder.js +77 -14
  24. package/dist/clientAnnex/ladder.js.map +1 -1
  25. package/dist/clientAnnex/ladderAnchored.d.ts +146 -10
  26. package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
  27. package/dist/clientAnnex/ladderAnchored.js +230 -26
  28. package/dist/clientAnnex/ladderAnchored.js.map +1 -1
  29. package/dist/clientAnnex/log.d.ts +6 -6
  30. package/dist/clientAnnex/log.d.ts.map +1 -1
  31. package/dist/clientAnnex/log.js +8 -8
  32. package/dist/clientAnnex/log.js.map +1 -1
  33. package/dist/clientAnnex/recoveryLadderAnchored.d.ts +18 -7
  34. package/dist/clientAnnex/recoveryLadderAnchored.d.ts.map +1 -1
  35. package/dist/clientAnnex/recoveryLadderAnchored.js +54 -14
  36. package/dist/clientAnnex/recoveryLadderAnchored.js.map +1 -1
  37. package/dist/clientAnnex/selfEnroll.d.ts +67 -6
  38. package/dist/clientAnnex/selfEnroll.d.ts.map +1 -1
  39. package/dist/clientAnnex/selfEnroll.js +91 -15
  40. package/dist/clientAnnex/selfEnroll.js.map +1 -1
  41. package/dist/clients/listing.d.ts +1 -1
  42. package/dist/clients/listing.d.ts.map +1 -1
  43. package/dist/clients/listing.js +1 -1
  44. package/dist/clients/listing.js.map +1 -1
  45. package/dist/clients/revocation.d.ts +1 -1
  46. package/dist/clients/rosterPolicy.d.ts +1 -1
  47. package/dist/clients/rosterPolicy.d.ts.map +1 -1
  48. package/dist/clients/rosterPolicy.js +10 -7
  49. package/dist/clients/rosterPolicy.js.map +1 -1
  50. package/dist/descriptors/acquire.js +1 -1
  51. package/dist/descriptors/logSource.d.ts +6 -4
  52. package/dist/descriptors/logSource.d.ts.map +1 -1
  53. package/dist/descriptors/logSource.js +7 -4
  54. package/dist/descriptors/logSource.js.map +1 -1
  55. package/dist/enrollment/enrollment.d.ts +1 -1
  56. package/dist/enrollment/enrollment.d.ts.map +1 -1
  57. package/dist/enrollment/enrollment.js +2 -1
  58. package/dist/enrollment/enrollment.js.map +1 -1
  59. package/dist/genesis/accountGenesis.d.ts +1 -1
  60. package/dist/genesis/accountGenesis.d.ts.map +1 -1
  61. package/dist/genesis/accountGenesis.js +1 -1
  62. package/dist/index.d.ts +8 -3
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.js +7 -3
  65. package/dist/index.js.map +1 -1
  66. package/dist/keyring/kdf.d.ts +6 -20
  67. package/dist/keyring/kdf.d.ts.map +1 -1
  68. package/dist/keyring/kdf.js +8 -5
  69. package/dist/keyring/kdf.js.map +1 -1
  70. package/dist/keyring/unlockSpace.js +1 -1
  71. package/dist/keys/clientKeyRecord.d.ts +68 -1
  72. package/dist/keys/clientKeyRecord.d.ts.map +1 -1
  73. package/dist/keys/clientKeyRecord.js +155 -20
  74. package/dist/keys/clientKeyRecord.js.map +1 -1
  75. package/dist/keys/index.d.ts +2 -2
  76. package/dist/keys/index.d.ts.map +1 -1
  77. package/dist/keys/index.js +1 -1
  78. package/dist/keys/index.js.map +1 -1
  79. package/dist/keys/rosterLogStore.d.ts +16 -14
  80. package/dist/keys/rosterLogStore.d.ts.map +1 -1
  81. package/dist/keys/rosterLogStore.js +164 -32
  82. package/dist/keys/rosterLogStore.js.map +1 -1
  83. package/dist/keys/rosterStore.d.ts +8 -7
  84. package/dist/keys/rosterStore.d.ts.map +1 -1
  85. package/dist/keys/rosterStore.js +6 -6
  86. package/dist/keys/rosterStore.js.map +1 -1
  87. package/dist/keys/spaceEpochs.d.ts +1 -1
  88. package/dist/keys/spaceEpochs.js +1 -1
  89. package/dist/keys/userKeyRoster.d.ts +3 -3
  90. package/dist/keys/userKeyRoster.d.ts.map +1 -1
  91. package/dist/keys/userKeyRoster.js +3 -3
  92. package/dist/keys/userKeyRoster.js.map +1 -1
  93. package/dist/log.d.ts +49 -0
  94. package/dist/log.d.ts.map +1 -0
  95. package/dist/log.js +53 -0
  96. package/dist/log.js.map +1 -0
  97. package/dist/recovery/index.d.ts +2 -2
  98. package/dist/recovery/index.js +2 -2
  99. package/dist/recovery/recoveryDelegation.d.ts +6 -2
  100. package/dist/recovery/recoveryDelegation.d.ts.map +1 -1
  101. package/dist/recovery/recoveryDelegation.js +32 -6
  102. package/dist/recovery/recoveryDelegation.js.map +1 -1
  103. package/dist/recovery/recoveryWebvh.d.ts +67 -8
  104. package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
  105. package/dist/recovery/recoveryWebvh.js +114 -19
  106. package/dist/recovery/recoveryWebvh.js.map +1 -1
  107. package/dist/request/appKey.d.ts +9 -3
  108. package/dist/request/appKey.d.ts.map +1 -1
  109. package/dist/request/appKey.js +13 -8
  110. package/dist/request/appKey.js.map +1 -1
  111. package/dist/request/capabilityRequest.d.ts +9 -1
  112. package/dist/request/capabilityRequest.d.ts.map +1 -1
  113. package/dist/request/capabilityRequest.js +13 -2
  114. package/dist/request/capabilityRequest.js.map +1 -1
  115. package/dist/request/classify.d.ts +37 -1
  116. package/dist/request/classify.d.ts.map +1 -1
  117. package/dist/request/classify.js +74 -3
  118. package/dist/request/classify.js.map +1 -1
  119. package/dist/request/ephemeralExchange.d.ts +5 -18
  120. package/dist/request/ephemeralExchange.d.ts.map +1 -1
  121. package/dist/request/ephemeralExchange.js +9 -3
  122. package/dist/request/ephemeralExchange.js.map +1 -1
  123. package/dist/request/exchangeClient.d.ts +0 -23
  124. package/dist/request/exchangeClient.d.ts.map +1 -1
  125. package/dist/request/exchangeClient.js +30 -1
  126. package/dist/request/exchangeClient.js.map +1 -1
  127. package/dist/request/index.d.ts +4 -1
  128. package/dist/request/index.d.ts.map +1 -1
  129. package/dist/request/index.js +4 -1
  130. package/dist/request/index.js.map +1 -1
  131. package/dist/request/interactionRequest.d.ts +23 -0
  132. package/dist/request/interactionRequest.d.ts.map +1 -0
  133. package/dist/request/interactionRequest.js +46 -0
  134. package/dist/request/interactionRequest.js.map +1 -0
  135. package/dist/request/interactionUrl.d.ts +3 -14
  136. package/dist/request/interactionUrl.d.ts.map +1 -1
  137. package/dist/request/interactionUrl.js +24 -3
  138. package/dist/request/interactionUrl.js.map +1 -1
  139. package/dist/request/parse.d.ts +0 -10
  140. package/dist/request/parse.d.ts.map +1 -1
  141. package/dist/request/parse.js +15 -1
  142. package/dist/request/parse.js.map +1 -1
  143. package/dist/request/processRequest.d.ts.map +1 -1
  144. package/dist/request/processRequest.js +2 -1
  145. package/dist/request/processRequest.js.map +1 -1
  146. package/dist/request/types.d.ts +23 -2
  147. package/dist/request/types.d.ts.map +1 -1
  148. package/dist/resourceLog/controller.d.ts +48 -49
  149. package/dist/resourceLog/controller.d.ts.map +1 -1
  150. package/dist/resourceLog/controller.js +41 -20
  151. package/dist/resourceLog/controller.js.map +1 -1
  152. package/dist/resourceLog/errors.d.ts +12 -78
  153. package/dist/resourceLog/errors.d.ts.map +1 -1
  154. package/dist/resourceLog/errors.js +12 -79
  155. package/dist/resourceLog/errors.js.map +1 -1
  156. package/dist/resourceLog/index.d.ts +17 -22
  157. package/dist/resourceLog/index.d.ts.map +1 -1
  158. package/dist/resourceLog/index.js +16 -21
  159. package/dist/resourceLog/index.js.map +1 -1
  160. package/dist/resourceLog/license.d.ts +42 -27
  161. package/dist/resourceLog/license.d.ts.map +1 -1
  162. package/dist/resourceLog/license.js +53 -30
  163. package/dist/resourceLog/license.js.map +1 -1
  164. package/dist/space/activity.d.ts +48 -1
  165. package/dist/space/activity.d.ts.map +1 -1
  166. package/dist/space/activity.js +52 -4
  167. package/dist/space/activity.js.map +1 -1
  168. package/dist/space/index.d.ts +1 -1
  169. package/dist/space/index.d.ts.map +1 -1
  170. package/dist/space/index.js +1 -1
  171. package/dist/space/index.js.map +1 -1
  172. package/dist/sync/pull.d.ts +0 -22
  173. package/dist/sync/pull.d.ts.map +1 -1
  174. package/dist/sync/pull.js +30 -2
  175. package/dist/sync/pull.js.map +1 -1
  176. package/dist/unlock/index.d.ts +7 -7
  177. package/dist/unlock/index.d.ts.map +1 -1
  178. package/dist/unlock/index.js +6 -6
  179. package/dist/unlock/index.js.map +1 -1
  180. package/dist/unlock/retire.d.ts +29 -28
  181. package/dist/unlock/retire.d.ts.map +1 -1
  182. package/dist/unlock/retire.js +25 -16
  183. package/dist/unlock/retire.js.map +1 -1
  184. package/dist/unlock/standingClient.d.ts +1 -1
  185. package/dist/unlock/standingClient.js +3 -3
  186. package/dist/unlock/standingWebvh.d.ts +28 -10
  187. package/dist/unlock/standingWebvh.d.ts.map +1 -1
  188. package/dist/unlock/standingWebvh.js +75 -37
  189. package/dist/unlock/standingWebvh.js.map +1 -1
  190. package/dist/unlock/unlockRecord.d.ts +37 -0
  191. package/dist/unlock/unlockRecord.d.ts.map +1 -1
  192. package/dist/unlock/unlockRecord.js +54 -1
  193. package/dist/unlock/unlockRecord.js.map +1 -1
  194. package/dist/webvh/delegatedLogStore.d.ts +2 -2
  195. package/dist/webvh/delegatedLogStore.js +2 -2
  196. package/dist/webvh/didWeb.js +1 -1
  197. package/dist/webvh/didWeb.js.map +1 -1
  198. package/dist/webvh/didWebvh.d.ts +33 -3
  199. package/dist/webvh/didWebvh.d.ts.map +1 -1
  200. package/dist/webvh/didWebvh.js +40 -11
  201. package/dist/webvh/didWebvh.js.map +1 -1
  202. package/dist/webvh/index.d.ts +1 -1
  203. package/dist/webvh/index.d.ts.map +1 -1
  204. package/dist/webvh/index.js +1 -1
  205. package/dist/webvh/index.js.map +1 -1
  206. package/dist/webvh/listClients.js +1 -1
  207. package/dist/webvh/listClients.js.map +1 -1
  208. package/dist/webvh/verifyLog.d.ts +1 -1
  209. package/dist/webvh/verifyLog.d.ts.map +1 -1
  210. package/dist/webvh/verifyLog.js +1 -2
  211. package/dist/webvh/verifyLog.js.map +1 -1
  212. package/package.json +9 -11
  213. package/dist/display/alignment.d.ts +0 -55
  214. package/dist/display/alignment.d.ts.map +0 -1
  215. package/dist/display/alignment.js +0 -117
  216. package/dist/display/alignment.js.map +0 -1
  217. package/dist/display/credentialName.d.ts +0 -42
  218. package/dist/display/credentialName.d.ts.map +0 -1
  219. package/dist/display/credentialName.js +0 -106
  220. package/dist/display/credentialName.js.map +0 -1
  221. package/dist/display/displayFields.d.ts +0 -59
  222. package/dist/display/displayFields.d.ts.map +0 -1
  223. package/dist/display/displayFields.js +0 -136
  224. package/dist/display/displayFields.js.map +0 -1
  225. package/dist/display/evidence.d.ts +0 -50
  226. package/dist/display/evidence.d.ts.map +0 -1
  227. package/dist/display/evidence.js +0 -67
  228. package/dist/display/evidence.js.map +0 -1
  229. package/dist/display/image.d.ts +0 -18
  230. package/dist/display/image.d.ts.map +0 -1
  231. package/dist/display/image.js +0 -23
  232. package/dist/display/image.js.map +0 -1
  233. package/dist/display/index.d.ts +0 -38
  234. package/dist/display/index.d.ts.map +0 -1
  235. package/dist/display/index.js +0 -32
  236. package/dist/display/index.js.map +0 -1
  237. package/dist/display/issuer.d.ts +0 -105
  238. package/dist/display/issuer.d.ts.map +0 -1
  239. package/dist/display/issuer.js +0 -126
  240. package/dist/display/issuer.js.map +0 -1
  241. package/dist/display/obv3.d.ts +0 -82
  242. package/dist/display/obv3.d.ts.map +0 -1
  243. package/dist/display/obv3.js +0 -117
  244. package/dist/display/obv3.js.map +0 -1
  245. package/dist/display/parse.d.ts +0 -66
  246. package/dist/display/parse.d.ts.map +0 -1
  247. package/dist/display/parse.js +0 -104
  248. package/dist/display/parse.js.map +0 -1
  249. package/dist/display/subject.d.ts +0 -79
  250. package/dist/display/subject.d.ts.map +0 -1
  251. package/dist/display/subject.js +0 -124
  252. package/dist/display/subject.js.map +0 -1
  253. package/dist/display/text.d.ts +0 -53
  254. package/dist/display/text.d.ts.map +0 -1
  255. package/dist/display/text.js +0 -78
  256. package/dist/display/text.js.map +0 -1
  257. package/dist/display/types.d.ts +0 -55
  258. package/dist/display/types.d.ts.map +0 -1
  259. package/dist/display/types.js +0 -41
  260. package/dist/display/types.js.map +0 -1
  261. package/dist/display/validity.d.ts +0 -51
  262. package/dist/display/validity.d.ts.map +0 -1
  263. package/dist/display/validity.js +0 -51
  264. package/dist/display/validity.js.map +0 -1
  265. package/dist/display/verificationView.d.ts +0 -115
  266. package/dist/display/verificationView.d.ts.map +0 -1
  267. package/dist/display/verificationView.js +0 -199
  268. package/dist/display/verificationView.js.map +0 -1
  269. package/dist/resourceLog/append.d.ts +0 -112
  270. package/dist/resourceLog/append.d.ts.map +0 -1
  271. package/dist/resourceLog/append.js +0 -197
  272. package/dist/resourceLog/append.js.map +0 -1
  273. package/dist/resourceLog/entry.d.ts +0 -68
  274. package/dist/resourceLog/entry.d.ts.map +0 -1
  275. package/dist/resourceLog/entry.js +0 -167
  276. package/dist/resourceLog/entry.js.map +0 -1
  277. package/dist/resourceLog/pin.d.ts +0 -82
  278. package/dist/resourceLog/pin.d.ts.map +0 -1
  279. package/dist/resourceLog/pin.js +0 -57
  280. package/dist/resourceLog/pin.js.map +0 -1
  281. package/dist/resourceLog/seal.d.ts +0 -97
  282. package/dist/resourceLog/seal.d.ts.map +0 -1
  283. package/dist/resourceLog/seal.js +0 -113
  284. package/dist/resourceLog/seal.js.map +0 -1
  285. package/dist/resourceLog/verify.d.ts +0 -96
  286. package/dist/resourceLog/verify.d.ts.map +0 -1
  287. package/dist/resourceLog/verify.js +0 -474
  288. package/dist/resourceLog/verify.js.map +0 -1
  289. package/dist/resourceLog/vmFragment.d.ts +0 -33
  290. package/dist/resourceLog/vmFragment.d.ts.map +0 -1
  291. package/dist/resourceLog/vmFragment.js +0 -39
  292. package/dist/resourceLog/vmFragment.js.map +0 -1
@@ -1,79 +0,0 @@
1
- /*!
2
- * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
- */
4
- /**
5
- * Credential-subject readers: pulling the (first) subject out of a VC, deriving
6
- * the recipient display name, and projecting the OBv3-flavored subject render
7
- * fields.
8
- *
9
- * Drift resolution:
10
- * - `getSubject` was identical in both apps -- take either.
11
- * - Recipient-name resolution DIVERGED. Freewallet's `extractIssuedTo` +
12
- * `resolvePersonFullName` win as the vc-level recipient resolver: they walk a
13
- * deeper person/contact structure (`person.contact.fullName`, string
14
- * `person.name`, `person.name.formattedName` / `.name`, `subject.name`) and
15
- * guard the OBv3 identifier on `identityType === 'name'` (more correct than
16
- * DCW's "any identityHash").
17
- * - `credentialSubjectRenderInfo` keeps DCW's subject-level shape and field set
18
- * (used by the OBv3 card renderer) but returns RAW `startDate` / `endDate`
19
- * ISO strings instead of moment-formatted `startDateFmt` / `endDateFmt` (the
20
- * raw-values seam); each app re-applies its own date formatting.
21
- */
22
- import type { IAlignment, ICredentialSubject, IVerifiableCredential } from '@interop/data-integrity-core';
23
- /**
24
- * The subject render fields for the credential detail / card view. All dates
25
- * are RAW ISO strings; the app formats them.
26
- */
27
- export interface SubjectRenderInfo {
28
- subjectName: string | null;
29
- issuedTo: string | null;
30
- degreeName: string | null;
31
- description: string | null;
32
- criteria: string | null;
33
- numberOfCredits: string | null;
34
- startDate: string | null;
35
- endDate: string | null;
36
- achievementImage: string | null;
37
- achievementType: string | null;
38
- alignment: IAlignment[] | undefined;
39
- }
40
- /**
41
- * The (first) credential subject. Partially supports VCs with multiple
42
- * `credentialSubject` entries by picking the first one.
43
- *
44
- * @param vc {IVerifiableCredential}
45
- * @returns {ICredentialSubject}
46
- */
47
- export declare function getSubject(vc: IVerifiableCredential): ICredentialSubject;
48
- /**
49
- * Resolves a display name from a subject's person / contact structure, in
50
- * order: `person.contact.fullName`, a string `person.name`, an object
51
- * `person.name.formattedName`, `person.name.name`, then `subject.name`.
52
- * Returns `''` when none is present.
53
- *
54
- * @param subject {Record<string, unknown>}
55
- * @returns {string}
56
- */
57
- export declare function resolvePersonFullName(subject: Record<string, unknown>): string;
58
- /**
59
- * The recipient name a credential was issued to: the resolved person full name,
60
- * else a name-typed OBv3 `identifier` hash, else the top-level credential
61
- * `name`. Returns `''` when nothing resolves.
62
- *
63
- * @param verifiableCredential {IVerifiableCredential}
64
- * @returns {string}
65
- */
66
- export declare function extractIssuedTo(verifiableCredential: IVerifiableCredential): string;
67
- /**
68
- * Projects a credential subject to the render fields used by the OBv3 card /
69
- * detail view. Dates are RAW ISO strings (see {@link SubjectRenderInfo}).
70
- *
71
- * Every field is read through a shape guard: a missing, primitive, or
72
- * array-shaped subject (and a `degree` / `achievement` of any shape) renders
73
- * the all-null fallback instead of throwing.
74
- *
75
- * @param credentialSubject {ICredentialSubject}
76
- * @returns {SubjectRenderInfo}
77
- */
78
- export declare function credentialSubjectRenderInfo(credentialSubject: ICredentialSubject): SubjectRenderInfo;
79
- //# sourceMappingURL=subject.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subject.d.ts","sourceRoot":"","sources":["../../src/display/subject.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAEV,UAAU,EACV,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,8BAA8B,CAAA;AAKrC;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,SAAS,EAAE,UAAU,EAAE,GAAG,SAAS,CAAA;CACpC;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,qBAAqB,GAAG,kBAAkB,CAMxE;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,MAAM,CA4BR;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,oBAAoB,EAAE,qBAAqB,GAC1C,MAAM,CAyBR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACzC,iBAAiB,EAAE,kBAAkB,GACpC,iBAAiB,CA+CnB"}
@@ -1,124 +0,0 @@
1
- import { extractNameFromOBV3Identifier } from './obv3.js';
2
- import { imageSourceFrom } from './image.js';
3
- import { asRecord, getTrimmedString, recordList } from './text.js';
4
- /**
5
- * The (first) credential subject. Partially supports VCs with multiple
6
- * `credentialSubject` entries by picking the first one.
7
- *
8
- * @param vc {IVerifiableCredential}
9
- * @returns {ICredentialSubject}
10
- */
11
- export function getSubject(vc) {
12
- const { credentialSubject } = vc;
13
- if (Array.isArray(credentialSubject)) {
14
- return credentialSubject[0];
15
- }
16
- return credentialSubject;
17
- }
18
- /**
19
- * Resolves a display name from a subject's person / contact structure, in
20
- * order: `person.contact.fullName`, a string `person.name`, an object
21
- * `person.name.formattedName`, `person.name.name`, then `subject.name`.
22
- * Returns `''` when none is present.
23
- *
24
- * @param subject {Record<string, unknown>}
25
- * @returns {string}
26
- */
27
- export function resolvePersonFullName(subject) {
28
- const person = asRecord(subject.person);
29
- const contact = asRecord(person?.contact);
30
- const contactFullName = getTrimmedString(contact?.fullName);
31
- if (contactFullName) {
32
- return contactFullName;
33
- }
34
- const personName = getTrimmedString(person?.name);
35
- if (personName) {
36
- return personName;
37
- }
38
- const personNameRecord = asRecord(person?.name);
39
- if (personNameRecord) {
40
- const formattedName = getTrimmedString(personNameRecord.formattedName);
41
- if (formattedName) {
42
- return formattedName;
43
- }
44
- const fallbackPersonName = getTrimmedString(personNameRecord.name);
45
- if (fallbackPersonName) {
46
- return fallbackPersonName;
47
- }
48
- }
49
- return getTrimmedString(subject.name);
50
- }
51
- /**
52
- * The recipient name a credential was issued to: the resolved person full name,
53
- * else a name-typed OBv3 `identifier` hash, else the top-level credential
54
- * `name`. Returns `''` when nothing resolves.
55
- *
56
- * @param verifiableCredential {IVerifiableCredential}
57
- * @returns {string}
58
- */
59
- export function extractIssuedTo(verifiableCredential) {
60
- const subject = asRecord(getSubject(verifiableCredential));
61
- if (!subject) {
62
- return getTrimmedString(verifiableCredential.name);
63
- }
64
- const resolvedName = resolvePersonFullName(subject);
65
- if (resolvedName) {
66
- return resolvedName;
67
- }
68
- if (Array.isArray(subject.identifier)) {
69
- const nameEntry = subject.identifier.find((identifier) => identifier?.identityType === 'name' || identifier?.type === 'name');
70
- if (nameEntry?.identityHash) {
71
- return nameEntry.identityHash;
72
- }
73
- }
74
- return getTrimmedString(verifiableCredential.name);
75
- }
76
- /**
77
- * Projects a credential subject to the render fields used by the OBv3 card /
78
- * detail view. Dates are RAW ISO strings (see {@link SubjectRenderInfo}).
79
- *
80
- * Every field is read through a shape guard: a missing, primitive, or
81
- * array-shaped subject (and a `degree` / `achievement` of any shape) renders
82
- * the all-null fallback instead of throwing.
83
- *
84
- * @param credentialSubject {ICredentialSubject}
85
- * @returns {SubjectRenderInfo}
86
- */
87
- export function credentialSubjectRenderInfo(credentialSubject) {
88
- const subject = (asRecord(credentialSubject) ?? {});
89
- // SkillClaimCredential: person.name is the subject name.
90
- const personName = subject?.person?.name;
91
- const personNameStr = typeof personName === 'string' && personName.trim()
92
- ? personName.trim()
93
- : null;
94
- const identityHashName = extractNameFromOBV3Identifier(subject) ?? null;
95
- // Used in non-OBv3 components.
96
- const subjectName = personNameStr ?? subject?.name ?? identityHashName ?? null;
97
- // Used in OBv3 components -- prioritize the identityHash over subject.name.
98
- const issuedTo = personNameStr ?? identityHashName ?? subject?.name ?? null;
99
- const degreeName = asRecord(subject.degree)?.name ?? null;
100
- const [achievement] = recordList(subject.achievement);
101
- const description = achievement?.description ?? null;
102
- const criteria = achievement?.criteria?.narrative ?? null;
103
- const numberOfCredits = achievement?.awardedOnCompletionOf?.numberOfCredits?.value ?? null;
104
- const achievementImage = imageSourceFrom(achievement?.image);
105
- const achievementType = achievement?.achievementType
106
- ? achievement.achievementType
107
- : null;
108
- const alignment = achievement?.alignment;
109
- const { startDate = null, endDate = null } = achievement?.awardedOnCompletionOf || {};
110
- return {
111
- subjectName,
112
- issuedTo,
113
- degreeName,
114
- description,
115
- criteria,
116
- numberOfCredits,
117
- startDate,
118
- endDate,
119
- achievementImage,
120
- achievementType,
121
- alignment
122
- };
123
- }
124
- //# sourceMappingURL=subject.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subject.js","sourceRoot":"","sources":["../../src/display/subject.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,6BAA6B,E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Copyright (c) 2026 Interop Alliance. All rights reserved.
3
- */
4
- /**
5
- * Small string / record coercion helpers shared by the display derivation
6
- * functions. These read the loosely-typed fields of a decoded Verifiable
7
- * Credential without importing any UI or formatting library.
8
- *
9
- * Drift resolution: two apps had two slightly different "coerce to a usable
10
- * string" helpers. DCW's `asNonEmptyString` (stringifies any value, trims,
11
- * returns `null` when empty) and Freewallet's `getTrimmedString` (only accepts
12
- * an actual string, returns `''` when not). Both are kept verbatim because
13
- * their callers depend on the different empty conventions (`null` vs `''`).
14
- * `asRecord` is Freewallet's object narrower.
15
- */
16
- /**
17
- * Coerces an arbitrary value to a trimmed, non-empty string, or `null`. Any
18
- * non-string value is stringified first (so a number `3` becomes `'3'`).
19
- * `null` / `undefined` and whitespace-only values yield `null`.
20
- *
21
- * @param value {unknown}
22
- * @returns {string | null}
23
- */
24
- export declare function asNonEmptyString(value: unknown): string | null;
25
- /**
26
- * Returns the trimmed value when it is a string, else the empty string. Unlike
27
- * {@link asNonEmptyString} this never stringifies a non-string value.
28
- *
29
- * @param value {unknown}
30
- * @returns {string}
31
- */
32
- export declare function getTrimmedString(value: unknown): string;
33
- /**
34
- * Narrows an arbitrary value to a plain record (`Record<string, unknown>`), or
35
- * `undefined` when it is null / a primitive / an array is acceptable here since
36
- * arrays are objects too and callers pass only object-shaped subjects.
37
- *
38
- * @param value {unknown}
39
- * @returns {Record<string, unknown> | undefined}
40
- */
41
- export declare function asRecord(value: unknown): Record<string, unknown> | undefined;
42
- /**
43
- * Normalizes a loosely-typed JSON-LD field to an array of plain records: a
44
- * single object is wrapped, an array is filtered down to its object entries
45
- * (dropping `null`s and primitives), and anything else yields `[]`. Lets the
46
- * display derivations iterate attacker-supplied credential fields without
47
- * dereferencing a non-object.
48
- *
49
- * @param value {unknown}
50
- * @returns {Record<string, unknown>[]}
51
- */
52
- export declare function recordList(value: unknown): Record<string, unknown>[];
53
- //# sourceMappingURL=text.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/display/text.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;GAWG;AAEH;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAU9D;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAKvD;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAK5E;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAKpE"}
@@ -1,78 +0,0 @@
1
- /*!
2
- * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
- */
4
- /**
5
- * Small string / record coercion helpers shared by the display derivation
6
- * functions. These read the loosely-typed fields of a decoded Verifiable
7
- * Credential without importing any UI or formatting library.
8
- *
9
- * Drift resolution: two apps had two slightly different "coerce to a usable
10
- * string" helpers. DCW's `asNonEmptyString` (stringifies any value, trims,
11
- * returns `null` when empty) and Freewallet's `getTrimmedString` (only accepts
12
- * an actual string, returns `''` when not). Both are kept verbatim because
13
- * their callers depend on the different empty conventions (`null` vs `''`).
14
- * `asRecord` is Freewallet's object narrower.
15
- */
16
- /**
17
- * Coerces an arbitrary value to a trimmed, non-empty string, or `null`. Any
18
- * non-string value is stringified first (so a number `3` becomes `'3'`).
19
- * `null` / `undefined` and whitespace-only values yield `null`.
20
- *
21
- * @param value {unknown}
22
- * @returns {string | null}
23
- */
24
- export function asNonEmptyString(value) {
25
- if (value === null || value === undefined) {
26
- return null;
27
- }
28
- if (typeof value === 'string') {
29
- const trimmed = value.trim();
30
- return trimmed.length ? trimmed : null;
31
- }
32
- const trimmed = `${value}`.trim();
33
- return trimmed.length ? trimmed : null;
34
- }
35
- /**
36
- * Returns the trimmed value when it is a string, else the empty string. Unlike
37
- * {@link asNonEmptyString} this never stringifies a non-string value.
38
- *
39
- * @param value {unknown}
40
- * @returns {string}
41
- */
42
- export function getTrimmedString(value) {
43
- if (typeof value !== 'string') {
44
- return '';
45
- }
46
- return value.trim();
47
- }
48
- /**
49
- * Narrows an arbitrary value to a plain record (`Record<string, unknown>`), or
50
- * `undefined` when it is null / a primitive / an array is acceptable here since
51
- * arrays are objects too and callers pass only object-shaped subjects.
52
- *
53
- * @param value {unknown}
54
- * @returns {Record<string, unknown> | undefined}
55
- */
56
- export function asRecord(value) {
57
- if (!value || typeof value !== 'object') {
58
- return undefined;
59
- }
60
- return value;
61
- }
62
- /**
63
- * Normalizes a loosely-typed JSON-LD field to an array of plain records: a
64
- * single object is wrapped, an array is filtered down to its object entries
65
- * (dropping `null`s and primitives), and anything else yields `[]`. Lets the
66
- * display derivations iterate attacker-supplied credential fields without
67
- * dereferencing a non-object.
68
- *
69
- * @param value {unknown}
70
- * @returns {Record<string, unknown>[]}
71
- */
72
- export function recordList(value) {
73
- const entries = Array.isArray(value) ? value : [value];
74
- return entries
75
- .map(entry => asRecord(entry))
76
- .filter((entry) => entry !== undefined);
77
- }
78
- //# sourceMappingURL=text.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/display/text.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;GAWG;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QAC1C,OAAO,IAAI,CAAA;IACb,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAA;QAC5B,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAA;IACxC,CAAC;IACD,MAAM,OAAO,GAAG,GAAG,KAAK,EAAE,CAAC,IAAI,EAAE,CAAA;IACjC,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAA;AACxC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,EAAE,CAAA;IACX,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,EAAE,CAAA;AACrB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,OAAO,KAAgC,CAAA;AACzC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;IACtD,OAAO,OAAO;SACX,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SAC7B,MAAM,CAAC,CAAC,KAAK,EAAoC,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAA;AAC7E,CAAC"}
@@ -1,55 +0,0 @@
1
- /*!
2
- * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
- */
4
- /**
5
- * Credential type predicates.
6
- *
7
- * Drift resolution: DCW and Freewallet disagreed on the resume check -- DCW's
8
- * took a `credentialSubject` and did a case-insensitive SUBSTRING match on its
9
- * `type`, while Freewallet's took the whole VC and did an exact
10
- * `subject.type === 'Resume'`; and DCW's own callers passed the whole VC to the
11
- * subject-typed function. Rather than pick one, TWO clearly-named functions are
12
- * exposed:
13
- *
14
- * - `isResumeCredentialSubject(subject)` -- DCW's case-insensitive substring
15
- * check over a subject's `type`.
16
- * - `isResumeCredential(vc)` -- a vc-typed entry point that reads the subject's
17
- * `type` off the VC and applies the same substring check, fixing both
18
- * Freewallet's exact-match miss (`['...','Resume']`) and DCW's callers that
19
- * passed a VC to a subject-typed function.
20
- *
21
- * `isEmploymentCredential` / `isVolunteerCredential` are DCW's, verbatim, over
22
- * the VC's top-level `type`.
23
- */
24
- import type { ICredentialSubject, IVerifiableCredential } from '@interop/data-integrity-core';
25
- /**
26
- * Whether a credential SUBJECT is a resume, by a case-insensitive substring
27
- * match (`'resume'`) over its `type` (string or array).
28
- *
29
- * @param credentialSubject {ICredentialSubject}
30
- * @returns {boolean}
31
- */
32
- export declare function isResumeCredentialSubject(credentialSubject: ICredentialSubject): boolean;
33
- /**
34
- * Whether a CREDENTIAL is a resume, by applying the subject-level substring
35
- * check to the VC's (first) subject `type`.
36
- *
37
- * @param vc {IVerifiableCredential}
38
- * @returns {boolean}
39
- */
40
- export declare function isResumeCredential(vc: IVerifiableCredential): boolean;
41
- /**
42
- * Whether a credential's top-level `type` includes `'EmploymentCredential'`.
43
- *
44
- * @param credential {IVerifiableCredential}
45
- * @returns {boolean}
46
- */
47
- export declare function isEmploymentCredential(credential: IVerifiableCredential): boolean;
48
- /**
49
- * Whether a credential's top-level `type` includes `'VolunteeringCredential'`.
50
- *
51
- * @param credential {IVerifiableCredential}
52
- * @returns {boolean}
53
- */
54
- export declare function isVolunteerCredential(credential: IVerifiableCredential): boolean;
55
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/display/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,8BAA8B,CAAA;AAIrC;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,iBAAiB,EAAE,kBAAkB,GACpC,OAAO,CAIT;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,qBAAqB,GAAG,OAAO,CAErE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAET;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAET"}
@@ -1,41 +0,0 @@
1
- import { typeArray } from '@interop/data-integrity-core/guards';
2
- import { getSubject } from './subject.js';
3
- /**
4
- * Whether a credential SUBJECT is a resume, by a case-insensitive substring
5
- * match (`'resume'`) over its `type` (string or array).
6
- *
7
- * @param credentialSubject {ICredentialSubject}
8
- * @returns {boolean}
9
- */
10
- export function isResumeCredentialSubject(credentialSubject) {
11
- return typeArray(credentialSubject?.type).some(type => type.toLowerCase().includes('resume'));
12
- }
13
- /**
14
- * Whether a CREDENTIAL is a resume, by applying the subject-level substring
15
- * check to the VC's (first) subject `type`.
16
- *
17
- * @param vc {IVerifiableCredential}
18
- * @returns {boolean}
19
- */
20
- export function isResumeCredential(vc) {
21
- return isResumeCredentialSubject(getSubject(vc));
22
- }
23
- /**
24
- * Whether a credential's top-level `type` includes `'EmploymentCredential'`.
25
- *
26
- * @param credential {IVerifiableCredential}
27
- * @returns {boolean}
28
- */
29
- export function isEmploymentCredential(credential) {
30
- return typeArray(credential?.type).includes('EmploymentCredential');
31
- }
32
- /**
33
- * Whether a credential's top-level `type` includes `'VolunteeringCredential'`.
34
- *
35
- * @param credential {IVerifiableCredential}
36
- * @returns {boolean}
37
- */
38
- export function isVolunteerCredential(credential) {
39
- return typeArray(credential?.type).includes('VolunteeringCredential');
40
- }
41
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/display/types.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACvC,iBAAqC;IAErC,OAAO,SAAS,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACpD,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACtC,CAAA;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAyB;IAC1D,OAAO,yBAAyB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAA;AAClD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,UAAiC;IAEjC,OAAO,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAA;AACrE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,UAAiC;IAEjC,OAAO,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAA;AACvE,CAAC"}
@@ -1,51 +0,0 @@
1
- /*!
2
- * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
- */
4
- /**
5
- * Validity-period readers for both VC Data Model 1.0 (`issuanceDate` /
6
- * `expirationDate`) and 2.0 (`validFrom` / `validUntil`). The library returns
7
- * the raw ISO strings and a `Date` -- never a formatted string -- so each app
8
- * applies its own locale formatting on top (the raw-values seam).
9
- *
10
- * Drift resolution: this is the union of DCW's `credentialValidityPeriod.ts`
11
- * (which had `getIssuanceDate` / `getExpirationDate` / `isExpired` returning
12
- * `undefined` when absent) and Freewallet's `formatDate.ts` (which had
13
- * `getExpirationInstant` returning `Date | null`, plus an empty-string variant
14
- * of `getExpirationDate`). DCW's `undefined` convention wins for the string
15
- * getters; Freewallet's `''`-returning wrapper is trivially reproduced app-side
16
- * as `getExpirationDate(vc) ?? ''`.
17
- */
18
- import type { IVerifiableCredential } from '@interop/data-integrity-core';
19
- /**
20
- * The issuance instant as a raw ISO string: VC 2.0 `validFrom` preferred, else
21
- * VC 1.0 `issuanceDate`, else `undefined`.
22
- *
23
- * @param credential {IVerifiableCredential}
24
- * @returns {string | undefined}
25
- */
26
- export declare function getIssuanceDate(credential: IVerifiableCredential): string | undefined;
27
- /**
28
- * The expiration instant as a raw ISO string: VC 2.0 `validUntil` preferred,
29
- * else VC 1.0 `expirationDate`, else `undefined`.
30
- *
31
- * @param credential {IVerifiableCredential}
32
- * @returns {string | undefined}
33
- */
34
- export declare function getExpirationDate(credential: IVerifiableCredential): string | undefined;
35
- /**
36
- * The expiration instant as a `Date`, or `null` when there is no expiration or
37
- * it does not parse.
38
- *
39
- * @param credential {IVerifiableCredential}
40
- * @returns {Date | null}
41
- */
42
- export declare function getExpirationInstant(credential: IVerifiableCredential): Date | null;
43
- /**
44
- * Whether the credential has an expiration date that is already in the past.
45
- * A credential with no expiration is never expired.
46
- *
47
- * @param credential {IVerifiableCredential}
48
- * @returns {boolean}
49
- */
50
- export declare function isExpired(credential: IVerifiableCredential): boolean;
51
- //# sourceMappingURL=validity.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validity.d.ts","sourceRoot":"","sources":["../../src/display/validity.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AAEzE;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,qBAAqB,GAChC,MAAM,GAAG,SAAS,CAEpB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,qBAAqB,GAChC,MAAM,GAAG,SAAS,CAEpB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,qBAAqB,GAChC,IAAI,GAAG,IAAI,CAOb;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,qBAAqB,GAAG,OAAO,CAOpE"}
@@ -1,51 +0,0 @@
1
- /**
2
- * The issuance instant as a raw ISO string: VC 2.0 `validFrom` preferred, else
3
- * VC 1.0 `issuanceDate`, else `undefined`.
4
- *
5
- * @param credential {IVerifiableCredential}
6
- * @returns {string | undefined}
7
- */
8
- export function getIssuanceDate(credential) {
9
- return credential.validFrom ?? credential.issuanceDate;
10
- }
11
- /**
12
- * The expiration instant as a raw ISO string: VC 2.0 `validUntil` preferred,
13
- * else VC 1.0 `expirationDate`, else `undefined`.
14
- *
15
- * @param credential {IVerifiableCredential}
16
- * @returns {string | undefined}
17
- */
18
- export function getExpirationDate(credential) {
19
- return credential.validUntil ?? credential.expirationDate;
20
- }
21
- /**
22
- * The expiration instant as a `Date`, or `null` when there is no expiration or
23
- * it does not parse.
24
- *
25
- * @param credential {IVerifiableCredential}
26
- * @returns {Date | null}
27
- */
28
- export function getExpirationInstant(credential) {
29
- const iso = getExpirationDate(credential);
30
- if (!iso) {
31
- return null;
32
- }
33
- const date = new Date(iso);
34
- return Number.isNaN(date.getTime()) ? null : date;
35
- }
36
- /**
37
- * Whether the credential has an expiration date that is already in the past.
38
- * A credential with no expiration is never expired.
39
- *
40
- * @param credential {IVerifiableCredential}
41
- * @returns {boolean}
42
- */
43
- export function isExpired(credential) {
44
- const expiration = getExpirationDate(credential);
45
- if (!expiration) {
46
- return false;
47
- }
48
- const timestamp = Date.parse(String(expiration));
49
- return !Number.isNaN(timestamp) && timestamp < Date.now();
50
- }
51
- //# sourceMappingURL=validity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validity.js","sourceRoot":"","sources":["../../src/display/validity.ts"],"names":[],"mappings":"AAmBA;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,UAAiC;IAEjC,OAAO,UAAU,CAAC,SAAS,IAAI,UAAU,CAAC,YAAY,CAAA;AACxD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAC/B,UAAiC;IAEjC,OAAO,UAAU,CAAC,UAAU,IAAI,UAAU,CAAC,cAAc,CAAA;AAC3D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAAiC;IAEjC,MAAM,GAAG,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAA;IACzC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,IAAI,CAAA;IACb,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAA;IAC1B,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;AACnD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,UAAiC;IACzD,MAAM,UAAU,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAA;IAChD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,KAAK,CAAA;IACd,CAAC;IACD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAA;IAChD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;AAC3D,CAAC"}