@learncard/helpers 1.1.18 → 1.1.20

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.
@@ -71,6 +71,7 @@ var require_types_cjs_development = __commonJS({
71
71
  ClaimHookQueryValidator: () => ClaimHookQueryValidator,
72
72
  ClaimHookTypeValidator: () => ClaimHookTypeValidator,
73
73
  ClaimHookValidator: () => ClaimHookValidator,
74
+ ClaimTokenValidator: () => ClaimTokenValidator,
74
75
  ConsentFlowContractDataForDidValidator: () => ConsentFlowContractDataForDidValidator,
75
76
  ConsentFlowContractDataValidator: () => ConsentFlowContractDataValidator,
76
77
  ConsentFlowContractDetailsValidator: () => ConsentFlowContractDetailsValidator,
@@ -85,6 +86,11 @@ var require_types_cjs_development = __commonJS({
85
86
  ConsentFlowTransactionActionValidator: () => ConsentFlowTransactionActionValidator,
86
87
  ConsentFlowTransactionValidator: () => ConsentFlowTransactionValidator,
87
88
  ConsentFlowTransactionsQueryValidator: () => ConsentFlowTransactionsQueryValidator,
89
+ ContactMethodCreateValidator: () => ContactMethodCreateValidator,
90
+ ContactMethodQueryValidator: () => ContactMethodQueryValidator,
91
+ ContactMethodValidator: () => ContactMethodValidator,
92
+ ContactMethodVerificationRequestValidator: () => ContactMethodVerificationRequestValidator,
93
+ ContactMethodVerificationValidator: () => ContactMethodVerificationValidator,
88
94
  ContextValidator: () => ContextValidator,
89
95
  ContractCredentialValidator: () => ContractCredentialValidator,
90
96
  CredentialInfoValidator: () => CredentialInfoValidator,
@@ -106,6 +112,11 @@ var require_types_cjs_development = __commonJS({
106
112
  IdentifierTypeValidator: () => IdentifierTypeValidator,
107
113
  IdentityObjectValidator: () => IdentityObjectValidator,
108
114
  ImageValidator: () => ImageValidator,
115
+ InboxCredentialQueryValidator: () => InboxCredentialQueryValidator,
116
+ InboxCredentialValidator: () => InboxCredentialValidator,
117
+ IssueInboxCredentialResponseValidator: () => IssueInboxCredentialResponseValidator,
118
+ IssueInboxCredentialValidator: () => IssueInboxCredentialValidator,
119
+ IssueInboxSigningAuthorityValidator: () => IssueInboxSigningAuthorityValidator,
109
120
  JWERecipientHeaderValidator: () => JWERecipientHeaderValidator,
110
121
  JWERecipientValidator: () => JWERecipientValidator,
111
122
  JWEValidator: () => JWEValidator2,
@@ -115,7 +126,10 @@ var require_types_cjs_development = __commonJS({
115
126
  LCNBoostClaimLinkOptionsValidator: () => LCNBoostClaimLinkOptionsValidator,
116
127
  LCNBoostClaimLinkSigningAuthorityValidator: () => LCNBoostClaimLinkSigningAuthorityValidator,
117
128
  LCNBoostStatus: () => LCNBoostStatus,
129
+ LCNInboxContactMethodValidator: () => LCNInboxContactMethodValidator,
130
+ LCNInboxStatusEnumValidator: () => LCNInboxStatusEnumValidator,
118
131
  LCNNotificationDataValidator: () => LCNNotificationDataValidator,
132
+ LCNNotificationInboxValidator: () => LCNNotificationInboxValidator,
119
133
  LCNNotificationMessageValidator: () => LCNNotificationMessageValidator,
120
134
  LCNNotificationTypeEnumValidator: () => LCNNotificationTypeEnumValidator,
121
135
  LCNNotificationValidator: () => LCNNotificationValidator,
@@ -138,6 +152,7 @@ var require_types_cjs_development = __commonJS({
138
152
  PaginatedContractCredentialsValidator: () => PaginatedContractCredentialsValidator,
139
153
  PaginatedEncryptedCredentialRecordsValidator: () => PaginatedEncryptedCredentialRecordsValidator,
140
154
  PaginatedEncryptedRecordsValidator: () => PaginatedEncryptedRecordsValidator,
155
+ PaginatedInboxCredentialsValidator: () => PaginatedInboxCredentialsValidator,
141
156
  PaginatedLCNProfileManagersValidator: () => PaginatedLCNProfileManagersValidator,
142
157
  PaginatedLCNProfilesAndManagersValidator: () => PaginatedLCNProfilesAndManagersValidator,
143
158
  PaginatedLCNProfilesValidator: () => PaginatedLCNProfilesValidator,
@@ -155,6 +170,7 @@ var require_types_cjs_development = __commonJS({
155
170
  RubricCriterionValidator: () => RubricCriterionValidator,
156
171
  SentCredentialInfoValidator: () => SentCredentialInfoValidator,
157
172
  ServiceValidator: () => ServiceValidator,
173
+ SetPrimaryContactMethodValidator: () => SetPrimaryContactMethodValidator,
158
174
  StringQuery: () => StringQuery,
159
175
  TermsOfUseValidator: () => TermsOfUseValidator,
160
176
  UnsignedAchievementCredentialValidator: () => UnsignedAchievementCredentialValidator,
@@ -4639,7 +4655,7 @@ var require_types_cjs_development = __commonJS({
4639
4655
  bio: z.string().default("").describe("Longer bio for the profile."),
4640
4656
  did: z.string().describe("Decentralized Identifier for the profile. (auto-assigned)"),
4641
4657
  isPrivate: z.boolean().optional().describe("Whether the profile is private or not and shows up in search results."),
4642
- email: z.string().optional().describe("Contact email address for the profile."),
4658
+ email: z.string().optional().describe("Contact email address for the profile. (deprecated)"),
4643
4659
  image: z.string().optional().describe("Profile image URL for the profile."),
4644
4660
  heroImage: z.string().optional().describe("Hero image URL for the profile."),
4645
4661
  websiteLink: z.string().optional().describe("Website link for the profile."),
@@ -4808,7 +4824,8 @@ var require_types_cjs_development = __commonJS({
4808
4824
  name: z.string().max(15).regex(/^[a-z0-9-]+$/, {
4809
4825
  message: "The input string must contain only lowercase letters, numbers, and hyphens."
4810
4826
  }),
4811
- did: z.string()
4827
+ did: z.string(),
4828
+ isPrimary: z.boolean().optional()
4812
4829
  })
4813
4830
  });
4814
4831
  var AutoBoostConfigValidator = z.object({
@@ -4989,16 +5006,33 @@ var require_types_cjs_development = __commonJS({
4989
5006
  "BOOST_ACCEPTED",
4990
5007
  "PRESENTATION_REQUEST",
4991
5008
  "PRESENTATION_RECEIVED",
4992
- "CONSENT_FLOW_TRANSACTION"
5009
+ "CONSENT_FLOW_TRANSACTION",
5010
+ "ISSUANCE_CLAIMED",
5011
+ "ISSUANCE_DELIVERED"
4993
5012
  ]);
4994
5013
  var LCNNotificationMessageValidator = z.object({
4995
5014
  title: z.string().optional(),
4996
5015
  body: z.string().optional()
4997
5016
  });
5017
+ var LCNInboxContactMethodValidator = z.object({
5018
+ type: z.string(),
5019
+ value: z.string()
5020
+ });
5021
+ var LCNInboxStatusEnumValidator = z.enum(["PENDING", "DELIVERED", "CLAIMED", "EXPIRED"]);
5022
+ var LCNNotificationInboxValidator = z.object({
5023
+ issuanceId: z.string(),
5024
+ status: LCNInboxStatusEnumValidator,
5025
+ recipient: z.object({
5026
+ contactMethod: LCNInboxContactMethodValidator.optional(),
5027
+ learnCardId: z.string().optional()
5028
+ }),
5029
+ timestamp: z.string().datetime().optional()
5030
+ });
4998
5031
  var LCNNotificationDataValidator = z.object({
4999
5032
  vcUris: z.array(z.string()).optional(),
5000
5033
  vpUris: z.array(z.string()).optional(),
5001
- transaction: ConsentFlowTransactionValidator.optional()
5034
+ transaction: ConsentFlowTransactionValidator.optional(),
5035
+ inbox: LCNNotificationInboxValidator.optional()
5002
5036
  });
5003
5037
  var LCNNotificationValidator = z.object({
5004
5038
  type: LCNNotificationTypeEnumValidator,
@@ -5006,7 +5040,8 @@ var require_types_cjs_development = __commonJS({
5006
5040
  from: LCNProfileValidator.partial().and(z.object({ did: z.string() })),
5007
5041
  message: LCNNotificationMessageValidator.optional(),
5008
5042
  data: LCNNotificationDataValidator.optional(),
5009
- sent: z.string().datetime().optional()
5043
+ sent: z.string().datetime().optional(),
5044
+ webhookUrl: z.string().optional()
5010
5045
  });
5011
5046
  var AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX = "auth-grant:";
5012
5047
  var AuthGrantValidator = z.object({
@@ -5030,6 +5065,126 @@ var require_types_cjs_development = __commonJS({
5030
5065
  description: StringQuery,
5031
5066
  status: AuthGrantStatusValidator
5032
5067
  }).partial();
5068
+ var contactMethodBase = z.object({
5069
+ id: z.string(),
5070
+ isVerified: z.boolean(),
5071
+ verifiedAt: z.string().optional(),
5072
+ isPrimary: z.boolean(),
5073
+ createdAt: z.string()
5074
+ });
5075
+ var ContactMethodValidator = z.discriminatedUnion("type", [
5076
+ z.object({
5077
+ type: z.literal("email"),
5078
+ value: z.string().email()
5079
+ }).merge(contactMethodBase),
5080
+ z.object({
5081
+ type: z.literal("phone"),
5082
+ value: z.string()
5083
+ }).merge(contactMethodBase)
5084
+ ]);
5085
+ var createContactMethodBase = z.object({
5086
+ isVerified: z.boolean().optional(),
5087
+ isPrimary: z.boolean().optional()
5088
+ });
5089
+ var ContactMethodCreateValidator = z.discriminatedUnion("type", [
5090
+ z.object({
5091
+ type: z.literal("email"),
5092
+ value: z.string().email()
5093
+ }).merge(createContactMethodBase),
5094
+ z.object({
5095
+ type: z.literal("phone"),
5096
+ value: z.string()
5097
+ }).merge(createContactMethodBase)
5098
+ ]);
5099
+ var ContactMethodQueryValidator = z.discriminatedUnion("type", [
5100
+ z.object({
5101
+ type: z.literal("email"),
5102
+ value: z.string().email()
5103
+ }),
5104
+ z.object({
5105
+ type: z.literal("phone"),
5106
+ value: z.string()
5107
+ })
5108
+ ]);
5109
+ var ContactMethodVerificationRequestValidator = z.object({
5110
+ value: z.string(),
5111
+ type: z.enum(["email", "phone"])
5112
+ });
5113
+ var ContactMethodVerificationValidator = z.object({
5114
+ token: z.string()
5115
+ });
5116
+ var SetPrimaryContactMethodValidator = z.object({
5117
+ contactMethodId: z.string()
5118
+ });
5119
+ var InboxCredentialValidator = z.object({
5120
+ id: z.string(),
5121
+ credential: z.string(),
5122
+ isSigned: z.boolean(),
5123
+ currentStatus: LCNInboxStatusEnumValidator,
5124
+ expiresAt: z.string(),
5125
+ createdAt: z.string(),
5126
+ issuerDid: z.string(),
5127
+ webhookUrl: z.string().optional(),
5128
+ "signingAuthority.endpoint": z.string().optional(),
5129
+ "signingAuthority.name": z.string().optional()
5130
+ });
5131
+ var PaginatedInboxCredentialsValidator = z.object({
5132
+ hasMore: z.boolean(),
5133
+ records: z.array(InboxCredentialValidator),
5134
+ cursor: z.string().optional()
5135
+ });
5136
+ var InboxCredentialQueryValidator = z.object({
5137
+ currentStatus: LCNInboxStatusEnumValidator,
5138
+ id: z.string(),
5139
+ isSigned: z.boolean(),
5140
+ issuerDid: z.string()
5141
+ }).partial();
5142
+ var IssueInboxSigningAuthorityValidator = z.object({
5143
+ endpoint: z.string().url(),
5144
+ name: z.string()
5145
+ });
5146
+ var IssueInboxCredentialValidator = z.object({
5147
+ recipient: ContactMethodQueryValidator.describe("The recipient of the credential"),
5148
+ credential: VCValidator.passthrough().or(VPValidator.passthrough()).or(UnsignedVCValidator.passthrough()).describe("The credential to issue. If not signed, the users default signing authority will be used, or the specified signing authority in the configuration."),
5149
+ configuration: z.object({
5150
+ signingAuthority: IssueInboxSigningAuthorityValidator.optional().describe("The signing authority to use for the credential. If not provided, the users default signing authority will be used if the credential is not signed."),
5151
+ webhookUrl: z.string().url().optional().describe("The webhook URL to receive credential issuance events."),
5152
+ expiresInDays: z.number().min(1).max(365).optional().describe("The number of days the credential will be valid for."),
5153
+ delivery: z.object({
5154
+ suppress: z.boolean().optional().default(false).describe("Whether to suppress delivery of the credential to the recipient. If true, the email/sms will not be sent to the recipient. Useful if you would like to manually send claim link to your users."),
5155
+ template: z.object({
5156
+ id: z.enum(["universal-inbox-claim"]).optional().describe("The template ID to use for the credential delivery. If not provided, the default template will be used."),
5157
+ model: z.object({
5158
+ issuer: z.object({
5159
+ name: z.string().optional().describe('The name of the organization (e.g., "State University").'),
5160
+ logoUrl: z.string().url().optional().describe("The URL of the organization's logo.")
5161
+ }).optional(),
5162
+ credential: z.object({
5163
+ name: z.string().optional().describe('The name of the credential (e.g., "Bachelor of Science").'),
5164
+ type: z.string().optional().describe('The type of the credential (e.g., "degree", "certificate").')
5165
+ }).optional(),
5166
+ recipient: z.object({
5167
+ name: z.string().optional().describe('The name of the recipient (e.g., "John Doe").')
5168
+ }).optional()
5169
+ }).describe("The template model to use for the credential delivery. Injects via template variables into email/sms templates. If not provided, the default template will be used.")
5170
+ }).optional().describe("The template to use for the credential delivery. If not provided, the default template will be used.")
5171
+ }).optional().describe("Configuration for the credential delivery i.e. email or SMS. When credentials are sent to a user who has a verified email or phone associated with their account, delivery is skipped, and the credential will be sent using in-app notifications. If not provided, the default configuration will be used.")
5172
+ }).optional().describe("Configuration for the credential issuance. If not provided, the default configuration will be used.")
5173
+ });
5174
+ var IssueInboxCredentialResponseValidator = z.object({
5175
+ issuanceId: z.string(),
5176
+ status: LCNInboxStatusEnumValidator,
5177
+ recipient: ContactMethodQueryValidator,
5178
+ claimUrl: z.string().url().optional(),
5179
+ recipientDid: z.string().optional()
5180
+ });
5181
+ var ClaimTokenValidator = z.object({
5182
+ token: z.string(),
5183
+ contactMethodId: z.string(),
5184
+ createdAt: z.string(),
5185
+ expiresAt: z.string(),
5186
+ used: z.boolean()
5187
+ });
5033
5188
  }
5034
5189
  });
5035
5190
 
@@ -5050,7 +5205,8 @@ var src_exports = {};
5050
5205
  __export(src_exports, {
5051
5206
  RegExpTransformer: () => RegExpTransformer,
5052
5207
  isEncrypted: () => isEncrypted,
5053
- isHex: () => isHex
5208
+ isHex: () => isHex,
5209
+ isVC2Format: () => isVC2Format
5054
5210
  });
5055
5211
  module.exports = __toCommonJS(src_exports);
5056
5212
  var import_types = __toESM(require_dist());
@@ -5085,3 +5241,9 @@ var RegExpTransformer = {
5085
5241
  });
5086
5242
  }
5087
5243
  };
5244
+ var isVC2Format = /* @__PURE__ */ __name((credential) => {
5245
+ if (!credential["@context"] || !Array.isArray(credential["@context"])) {
5246
+ return false;
5247
+ }
5248
+ return credential["@context"].includes("https://www.w3.org/ns/credentials/v2");
5249
+ }, "isVC2Format");