@docknetwork/wallet-sdk-wasm 1.7.6 → 1.9.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 (327) hide show
  1. package/package.json +6 -7
  2. package/rollup.config.mjs +1 -0
  3. package/src/globals.d.ts +4 -1
  4. package/src/services/blockchain/cached-did-resolver.ts +4 -3
  5. package/src/services/blockchain/normalize-did-document.ts +73 -0
  6. package/src/services/blockchain/service.ts +0 -2
  7. package/src/services/credential/bbs-revocation.test.js +147 -0
  8. package/src/services/credential/bbs-revocation.ts +65 -18
  9. package/src/services/credential/config.ts +7 -0
  10. package/src/services/credential/index.test.js +261 -17
  11. package/src/services/credential/oid4vci.js +44 -0
  12. package/src/services/credential/oid4vci.test.js +162 -0
  13. package/src/services/credential/pex-helpers.js +77 -31
  14. package/src/services/credential/pex-helpers.test.js +4 -4
  15. package/src/services/credential/sd-jwt.ts +41 -5
  16. package/src/services/credential/service-rpc.js +6 -0
  17. package/src/services/credential/service.ts +171 -16
  18. package/src/services/credential/utils.js +3 -5
  19. package/src/services/delegation/index.android.js +3 -0
  20. package/src/services/delegation/index.ios.js +3 -0
  21. package/src/services/delegation/index.ts +1 -0
  22. package/src/services/delegation/service-rpc.ts +21 -0
  23. package/src/services/delegation/service.ts +59 -0
  24. package/src/services/edv/service-rpc.js +18 -2
  25. package/src/services/edv/service.test.js +327 -0
  26. package/src/services/edv/service.ts +103 -13
  27. package/src/services/index.js +2 -0
  28. package/src/wallet/rpc-storage-interface.js +9 -4
  29. package/lib/core/crypto.js +0 -45
  30. package/lib/core/crypto.mjs +0 -33
  31. package/lib/core/format-utils.js +0 -51
  32. package/lib/core/format-utils.mjs +0 -42
  33. package/lib/core/keychain.js +0 -61
  34. package/lib/core/keychain.mjs +0 -37
  35. package/lib/core/logger.js +0 -13
  36. package/lib/core/logger.mjs +0 -9
  37. package/lib/core/storage.js +0 -14
  38. package/lib/core/storage.mjs +0 -9
  39. package/lib/core/validation.js +0 -29
  40. package/lib/core/validation.mjs +0 -16
  41. package/lib/core/webview-logger.js +0 -49
  42. package/lib/core/webview-logger.mjs +0 -41
  43. package/lib/errors.js +0 -17
  44. package/lib/errors.mjs +0 -12
  45. package/lib/events.js +0 -18
  46. package/lib/events.mjs +0 -13
  47. package/lib/index.js +0 -146
  48. package/lib/index.mjs +0 -144
  49. package/lib/logger.js +0 -22
  50. package/lib/logger.mjs +0 -17
  51. package/lib/modules/event-manager.js +0 -46
  52. package/lib/modules/event-manager.mjs +0 -37
  53. package/lib/modules/network-manager.js +0 -80
  54. package/lib/modules/network-manager.mjs +0 -71
  55. package/lib/mrklt.js +0 -2
  56. package/lib/mrklt.mjs +0 -1
  57. package/lib/rpc-client.js +0 -83
  58. package/lib/rpc-client.mjs +0 -73
  59. package/lib/rpc-server.js +0 -97
  60. package/lib/rpc-server.mjs +0 -95
  61. package/lib/rpc-util.js +0 -113
  62. package/lib/rpc-util.mjs +0 -103
  63. package/lib/sandbox-rpc-server.js +0 -28
  64. package/lib/sandbox-rpc-server.mjs +0 -26
  65. package/lib/sandbox.js +0 -102
  66. package/lib/sandbox.mjs +0 -100
  67. package/lib/services/blockchain/cached-did-resolver.js +0 -113
  68. package/lib/services/blockchain/cached-did-resolver.mjs +0 -109
  69. package/lib/services/blockchain/configs.js +0 -7
  70. package/lib/services/blockchain/configs.mjs +0 -3
  71. package/lib/services/blockchain/index.android.js +0 -18
  72. package/lib/services/blockchain/index.android.mjs +0 -14
  73. package/lib/services/blockchain/index.ios.js +0 -18
  74. package/lib/services/blockchain/index.ios.mjs +0 -14
  75. package/lib/services/blockchain/index.js +0 -36
  76. package/lib/services/blockchain/index.mjs +0 -28
  77. package/lib/services/blockchain/service-rpc.js +0 -72
  78. package/lib/services/blockchain/service-rpc.mjs +0 -68
  79. package/lib/services/blockchain/service.js +0 -312
  80. package/lib/services/blockchain/service.mjs +0 -306
  81. package/lib/services/credential/bbs-revocation.js +0 -92
  82. package/lib/services/credential/bbs-revocation.mjs +0 -87
  83. package/lib/services/credential/bound-check.js +0 -77
  84. package/lib/services/credential/bound-check.mjs +0 -64
  85. package/lib/services/credential/config.js +0 -56
  86. package/lib/services/credential/config.mjs +0 -47
  87. package/lib/services/credential/delegatable-credentials.js +0 -300
  88. package/lib/services/credential/delegatable-credentials.mjs +0 -263
  89. package/lib/services/credential/index.android.js +0 -19
  90. package/lib/services/credential/index.android.mjs +0 -15
  91. package/lib/services/credential/index.ios.js +0 -19
  92. package/lib/services/credential/index.ios.mjs +0 -15
  93. package/lib/services/credential/index.js +0 -106
  94. package/lib/services/credential/index.mjs +0 -67
  95. package/lib/services/credential/pex-helpers.js +0 -333
  96. package/lib/services/credential/pex-helpers.mjs +0 -319
  97. package/lib/services/credential/range-proofs-example.js +0 -107
  98. package/lib/services/credential/range-proofs-example.mjs +0 -103
  99. package/lib/services/credential/sd-jwt.js +0 -214
  100. package/lib/services/credential/sd-jwt.mjs +0 -200
  101. package/lib/services/credential/service-rpc.js +0 -61
  102. package/lib/services/credential/service-rpc.mjs +0 -57
  103. package/lib/services/credential/service.js +0 -683
  104. package/lib/services/credential/service.mjs +0 -672
  105. package/lib/services/credential/utils.js +0 -103
  106. package/lib/services/credential/utils.mjs +0 -78
  107. package/lib/services/dids/config.js +0 -40
  108. package/lib/services/dids/config.mjs +0 -31
  109. package/lib/services/dids/index.android.js +0 -19
  110. package/lib/services/dids/index.android.mjs +0 -15
  111. package/lib/services/dids/index.ios.js +0 -19
  112. package/lib/services/dids/index.ios.mjs +0 -15
  113. package/lib/services/dids/index.js +0 -23
  114. package/lib/services/dids/index.mjs +0 -19
  115. package/lib/services/dids/keypair-utils.js +0 -142
  116. package/lib/services/dids/keypair-utils.mjs +0 -113
  117. package/lib/services/dids/service-rpc.js +0 -37
  118. package/lib/services/dids/service-rpc.mjs +0 -33
  119. package/lib/services/dids/service.js +0 -100
  120. package/lib/services/dids/service.mjs +0 -92
  121. package/lib/services/edv/configs.js +0 -25
  122. package/lib/services/edv/configs.mjs +0 -16
  123. package/lib/services/edv/hmac.js +0 -88
  124. package/lib/services/edv/hmac.mjs +0 -63
  125. package/lib/services/edv/index.android.js +0 -19
  126. package/lib/services/edv/index.android.mjs +0 -15
  127. package/lib/services/edv/index.ios.js +0 -19
  128. package/lib/services/edv/index.ios.mjs +0 -15
  129. package/lib/services/edv/index.js +0 -32
  130. package/lib/services/edv/index.mjs +0 -24
  131. package/lib/services/edv/service-rpc.js +0 -78
  132. package/lib/services/edv/service-rpc.mjs +0 -74
  133. package/lib/services/edv/service.js +0 -370
  134. package/lib/services/edv/service.mjs +0 -357
  135. package/lib/services/index.js +0 -94
  136. package/lib/services/index.mjs +0 -92
  137. package/lib/services/pex/config.js +0 -29
  138. package/lib/services/pex/config.mjs +0 -20
  139. package/lib/services/pex/index.android.js +0 -19
  140. package/lib/services/pex/index.android.mjs +0 -15
  141. package/lib/services/pex/index.ios.js +0 -19
  142. package/lib/services/pex/index.ios.mjs +0 -15
  143. package/lib/services/pex/index.js +0 -12
  144. package/lib/services/pex/index.mjs +0 -4
  145. package/lib/services/pex/service-rpc.js +0 -39
  146. package/lib/services/pex/service-rpc.mjs +0 -35
  147. package/lib/services/pex/service.js +0 -91
  148. package/lib/services/pex/service.mjs +0 -86
  149. package/lib/services/pex/tests/jest.config.js +0 -25
  150. package/lib/services/pex/tests/jest.config.mjs +0 -23
  151. package/lib/services/relay-service/configs.js +0 -45
  152. package/lib/services/relay-service/configs.mjs +0 -36
  153. package/lib/services/relay-service/index.android.js +0 -21
  154. package/lib/services/relay-service/index.android.mjs +0 -17
  155. package/lib/services/relay-service/index.ios.js +0 -21
  156. package/lib/services/relay-service/index.ios.mjs +0 -17
  157. package/lib/services/relay-service/index.js +0 -14
  158. package/lib/services/relay-service/index.mjs +0 -6
  159. package/lib/services/relay-service/service-rpc.js +0 -47
  160. package/lib/services/relay-service/service-rpc.mjs +0 -43
  161. package/lib/services/relay-service/service.js +0 -181
  162. package/lib/services/relay-service/service.mjs +0 -173
  163. package/lib/services/rpc-service-client.js +0 -36
  164. package/lib/services/rpc-service-client.mjs +0 -28
  165. package/lib/services/sandbox.js +0 -10
  166. package/lib/services/sandbox.mjs +0 -8
  167. package/lib/services/storage/configs.js +0 -7
  168. package/lib/services/storage/configs.mjs +0 -3
  169. package/lib/services/storage/index.android.js +0 -18
  170. package/lib/services/storage/index.android.mjs +0 -14
  171. package/lib/services/storage/index.ios.js +0 -18
  172. package/lib/services/storage/index.ios.mjs +0 -14
  173. package/lib/services/storage/index.js +0 -26
  174. package/lib/services/storage/index.mjs +0 -24
  175. package/lib/services/storage/service-rpc.js +0 -37
  176. package/lib/services/storage/service-rpc.mjs +0 -33
  177. package/lib/services/storage/service.js +0 -32
  178. package/lib/services/storage/service.mjs +0 -27
  179. package/lib/services/test-utils.js +0 -98
  180. package/lib/services/test-utils.mjs +0 -84
  181. package/lib/services/util-crypto/configs.js +0 -23
  182. package/lib/services/util-crypto/configs.mjs +0 -15
  183. package/lib/services/util-crypto/index.android.js +0 -19
  184. package/lib/services/util-crypto/index.android.mjs +0 -15
  185. package/lib/services/util-crypto/index.ios.js +0 -19
  186. package/lib/services/util-crypto/index.ios.mjs +0 -15
  187. package/lib/services/util-crypto/index.js +0 -14
  188. package/lib/services/util-crypto/index.mjs +0 -6
  189. package/lib/services/util-crypto/service-rpc.js +0 -42
  190. package/lib/services/util-crypto/service-rpc.mjs +0 -38
  191. package/lib/services/util-crypto/service.js +0 -108
  192. package/lib/services/util-crypto/service.mjs +0 -83
  193. package/lib/services/wallet/configs.js +0 -32
  194. package/lib/services/wallet/configs.mjs +0 -23
  195. package/lib/services/wallet/index.android.js +0 -21
  196. package/lib/services/wallet/index.android.mjs +0 -17
  197. package/lib/services/wallet/index.ios.js +0 -21
  198. package/lib/services/wallet/index.ios.mjs +0 -17
  199. package/lib/services/wallet/index.js +0 -17
  200. package/lib/services/wallet/index.mjs +0 -9
  201. package/lib/services/wallet/service-rpc.js +0 -33
  202. package/lib/services/wallet/service-rpc.mjs +0 -29
  203. package/lib/services/wallet/service.js +0 -62
  204. package/lib/services/wallet/service.mjs +0 -57
  205. package/lib/setup-nodejs.js +0 -93
  206. package/lib/setup-nodejs.mjs +0 -91
  207. package/lib/setup-tests.js +0 -92
  208. package/lib/setup-tests.mjs +0 -90
  209. package/lib/src/core/crypto.d.ts +0 -8
  210. package/lib/src/core/crypto.d.ts.map +0 -1
  211. package/lib/src/core/format-utils.d.ts +0 -26
  212. package/lib/src/core/format-utils.d.ts.map +0 -1
  213. package/lib/src/core/logger.d.ts +0 -3
  214. package/lib/src/core/logger.d.ts.map +0 -1
  215. package/lib/src/core/storage.d.ts +0 -8
  216. package/lib/src/core/storage.d.ts.map +0 -1
  217. package/lib/src/core/validation.d.ts +0 -6
  218. package/lib/src/core/validation.d.ts.map +0 -1
  219. package/lib/src/errors.d.ts +0 -7
  220. package/lib/src/errors.d.ts.map +0 -1
  221. package/lib/src/logger.d.ts +0 -5
  222. package/lib/src/logger.d.ts.map +0 -1
  223. package/lib/src/modules/event-manager.d.ts +0 -12
  224. package/lib/src/modules/event-manager.d.ts.map +0 -1
  225. package/lib/src/modules/network-manager.d.ts +0 -32
  226. package/lib/src/modules/network-manager.d.ts.map +0 -1
  227. package/lib/src/rpc-client.d.ts +0 -4
  228. package/lib/src/rpc-client.d.ts.map +0 -1
  229. package/lib/src/rpc-util.d.ts +0 -11
  230. package/lib/src/rpc-util.d.ts.map +0 -1
  231. package/lib/src/services/blockchain/cached-did-resolver.d.ts +0 -28
  232. package/lib/src/services/blockchain/cached-did-resolver.d.ts.map +0 -1
  233. package/lib/src/services/blockchain/cached-did-resolver.test.d.ts +0 -2
  234. package/lib/src/services/blockchain/cached-did-resolver.test.d.ts.map +0 -1
  235. package/lib/src/services/blockchain/configs.d.ts +0 -7
  236. package/lib/src/services/blockchain/configs.d.ts.map +0 -1
  237. package/lib/src/services/blockchain/service.d.ts +0 -155
  238. package/lib/src/services/blockchain/service.d.ts.map +0 -1
  239. package/lib/src/services/credential/bbs-revocation.d.ts +0 -10
  240. package/lib/src/services/credential/bbs-revocation.d.ts.map +0 -1
  241. package/lib/src/services/credential/bound-check.d.ts +0 -61
  242. package/lib/src/services/credential/bound-check.d.ts.map +0 -1
  243. package/lib/src/services/credential/bound-check.test.d.ts +0 -2
  244. package/lib/src/services/credential/bound-check.test.d.ts.map +0 -1
  245. package/lib/src/services/credential/config.d.ts +0 -10
  246. package/lib/src/services/credential/config.d.ts.map +0 -1
  247. package/lib/src/services/credential/delegatable-credentials.d.ts +0 -272
  248. package/lib/src/services/credential/delegatable-credentials.d.ts.map +0 -1
  249. package/lib/src/services/credential/index.d.ts +0 -35
  250. package/lib/src/services/credential/index.d.ts.map +0 -1
  251. package/lib/src/services/credential/pex-helpers.d.ts +0 -23
  252. package/lib/src/services/credential/pex-helpers.d.ts.map +0 -1
  253. package/lib/src/services/credential/range-proofs-example.d.ts +0 -2
  254. package/lib/src/services/credential/range-proofs-example.d.ts.map +0 -1
  255. package/lib/src/services/credential/sd-jwt.test.d.ts +0 -2
  256. package/lib/src/services/credential/sd-jwt.test.d.ts.map +0 -1
  257. package/lib/src/services/credential/service.d.ts +0 -313
  258. package/lib/src/services/credential/service.d.ts.map +0 -1
  259. package/lib/src/services/credential/utils.d.ts +0 -3
  260. package/lib/src/services/credential/utils.d.ts.map +0 -1
  261. package/lib/src/services/dids/config.d.ts +0 -24
  262. package/lib/src/services/dids/config.d.ts.map +0 -1
  263. package/lib/src/services/dids/keypair-utils.d.ts +0 -15
  264. package/lib/src/services/dids/keypair-utils.d.ts.map +0 -1
  265. package/lib/src/services/dids/service-rpc.d.ts +0 -11
  266. package/lib/src/services/dids/service-rpc.d.ts.map +0 -1
  267. package/lib/src/services/dids/service.d.ts +0 -70
  268. package/lib/src/services/dids/service.d.ts.map +0 -1
  269. package/lib/src/services/edv/configs.d.ts +0 -12
  270. package/lib/src/services/edv/configs.d.ts.map +0 -1
  271. package/lib/src/services/edv/hmac.d.ts +0 -29
  272. package/lib/src/services/edv/hmac.d.ts.map +0 -1
  273. package/lib/src/services/edv/service.d.ts +0 -229
  274. package/lib/src/services/edv/service.d.ts.map +0 -1
  275. package/lib/src/services/pex/config.d.ts +0 -21
  276. package/lib/src/services/pex/config.d.ts.map +0 -1
  277. package/lib/src/services/pex/service.d.ts +0 -21
  278. package/lib/src/services/pex/service.d.ts.map +0 -1
  279. package/lib/src/services/relay-service/configs.d.ts +0 -35
  280. package/lib/src/services/relay-service/configs.d.ts.map +0 -1
  281. package/lib/src/services/relay-service/service-rpc.d.ts +0 -12
  282. package/lib/src/services/relay-service/service-rpc.d.ts.map +0 -1
  283. package/lib/src/services/relay-service/service.d.ts +0 -159
  284. package/lib/src/services/relay-service/service.d.ts.map +0 -1
  285. package/lib/src/services/rpc-service-client.d.ts +0 -7
  286. package/lib/src/services/rpc-service-client.d.ts.map +0 -1
  287. package/lib/src/services/storage/configs.d.ts +0 -2
  288. package/lib/src/services/storage/configs.d.ts.map +0 -1
  289. package/lib/src/services/storage/index.d.ts +0 -2
  290. package/lib/src/services/storage/index.d.ts.map +0 -1
  291. package/lib/src/services/storage/service-rpc.d.ts +0 -9
  292. package/lib/src/services/storage/service-rpc.d.ts.map +0 -1
  293. package/lib/src/services/storage/service.d.ts +0 -10
  294. package/lib/src/services/storage/service.d.ts.map +0 -1
  295. package/lib/src/services/util-crypto/configs.d.ts +0 -5
  296. package/lib/src/services/util-crypto/configs.d.ts.map +0 -1
  297. package/lib/src/services/util-crypto/index.d.ts +0 -2
  298. package/lib/src/services/util-crypto/index.d.ts.map +0 -1
  299. package/lib/src/services/util-crypto/service.d.ts +0 -10
  300. package/lib/src/services/util-crypto/service.d.ts.map +0 -1
  301. package/lib/src/services/wallet/configs.d.ts +0 -13
  302. package/lib/src/services/wallet/configs.d.ts.map +0 -1
  303. package/lib/src/services/wallet/service.d.ts +0 -13
  304. package/lib/src/services/wallet/service.d.ts.map +0 -1
  305. package/lib/src/types.d.ts +0 -12
  306. package/lib/src/types.d.ts.map +0 -1
  307. package/lib/src/wallet/memory-storage-interface.d.ts +0 -31
  308. package/lib/src/wallet/memory-storage-interface.d.ts.map +0 -1
  309. package/lib/src/wallet/memory-storage-wallet.d.ts +0 -6
  310. package/lib/src/wallet/memory-storage-wallet.d.ts.map +0 -1
  311. package/lib/src/wallet/rpc-storage-interface.d.ts +0 -32
  312. package/lib/src/wallet/rpc-storage-interface.d.ts.map +0 -1
  313. package/lib/src/wallet/rpc-storage-wallet.d.ts +0 -6
  314. package/lib/src/wallet/rpc-storage-wallet.d.ts.map +0 -1
  315. package/lib/test-utils.js +0 -46
  316. package/lib/test-utils.mjs +0 -38
  317. package/lib/tsconfig.tsbuildinfo +0 -1
  318. package/lib/types.js +0 -7
  319. package/lib/types.mjs +0 -3
  320. package/lib/wallet/memory-storage-interface.js +0 -101
  321. package/lib/wallet/memory-storage-interface.mjs +0 -95
  322. package/lib/wallet/memory-storage-wallet.js +0 -30
  323. package/lib/wallet/memory-storage-wallet.mjs +0 -24
  324. package/lib/wallet/rpc-storage-interface.js +0 -134
  325. package/lib/wallet/rpc-storage-interface.mjs +0 -128
  326. package/lib/wallet/rpc-storage-wallet.js +0 -46
  327. package/lib/wallet/rpc-storage-wallet.mjs +0 -40
