@learncard/network-plugin 2.7.0 → 2.7.1

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.
@@ -6792,7 +6792,8 @@ var require_helpers_cjs_development = __commonJS({
6792
6792
  to: z2.string(),
6793
6793
  from: z2.string(),
6794
6794
  sent: z2.string().datetime(),
6795
- received: z2.string().datetime().optional()
6795
+ received: z2.string().datetime().optional(),
6796
+ metadata: z2.record(z2.unknown()).optional()
6796
6797
  });
6797
6798
  var BoostPermissionsValidator2 = z2.object({
6798
6799
  role: z2.string(),
@@ -7161,8 +7162,9 @@ var require_helpers_cjs_development = __commonJS({
7161
7162
  vcUris: z2.array(z2.string()).optional(),
7162
7163
  vpUris: z2.array(z2.string()).optional(),
7163
7164
  transaction: ConsentFlowTransactionValidator2.optional(),
7164
- inbox: LCNNotificationInboxValidator2.optional()
7165
- });
7165
+ inbox: LCNNotificationInboxValidator2.optional(),
7166
+ metadata: z2.record(z2.unknown()).optional()
7167
+ }).passthrough();
7166
7168
  var LCNNotificationValidator2 = z2.object({
7167
7169
  type: LCNNotificationTypeEnumValidator2,
7168
7170
  to: LCNProfileValidator2.partial().and(z2.object({ did: z2.string() })),
@@ -12283,7 +12285,8 @@ var SentCredentialInfoValidator = z.object({
12283
12285
  to: z.string(),
12284
12286
  from: z.string(),
12285
12287
  sent: z.string().datetime(),
12286
- received: z.string().datetime().optional()
12288
+ received: z.string().datetime().optional(),
12289
+ metadata: z.record(z.unknown()).optional()
12287
12290
  });
12288
12291
  var BoostPermissionsValidator = z.object({
12289
12292
  role: z.string(),
@@ -12652,8 +12655,9 @@ var LCNNotificationDataValidator = z.object({
12652
12655
  vcUris: z.array(z.string()).optional(),
12653
12656
  vpUris: z.array(z.string()).optional(),
12654
12657
  transaction: ConsentFlowTransactionValidator.optional(),
12655
- inbox: LCNNotificationInboxValidator.optional()
12656
- });
12658
+ inbox: LCNNotificationInboxValidator.optional(),
12659
+ metadata: z.record(z.unknown()).optional()
12660
+ }).passthrough();
12657
12661
  var LCNNotificationValidator = z.object({
12658
12662
  type: LCNNotificationTypeEnumValidator,
12659
12663
  to: LCNProfileValidator.partial().and(z.object({ did: z.string() })),
@@ -17864,7 +17868,8 @@ var require_types_cjs_development = __commonJS2({
17864
17868
  to: z2.string(),
17865
17869
  from: z2.string(),
17866
17870
  sent: z2.string().datetime(),
17867
- received: z2.string().datetime().optional()
17871
+ received: z2.string().datetime().optional(),
17872
+ metadata: z2.record(z2.unknown()).optional()
17868
17873
  });
17869
17874
  var BoostPermissionsValidator2 = z2.object({
17870
17875
  role: z2.string(),
@@ -18233,8 +18238,9 @@ var require_types_cjs_development = __commonJS2({
18233
18238
  vcUris: z2.array(z2.string()).optional(),
18234
18239
  vpUris: z2.array(z2.string()).optional(),
18235
18240
  transaction: ConsentFlowTransactionValidator2.optional(),
18236
- inbox: LCNNotificationInboxValidator2.optional()
18237
- });
18241
+ inbox: LCNNotificationInboxValidator2.optional(),
18242
+ metadata: z2.record(z2.unknown()).optional()
18243
+ }).passthrough();
18238
18244
  var LCNNotificationValidator2 = z2.object({
18239
18245
  type: LCNNotificationTypeEnumValidator2,
18240
18246
  to: LCNProfileValidator2.partial().and(z2.object({ did: z2.string() })),
@@ -18969,10 +18975,24 @@ async function getLearnCardNetworkPlugin(learnCard, url, apiToken) {
18969
18975
  await ensureUser();
18970
18976
  return client.profile.blocked.query();
18971
18977
  },
18972
- sendCredential: async (_learnCard, profileId, vc, encrypt = true) => {
18978
+ sendCredential: async (_learnCard, profileId, vc, metadataOrEncrypt, encrypt) => {
18973
18979
  await ensureUser();
18974
- if (!encrypt) {
18975
- return client.credential.sendCredential.mutate({ profileId, credential: vc });
18980
+ let metadata;
18981
+ let shouldEncrypt = true;
18982
+ if (typeof metadataOrEncrypt === "boolean") {
18983
+ shouldEncrypt = metadataOrEncrypt;
18984
+ } else if (metadataOrEncrypt !== void 0) {
18985
+ metadata = metadataOrEncrypt;
18986
+ shouldEncrypt = encrypt ?? true;
18987
+ } else {
18988
+ shouldEncrypt = encrypt ?? true;
18989
+ }
18990
+ if (!shouldEncrypt) {
18991
+ return client.credential.sendCredential.mutate({
18992
+ profileId,
18993
+ credential: vc,
18994
+ metadata
18995
+ });
18976
18996
  }
18977
18997
  const target = await _learnCard.invoke.getProfile(profileId);
18978
18998
  if (!target)
@@ -18981,7 +19001,11 @@ async function getLearnCardNetworkPlugin(learnCard, url, apiToken) {
18981
19001
  _learnCard.id.did(),
18982
19002
  target.did
18983
19003
  ]);
18984
- return client.credential.sendCredential.mutate({ profileId, credential });
19004
+ return client.credential.sendCredential.mutate({
19005
+ profileId,
19006
+ credential,
19007
+ metadata
19008
+ });
18985
19009
  },
18986
19010
  acceptCredential: async (_learnCard, uri, options) => {
18987
19011
  await ensureUser();