@learncard/network-plugin 2.7.0 → 2.7.2

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.
@@ -6817,7 +6817,8 @@ var require_helpers_cjs_development = __commonJS({
6817
6817
  to: z2.string(),
6818
6818
  from: z2.string(),
6819
6819
  sent: z2.string().datetime(),
6820
- received: z2.string().datetime().optional()
6820
+ received: z2.string().datetime().optional(),
6821
+ metadata: z2.record(z2.unknown()).optional()
6821
6822
  });
6822
6823
  var BoostPermissionsValidator2 = z2.object({
6823
6824
  role: z2.string(),
@@ -7186,8 +7187,9 @@ var require_helpers_cjs_development = __commonJS({
7186
7187
  vcUris: z2.array(z2.string()).optional(),
7187
7188
  vpUris: z2.array(z2.string()).optional(),
7188
7189
  transaction: ConsentFlowTransactionValidator2.optional(),
7189
- inbox: LCNNotificationInboxValidator2.optional()
7190
- });
7190
+ inbox: LCNNotificationInboxValidator2.optional(),
7191
+ metadata: z2.record(z2.unknown()).optional()
7192
+ }).passthrough();
7191
7193
  var LCNNotificationValidator2 = z2.object({
7192
7194
  type: LCNNotificationTypeEnumValidator2,
7193
7195
  to: LCNProfileValidator2.partial().and(z2.object({ did: z2.string() })),
@@ -12308,7 +12310,8 @@ var SentCredentialInfoValidator = z.object({
12308
12310
  to: z.string(),
12309
12311
  from: z.string(),
12310
12312
  sent: z.string().datetime(),
12311
- received: z.string().datetime().optional()
12313
+ received: z.string().datetime().optional(),
12314
+ metadata: z.record(z.unknown()).optional()
12312
12315
  });
12313
12316
  var BoostPermissionsValidator = z.object({
12314
12317
  role: z.string(),
@@ -12677,8 +12680,9 @@ var LCNNotificationDataValidator = z.object({
12677
12680
  vcUris: z.array(z.string()).optional(),
12678
12681
  vpUris: z.array(z.string()).optional(),
12679
12682
  transaction: ConsentFlowTransactionValidator.optional(),
12680
- inbox: LCNNotificationInboxValidator.optional()
12681
- });
12683
+ inbox: LCNNotificationInboxValidator.optional(),
12684
+ metadata: z.record(z.unknown()).optional()
12685
+ }).passthrough();
12682
12686
  var LCNNotificationValidator = z.object({
12683
12687
  type: LCNNotificationTypeEnumValidator,
12684
12688
  to: LCNProfileValidator.partial().and(z.object({ did: z.string() })),
@@ -17889,7 +17893,8 @@ var require_types_cjs_development = __commonJS2({
17889
17893
  to: z2.string(),
17890
17894
  from: z2.string(),
17891
17895
  sent: z2.string().datetime(),
17892
- received: z2.string().datetime().optional()
17896
+ received: z2.string().datetime().optional(),
17897
+ metadata: z2.record(z2.unknown()).optional()
17893
17898
  });
17894
17899
  var BoostPermissionsValidator2 = z2.object({
17895
17900
  role: z2.string(),
@@ -18258,8 +18263,9 @@ var require_types_cjs_development = __commonJS2({
18258
18263
  vcUris: z2.array(z2.string()).optional(),
18259
18264
  vpUris: z2.array(z2.string()).optional(),
18260
18265
  transaction: ConsentFlowTransactionValidator2.optional(),
18261
- inbox: LCNNotificationInboxValidator2.optional()
18262
- });
18266
+ inbox: LCNNotificationInboxValidator2.optional(),
18267
+ metadata: z2.record(z2.unknown()).optional()
18268
+ }).passthrough();
18263
18269
  var LCNNotificationValidator2 = z2.object({
18264
18270
  type: LCNNotificationTypeEnumValidator2,
18265
18271
  to: LCNProfileValidator2.partial().and(z2.object({ did: z2.string() })),
@@ -18994,10 +19000,24 @@ async function getLearnCardNetworkPlugin(learnCard, url, apiToken) {
18994
19000
  await ensureUser();
18995
19001
  return client.profile.blocked.query();
18996
19002
  },
18997
- sendCredential: async (_learnCard, profileId, vc, encrypt = true) => {
19003
+ sendCredential: async (_learnCard, profileId, vc, metadataOrEncrypt, encrypt) => {
18998
19004
  await ensureUser();
18999
- if (!encrypt) {
19000
- return client.credential.sendCredential.mutate({ profileId, credential: vc });
19005
+ let metadata;
19006
+ let shouldEncrypt = true;
19007
+ if (typeof metadataOrEncrypt === "boolean") {
19008
+ shouldEncrypt = metadataOrEncrypt;
19009
+ } else if (metadataOrEncrypt !== void 0) {
19010
+ metadata = metadataOrEncrypt;
19011
+ shouldEncrypt = encrypt ?? true;
19012
+ } else {
19013
+ shouldEncrypt = encrypt ?? true;
19014
+ }
19015
+ if (!shouldEncrypt) {
19016
+ return client.credential.sendCredential.mutate({
19017
+ profileId,
19018
+ credential: vc,
19019
+ metadata
19020
+ });
19001
19021
  }
19002
19022
  const target = await _learnCard.invoke.getProfile(profileId);
19003
19023
  if (!target)
@@ -19006,7 +19026,11 @@ async function getLearnCardNetworkPlugin(learnCard, url, apiToken) {
19006
19026
  _learnCard.id.did(),
19007
19027
  target.did
19008
19028
  ]);
19009
- return client.credential.sendCredential.mutate({ profileId, credential });
19029
+ return client.credential.sendCredential.mutate({
19030
+ profileId,
19031
+ credential,
19032
+ metadata
19033
+ });
19010
19034
  },
19011
19035
  acceptCredential: async (_learnCard, uri, options) => {
19012
19036
  await ensureUser();