@@ -1,272 +0,0 @@
1
- import * as cedar from '@cedar-policy/cedar-wasm/nodejs';
2
- import { MAY_CLAIM_IRI } from '@docknetwork/vc-delegation-engine';
3
- export interface VerificationResult {
4
- verified: boolean;
5
- credentialResults?: any[];
6
- delegationResult?: {
7
- decision: string;
8
- summaries?: any[];
9
- authorizations?: any[];
10
- failures?: any[];
11
- };
12
- error?: any;
13
- }
14
- export interface CedarPolicies {
15
- staticPolicies: string;
16
- }
17
- export interface VerifiablePresentation {
18
- '@context': any[];
19
- type: string[];
20
- proof?: any;
21
- verifiableCredential?: any[];
22
- }
23
- export interface DelegationCredential {
24
- '@context': any[];
25
- id: string;
26
- type: string[];
27
- issuer: string;
28
- issuanceDate: string;
29
- previousCredentialId: string | null;
30
- rootCredentialId: string;
31
- credentialSubject: {
32
- id: string;
33
- [key: string]: any;
34
- };
35
- proof?: any;
36
- }
37
- export interface VerifyDelegationOptions {
38
- challenge?: string;
39
- domain?: string;
40
- unsignedPresentation?: boolean;
41
- failOnUnauthorizedClaims?: boolean;
42
- policies?: CedarPolicies;
43
- }
44
- export interface KeyPair {
45
- type: string;
46
- id?: string;
47
- controller?: string;
48
- publicKeyJwk?: any;
49
- privateKeyJwk?: any;
50
- publicKeyBase58?: string;
51
- privateKeyBase58?: string;
52
- }
53
- /**
54
- * W3C Credentials V1 context URL
55
- */
56
- export declare const W3C_CREDENTIALS_V1 = "https://www.w3.org/2018/credentials/v1";
57
- /**
58
- * Re-export MAY_CLAIM_IRI for use in credentials
59
- */
60
- export { MAY_CLAIM_IRI };
61
- /**
62
- * Namespace used by the vc-delegation-engine for delegation properties
63
- */
64
- export declare const DELEGATION_ENGINE_NS = "https://ld.truvera.io/credentials/delegation#";
65
- /**
66
- * Base delegation context terms required for delegation credentials.
67
- * These terms define the JSON-LD mappings needed for the vc-delegation-engine
68
- * to properly process delegation chains.
69
- *
70
- * Use this as a base and extend with your own application-specific terms:
71
- * @example
72
- * const myContext = [
73
- * W3C_CREDENTIALS_V1,
74
- * {
75
- * ...DELEGATION_CONTEXT_TERMS,
76
- * // Add your custom terms here
77
- * MyCredentialType: 'https://example.org/MyCredentialType',
78
- * myField: 'https://example.org/myField',
79
- * },
80
- * ];
81
- */
82
- export declare const DELEGATION_CONTEXT_TERMS: {
83
- '@version': number;
84
- '@protected': boolean;
85
- DelegationCredential: string;
86
- mayClaim: {
87
- '@id': "https://rdf.dock.io/alpha/2021#mayClaim";
88
- '@container': string;
89
- };
90
- rootCredentialId: {
91
- '@id': string;
92
- '@type': string;
93
- };
94
- previousCredentialId: {
95
- '@id': string;
96
- '@type': string;
97
- };
98
- };
99
- /**
100
- * Default context for verifiable presentations
101
- */
102
- export declare const PRESENTATION_CONTEXT: string[];
103
- /**
104
- * Issues a delegation credential that grants authority to a delegate
105
- * @param keyPair - The key pair to sign the credential
106
- * @param params - Delegation parameters
107
- * @returns Signed delegation credential
108
- */
109
- export declare function issueDelegationCredential(keyPair: KeyPair, credential: any): Promise<DelegationCredential>;
110
- /**
111
- * Issues a credential as a delegate (with delegation chain reference)
112
- * @param keyPair - The delegate's key pair to sign the credential
113
- * @param params - Credential parameters
114
- * @returns Signed credential
115
- */
116
- export declare function issueDelegatedCredential(keyPair: KeyPair, credential: any): Promise<any>;
117
- /**
118
- * Creates and signs a verifiable presentation with delegation credentials
119
- * @param keyPair - The key pair to sign the presentation
120
- * @param params - Presentation parameters
121
- * @returns Signed verifiable presentation
122
- */
123
- export declare function createSignedPresentation(keyPair: KeyPair, params: {
124
- credentials: any[];
125
- holderDid: string;
126
- challenge: string;
127
- domain: string;
128
- context?: any[];
129
- }): Promise<VerifiablePresentation>;
130
- /**
131
- * Verifies a verifiable presentation with optional delegation chain validation
132
- * Uses the credential-sdk's verifyPresentation which automatically:
133
- * 1. Verifies the presentation signature
134
- * 2. Verifies all credentials
135
- * 3. Detects delegation credentials
136
- * 4. Validates the delegation chain
137
- * 5. Applies Cedar policies if provided
138
- *
139
- * @param vp - The verifiable presentation to verify
140
- * @param options - Verification options
141
- * @returns Verification result with delegation info if applicable
142
- */
143
- export declare function verifyDelegatablePresentation(vp: VerifiablePresentation, options?: VerifyDelegationOptions): Promise<VerificationResult>;
144
- /**
145
- * Creates a Cedar policy for delegation verification
146
- * @param config - Policy configuration
147
- * @returns Cedar policy object
148
- */
149
- export declare function createCedarPolicy(config: {
150
- maxDepth?: number;
151
- rootIssuer: string;
152
- requiredClaims?: Record<string, any>;
153
- }): CedarPolicies;
154
- /**
155
- * Creates an unsigned verifiable presentation (for testing)
156
- * @param credentials - Array of credentials to include
157
- * @param proof - Optional proof object
158
- * @param context - Optional context
159
- * @returns Verifiable presentation object
160
- */
161
- export declare function createUnsignedPresentation(credentials: any[], proof?: any, context?: any[]): VerifiablePresentation;
162
- /**
163
- * Re-export cedar for use in tests and external code
164
- */
165
- export { cedar };
166
- /**
167
- * Service class for delegatable credentials operations
168
- */
169
- declare class DelegatableCredentialsService {
170
- name: string;
171
- rpcMethods: (((params: {
172
- keyPair: KeyPair;
173
- id: string;
174
- issuerDid: string;
175
- delegateDid: string;
176
- mayClaim: string[];
177
- context: any[];
178
- types: string[];
179
- additionalSubjectProperties?: Record<string, any>;
180
- previousCredentialId?: string | null;
181
- rootCredentialId?: string;
182
- }) => Promise<DelegationCredential>) | ((params: {
183
- keyPair: KeyPair;
184
- id: string;
185
- issuerDid: string;
186
- subjectDid: string;
187
- claims: Record<string, any>;
188
- rootCredentialId: string;
189
- previousCredentialId: string;
190
- context: any[];
191
- types: string[];
192
- }) => Promise<any>) | ((params: {
193
- keyPair: KeyPair;
194
- credentials: any[];
195
- holderDid: string;
196
- challenge: string;
197
- domain: string;
198
- context?: any[];
199
- }) => Promise<VerifiablePresentation>) | ((params: {
200
- presentation: VerifiablePresentation;
201
- challenge?: string;
202
- domain?: string;
203
- unsignedPresentation?: boolean;
204
- failOnUnauthorizedClaims?: boolean;
205
- policies?: CedarPolicies;
206
- }) => Promise<VerificationResult>) | ((params: {
207
- maxDepth?: number;
208
- rootIssuer: string;
209
- requiredClaims?: Record<string, any>;
210
- }) => CedarPolicies))[];
211
- /**
212
- * Issues a delegation credential
213
- */
214
- issueDelegation(params: {
215
- keyPair: KeyPair;
216
- id: string;
217
- issuerDid: string;
218
- delegateDid: string;
219
- mayClaim: string[];
220
- context: any[];
221
- types: string[];
222
- additionalSubjectProperties?: Record<string, any>;
223
- previousCredentialId?: string | null;
224
- rootCredentialId?: string;
225
- }): Promise<DelegationCredential>;
226
- /**
227
- * Issues a credential as a delegate
228
- */
229
- issueDelegatedCredential(params: {
230
- keyPair: KeyPair;
231
- id: string;
232
- issuerDid: string;
233
- subjectDid: string;
234
- claims: Record<string, any>;
235
- rootCredentialId: string;
236
- previousCredentialId: string;
237
- context: any[];
238
- types: string[];
239
- }): Promise<any>;
240
- /**
241
- * Creates and signs a verifiable presentation
242
- */
243
- createPresentation(params: {
244
- keyPair: KeyPair;
245
- credentials: any[];
246
- holderDid: string;
247
- challenge: string;
248
- domain: string;
249
- context?: any[];
250
- }): Promise<VerifiablePresentation>;
251
- /**
252
- * Verifies a verifiable presentation with delegation chain
253
- */
254
- verifyPresentation(params: {
255
- presentation: VerifiablePresentation;
256
- challenge?: string;
257
- domain?: string;
258
- unsignedPresentation?: boolean;
259
- failOnUnauthorizedClaims?: boolean;
260
- policies?: CedarPolicies;
261
- }): Promise<VerificationResult>;
262
- /**
263
- * Creates a Cedar policy for delegation verification
264
- */
265
- createPolicy(params: {
266
- maxDepth?: number;
267
- rootIssuer: string;
268
- requiredClaims?: Record<string, any>;
269
- }): CedarPolicies;
270
- }
271
- export declare const delegatableCredentialsService: DelegatableCredentialsService;
272
- //# sourceMappingURL=delegatable-credentials.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delegatable-credentials.d.ts","sourceRoot":"","sources":["../../../../src/services/credential/delegatable-credentials.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,iCAAiC,CAAC;AAQzD,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAsBlE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,GAAG,EAAE,CAAC;IAC1B,gBAAgB,CAAC,EAAE;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC;QAClB,cAAc,CAAC,EAAE,GAAG,EAAE,CAAC;QACvB,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;KAClB,CAAC;IACF,KAAK,CAAC,EAAE,GAAG,CAAC;CACb;AAED,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,GAAG,EAAE,CAAC;IAClB,IAAI,EAAE,MAAM,EA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,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;KACjB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAInC;;OAEG;IACG,kBAAkB,CAAC,MAAM,EAAE;QAC/B,YAAY,EAAE,sBAAsB,CAAC;QACrC,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,oBAAoB,CAAC,EAAE,OAAO,CAAC;QAC/B,wBAAwB,CAAC,EAAE,OAAO,CAAC;QACnC,QAAQ,CAAC,EAAE,aAAa,CAAC;KAC1B,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAU/B;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACtC,GAAG,aAAa;CAGlB;AAED,eAAO,MAAM,6BAA6B,+BAAsC,CAAC"}
@@ -1,35 +0,0 @@
1
- export declare const credentialServiceRPC: {
2
- rpcMethods: ((params?: {}) => any)[];
3
- createSDJWTPresentation(params: any): Promise<string>;
4
- generateCredential(params?: {}): any;
5
- signCredential(params: any): Promise<any>;
6
- createPresentation(params: any): Promise<any>;
7
- verifyPresentation({ presentation, options }: any): Promise<any>;
8
- verifyCredential(params: any): Promise<any>;
9
- filterCredentials(params: any): import("@sphereon/pex").SelectResults;
10
- evaluatePresentation(params: any): import("@sphereon/pex").EvaluationResults;
11
- isBBSPlusCredential(params: any): any;
12
- isKvacCredential(params: any): any;
13
- isSDJWTCredential(params: any): boolean;
14
- credentialToW3C(params: any): Promise<any>;
15
- acquireOIDCredential({ uri, authorizationCode, holderKeyDocument, }: {
16
- uri: string;
17
- authorizationCode?: string;
18
- holderKeyDocument: any;
19
- }): Promise<any>;
20
- createBBSPresentation(params: any): Promise<any>;
21
- getAccumulatorId({ credential }: {
22
- credential: any;
23
- }): any;
24
- getAccumulatorData({ credential }: {
25
- credential: any;
26
- }): Promise<any>;
27
- updateMembershipWitness({ credential, membershipWitnessJSON }: {
28
- credential: any;
29
- membershipWitnessJSON: any;
30
- }): Promise<any>;
31
- deriveVCFromPresentation(params: any): Promise<any>;
32
- testRangeProof(): Promise<void>;
33
- };
34
- export { delegatableCredentialsService, verifyDelegatablePresentation, issueDelegationCredential, issueDelegatedCredential, createSignedPresentation, createUnsignedPresentation, createCedarPolicy, cedar, MAY_CLAIM_IRI, W3C_CREDENTIALS_V1, DELEGATION_ENGINE_NS, DELEGATION_CONTEXT_TERMS, PRESENTATION_CONTEXT, } from './delegatable-credentials';
35
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/credential/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;yBAiB8sc,CAAC;;;;;;;;;;;;;;;;CAjB3rc,CAAC;AAEtD,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC1B,iBAAiB,EACjB,KAAK,EACL,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,2BAA2B,CAAC"}
@@ -1,23 +0,0 @@
1
- /**
2
- * Convert PEX request to bounds for each descriptor
3
- * @param {*} pexRequest - The PEX request object containing input descriptors and constraints
4
- * @param {*} selectedCredentials - Array of selected credentials corresponding to the input descriptors
5
- * @param {*} removeFromRequest - if true, removes range proofs fields from the request. it might be dangerous if you will be using the proof request later
6
- * because it will not have the range proofs fields anymore.
7
- * @returns {Array} - Array of bounds for each descriptor, where each bound is an object with attributeName, min, and max
8
- * @throws {Error} - If a field path is missing or empty
9
- * @throws {Error} - If an unsupported format or type is encountered
10
- * @throws {Error} - If a selected credential is expected but not found at the given index
11
- */
12
- export function pexToBounds(pexRequest: any, selectedCredentials?: any, removeFromRequest?: any): any[];
13
- export function getPexRequiredAttributes(pexRequest: any, selectedCredentials?: any[]): any;
14
- export const EPSILON_NUMBER: 0.001;
15
- export const EPSILON_INT: 1;
16
- export const MAX_DATE_PLACEHOLDER: 884541351600000;
17
- export const MIN_DATE_PLACEHOLDER: -17592186044415;
18
- export const MAX_INTEGER: number;
19
- export const MIN_INTEGER: number;
20
- export const MAX_NUMBER: number;
21
- export const MIN_NUMBER: number;
22
- export function shouldSkipAttribute(attributeName: any): boolean;
23
- //# sourceMappingURL=pex-helpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pex-helpers.d.ts","sourceRoot":"","sources":["../../../../src/services/credential/pex-helpers.js"],"names":[],"mappings":"AA8DA;;;;;;;;;;GAUG;AACH,wCATW,GAAC,wBACD,GAAC,sBACD,GAAC,SA4MX;AAcD,4FAgCC;AA1TD,6BAA8B,KAAK,CAAC;AACpC,0BAA2B,CAAC,CAAC;AAE7B,mCAAoC,eAAe,CAAC;AACpD,mCAAoC,CAAC,cAAc,CAAC;AACpD,iCAAmD;AACnD,iCAAmD;AACnD,gCAAkD;AAClD,gCAAkD;AA+Q3C,iEACoD"}
@@ -1,2 +0,0 @@
1
- export declare function rangeProofExample(): Promise<boolean>;
2
- //# sourceMappingURL=range-proofs-example.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"range-proofs-example.d.ts","sourceRoot":"","sources":["../../../../src/services/credential/range-proofs-example.ts"],"names":[],"mappings":"AA6CA,wBAAsB,iBAAiB,qBAwKtC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=sd-jwt.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sd-jwt.test.d.ts","sourceRoot":"","sources":["../../../../src/services/credential/sd-jwt.test.ts"],"names":[],"mappings":""}
@@ -1,313 +0,0 @@
1
- /**
2
- * Checks if a credential uses BBS+ signature
3
- * @param {Object} credential - The credential to check
4
- * @returns {boolean} True if the credential uses BBS+ signature
5
- * @example
6
- * const isBBS = isBBSPlusCredential(credential);
7
- * if (isBBS) {
8
- * console.log('This credential uses BBS+ signatures');
9
- * }
10
- */
11
- export declare function isBBSPlusCredential(credential: any): any;
12
- /**
13
- * Checks if a credential uses KVAC (BBDT16) signature
14
- * @param {Object} credential - The credential to check
15
- * @returns {boolean} True if the credential uses KVAC signature
16
- * @example
17
- * const isKVAC = isKvacCredential(credential);
18
- */
19
- export declare function isKvacCredential(credential: any): any;
20
- /**
21
- * Checks if a credential is anonymous (BBS+ or KVAC)
22
- * @param {Object} credential - The credential to check
23
- * @returns {boolean} True if the credential is anonymous
24
- * @example
25
- * if (isAnnonymousCredential(credential)) {
26
- * console.log('This credential supports selective disclosure');
27
- * }
28
- */
29
- export declare function isAnnonymousCredential(credential: any): any;
30
- /**
31
- * Service class for managing verifiable credentials
32
- * @class
33
- * @description Provides methods for creating, signing, verifying, and presenting
34
- * verifiable credentials with support for various signature types
35
- */
36
- declare class CredentialService {
37
- /**
38
- * Creates a new CredentialService instance
39
- * @constructor
40
- */
41
- constructor();
42
- rpcMethods: ((params?: {}) => any)[];
43
- createSDJWTPresentation(params: any): Promise<string>;
44
- /**
45
- * Generates a new verifiable credential template
46
- * @param {Object} [params={}] - Generation parameters
47
- * @param {Object} [params.subject] - The credential subject
48
- * @returns {VerifiableCredential} A new verifiable credential instance
49
- * @example
50
- * const credential = credentialService.generateCredential({
51
- * subject: { id: 'did:example:123', name: 'Alice' }
52
- * });
53
- */
54
- generateCredential(params?: {}): any;
55
- /**
56
- * Signs a verifiable credential
57
- * @param {Object} params - Signing parameters
58
- * @param {Object} params.vcJson - The credential JSON to sign
59
- * @param {Object} params.keyDoc - The key document for signing
60
- * @returns {Promise<VerifiableCredential>} The signed verifiable credential
61
- * @throws {Error} If validation fails or signing fails
62
- * @example
63
- * const signedCredential = await credentialService.signCredential({
64
- * vcJson: credentialData,
65
- * keyDoc: issuerKeyDocument
66
- * });
67
- */
68
- signCredential(params: any): Promise<any>;
69
- /**
70
- * Creates a verifiable presentation from credentials
71
- * @param {Object} params - Presentation parameters
72
- * @param {Array<Object>} params.credentials - Array of verifiable credentials to include
73
- * @param {Object} params.keyDoc - The key document for signing the presentation
74
- * @param {string} [params.challenge] - Challenge string for the presentation proof
75
- * @param {string} [params.id] - Presentation identifier
76
- * @param {string} [params.domain] - Domain for the presentation proof
77
- * @returns {Promise<Object>} The signed verifiable presentation
78
- * @throws {Error} If validation fails
79
- * @example
80
- * const presentation = await credentialService.createPresentation({
81
- * credentials: [credential1, credential2],
82
- * keyDoc: holderKeyDocument,
83
- * challenge: 'abc123',
84
- * domain: 'example.com'
85
- * });
86
- */
87
- createPresentation(params: any): Promise<any>;
88
- /**
89
- * Verifies a verifiable presentation
90
- * @param {Object} params - Verification parameters
91
- * @param {Object} params.presentation - The presentation to verify
92
- * @param {Object} [params.options] - Verification options
93
- * @returns {Promise<Object>} Verification result with verified status and any errors
94
- * @example
95
- * const result = await credentialService.verifyPresentation({
96
- * presentation: presentationData
97
- * });
98
- * console.log('Verified:', result.verified);
99
- */
100
- verifyPresentation({ presentation, options }: any): Promise<any>;
101
- /**
102
- * Verifies a verifiable credential including revocation check
103
- * @param {Object} params - Verification parameters
104
- * @param {Object} params.credential - The credential to verify
105
- * @param {Object} [params.membershipWitness] - Membership witness for revocation check
106
- * @returns {Promise<Object>} Verification result
107
- * @returns {boolean} returns.verified - Whether the credential is valid
108
- * @returns {string} [returns.error] - Error message if verification failed
109
- * @throws {Error} If validation fails
110
- * @example
111
- * const result = await credentialService.verifyCredential({
112
- * credential: credentialData,
113
- * membershipWitness: witnessData
114
- * });
115
- * if (!result.verified) {
116
- * console.error('Verification failed:', result.error);
117
- * }
118
- */
119
- verifyCredential(params: any): Promise<any>;
120
- /**
121
- * Filters credentials based on a presentation definition
122
- * @param {Object} params - Filter parameters
123
- * @param {Array<Object>} params.credentials - Array of credentials to filter
124
- * @param {Object} params.presentationDefinition - PEX presentation definition
125
- * @param {string} [params.holderDid] - DID of the credential holder
126
- * @returns {Object} Filtered credentials matching the presentation definition
127
- * @example
128
- * const filtered = credentialService.filterCredentials({
129
- * credentials: allCredentials,
130
- * presentationDefinition: definition,
131
- * holderDid: 'did:example:holder'
132
- * });
133
- */
134
- filterCredentials(params: any): import("@sphereon/pex").SelectResults;
135
- /**
136
- * Evaluates a presentation against a presentation definition
137
- * @param {Object} params - Evaluation parameters
138
- * @param {Object} params.presentation - The presentation to evaluate
139
- * @param {Object} params.presentationDefinition - PEX presentation definition
140
- * @returns {Object} Evaluation result with validation details
141
- * @example
142
- * const evaluation = credentialService.evaluatePresentation({
143
- * presentation: presentationData,
144
- * presentationDefinition: definition
145
- * });
146
- */
147
- evaluatePresentation(params: any): import("@sphereon/pex").EvaluationResults;
148
- /**
149
- * Checks if a credential uses BBS+ signature
150
- * @param {Object} params - Check parameters
151
- * @param {Object} params.credential - The credential to check
152
- * @returns {boolean} True if the credential uses BBS+ signature
153
- */
154
- isBBSPlusCredential(params: any): any;
155
- /**
156
- * Checks if a credential uses KVAC signature
157
- * @param {Object} params - Check parameters
158
- * @param {Object} params.credential - The credential to check
159
- * @returns {boolean} True if the credential uses KVAC signature
160
- */
161
- isKvacCredential(params: any): any;
162
- /**
163
- * Checks if a credential is an SD-JWT (Selective Disclosure JWT) credential
164
- * @param {Object} params - Check parameters
165
- * @param {string} params.credential - The JWT string to check
166
- * @returns {boolean} True if the credential is an SD-JWT credential
167
- * @example
168
- * const isSDJWT = credentialService.isSDJWTCredential({
169
- * credential: 'eyJ0eXAiOiJ2YytzZC1qd3Q...'
170
- * });
171
- */
172
- isSDJWTCredential(params: any): boolean;
173
- /**
174
- * Converts a credential to W3C Verifiable Credential format
175
- * @description Handles both SD-JWT credentials (needs decoding) and regular W3C credentials (returns as-is)
176
- * @param {Object} params - Conversion parameters
177
- * @param {string|Object} params.credential - Either an SD-JWT string or a credential object
178
- * @returns {Promise<Object>} W3C Verifiable Credential format
179
- * @throws {Error} If credential cannot be converted to W3C format
180
- * @example
181
- * // Convert SD-JWT to W3C format
182
- * const w3cCredential = await credentialService.credentialToW3C({
183
- * credential: 'eyJ0eXAiOiJ2YytzZC1qd3Q...'
184
- * });
185
- *
186
- * // Returns W3C credential as-is
187
- * const w3cCredential = await credentialService.credentialToW3C({
188
- * credential: { '@context': [...], type: [...], ... }
189
- * });
190
- */
191
- credentialToW3C(params: any): Promise<any>;
192
- /**
193
- * Acquires a credential through OpenID for Verifiable Credentials (OID4VC)
194
- * @param {Object} params - Acquisition parameters
195
- * @param {string} params.uri - The credential offer URI
196
- * @param {string} [params.authorizationCode] - Authorization code if required
197
- * @param {Object} params.holderKeyDocument - Key document for the credential holder
198
- * @returns {Promise<Object>} Result containing the credential or authorization URL
199
- * @returns {Object} [returns.credential] - The acquired credential
200
- * @returns {string} [returns.authorizationURL] - Authorization URL if auth is required
201
- * @example
202
- * const result = await credentialService.acquireOIDCredential({
203
- * uri: 'openid-credential-offer://...',
204
- * holderKeyDocument: keyDoc
205
- * });
206
- */
207
- acquireOIDCredential({ uri, authorizationCode, holderKeyDocument, }: {
208
- uri: string;
209
- authorizationCode?: string;
210
- holderKeyDocument: any;
211
- }): Promise<any>;
212
- /**
213
- * Creates a BBS+ presentation with selective disclosure
214
- * @param {Object} params - Presentation parameters
215
- * @param {Array<Object>} params.credentials - Array of credentials with attributes to reveal
216
- * @param {Object} params.credentials[].credential - The BBS+ credential
217
- * @param {Array<string>} [params.credentials[].attributesToReveal] - Attributes to reveal
218
- * @returns {Promise<Object>} The BBS+ presentation
219
- * @throws {Error} If validation fails
220
- * @example
221
- * const presentation = await credentialService.createBBSPresentation({
222
- * credentials: [{
223
- * credential: bbsCredential,
224
- * attributesToReveal: ['name', 'age']
225
- * }]
226
- * });
227
- */
228
- createBBSPresentation(params: any): Promise<any>;
229
- /**
230
- * Gets the accumulator ID from a credential's status
231
- * @param {Object} params - Parameters
232
- * @param {Object} params.credential - The credential to get accumulator ID from
233
- * @returns {string|null} The accumulator ID or null if not present
234
- * @throws {Error} If credential is not provided
235
- */
236
- getAccumulatorId({ credential }: {
237
- credential: any;
238
- }): any;
239
- /**
240
- * Gets accumulator data from the blockchain for a credential
241
- * @param {Object} params - Parameters
242
- * @param {Object} params.credential - The credential to get accumulator data for
243
- * @returns {Promise<Object|null>} The accumulator data or null if not found
244
- * @throws {Error} If credential is not provided
245
- */
246
- getAccumulatorData({ credential }: {
247
- credential: any;
248
- }): Promise<any>;
249
- /**
250
- * Updates the membership witness with the latest accumulator state
251
- * @description The witness is generated by the issuer when the credential is created
252
- * and is stored in the wallet when the credential is imported. This method updates
253
- * it with the latest accumulator changes from the blockchain.
254
- * @param {Object} params - Update parameters
255
- * @param {Object} params.credential - The credential with revocation status
256
- * @param {Object} params.membershipWitnessJSON - Current membership witness in JSON format
257
- * @returns {Promise<Object>} Updated membership witness in JSON format
258
- * @throws {Error} If updates cannot be fetched or applied
259
- */
260
- updateMembershipWitness({ credential, membershipWitnessJSON }: {
261
- credential: any;
262
- membershipWitnessJSON: any;
263
- }): Promise<any>;
264
- /**
265
- * Derives verifiable credentials from a presentation with selective disclosure
266
- * @param {Object} params - Derivation parameters
267
- * @param {Array<Object>} params.credentials - Array of credential objects
268
- * @param {Object} params.credentials[].credential - The credential
269
- * @param {Array<string>} params.credentials[].attributesToReveal - Attributes to reveal
270
- * @param {Object} [params.credentials[].witness] - Membership witness for revocation
271
- * @param {Object} [params.options={}] - Additional options for derivation
272
- * @param {Object} [params.proofRequest] - Proof request with constraints
273
- * @returns {Promise<Array>} Array of derived credentials
274
- * @throws {Error} If validation fails
275
- * @example
276
- * const derivedCredentials = await credentialService.deriveVCFromPresentation({
277
- * credentials: [{
278
- * credential: bbsCredential,
279
- * attributesToReveal: ['name', 'dateOfBirth']
280
- * }]
281
- * });
282
- */
283
- deriveVCFromPresentation(params: any): Promise<any>;
284
- /**
285
- * Test method for range proofs
286
- * @private
287
- * @returns {Promise<void>}
288
- */
289
- testRangeProof(): Promise<void>;
290
- }
291
- /**
292
- * Singleton instance of the credential service
293
- * @type {CredentialService}
294
- * @example
295
- * import { credentialService } from '@docknetwork/wallet-sdk-wasm/services/credential';
296
- *
297
- * // Create and sign a credential
298
- * const credential = credentialService.generateCredential({
299
- * subject: { id: 'did:example:123' }
300
- * });
301
- * const signed = await credentialService.signCredential({
302
- * vcJson: credential,
303
- * keyDoc: issuerKey
304
- * });
305
- *
306
- * // Verify a credential
307
- * const result = await credentialService.verifyCredential({
308
- * credential: signedCredential
309
- * });
310
- */
311
- export declare const credentialService: CredentialService;
312
- export {};
313
- //# sourceMappingURL=service.d.ts.map