@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.
- package/dist/helpers.cjs.development.js +168 -6
- package/dist/helpers.cjs.development.js.map +2 -2
- package/dist/helpers.cjs.production.min.js +1 -1
- package/dist/helpers.cjs.production.min.js.map +3 -3
- package/dist/helpers.d.ts +4109 -0
- package/dist/helpers.esm.js +168 -6
- package/dist/helpers.esm.js.map +2 -2
- package/package.json +2 -2
package/dist/helpers.esm.js
CHANGED
@@ -66,6 +66,7 @@ var require_types_cjs_development = __commonJS({
|
|
66
66
|
ClaimHookQueryValidator: () => ClaimHookQueryValidator,
|
67
67
|
ClaimHookTypeValidator: () => ClaimHookTypeValidator,
|
68
68
|
ClaimHookValidator: () => ClaimHookValidator,
|
69
|
+
ClaimTokenValidator: () => ClaimTokenValidator,
|
69
70
|
ConsentFlowContractDataForDidValidator: () => ConsentFlowContractDataForDidValidator,
|
70
71
|
ConsentFlowContractDataValidator: () => ConsentFlowContractDataValidator,
|
71
72
|
ConsentFlowContractDetailsValidator: () => ConsentFlowContractDetailsValidator,
|
@@ -80,6 +81,11 @@ var require_types_cjs_development = __commonJS({
|
|
80
81
|
ConsentFlowTransactionActionValidator: () => ConsentFlowTransactionActionValidator,
|
81
82
|
ConsentFlowTransactionValidator: () => ConsentFlowTransactionValidator,
|
82
83
|
ConsentFlowTransactionsQueryValidator: () => ConsentFlowTransactionsQueryValidator,
|
84
|
+
ContactMethodCreateValidator: () => ContactMethodCreateValidator,
|
85
|
+
ContactMethodQueryValidator: () => ContactMethodQueryValidator,
|
86
|
+
ContactMethodValidator: () => ContactMethodValidator,
|
87
|
+
ContactMethodVerificationRequestValidator: () => ContactMethodVerificationRequestValidator,
|
88
|
+
ContactMethodVerificationValidator: () => ContactMethodVerificationValidator,
|
83
89
|
ContextValidator: () => ContextValidator,
|
84
90
|
ContractCredentialValidator: () => ContractCredentialValidator,
|
85
91
|
CredentialInfoValidator: () => CredentialInfoValidator,
|
@@ -101,6 +107,11 @@ var require_types_cjs_development = __commonJS({
|
|
101
107
|
IdentifierTypeValidator: () => IdentifierTypeValidator,
|
102
108
|
IdentityObjectValidator: () => IdentityObjectValidator,
|
103
109
|
ImageValidator: () => ImageValidator,
|
110
|
+
InboxCredentialQueryValidator: () => InboxCredentialQueryValidator,
|
111
|
+
InboxCredentialValidator: () => InboxCredentialValidator,
|
112
|
+
IssueInboxCredentialResponseValidator: () => IssueInboxCredentialResponseValidator,
|
113
|
+
IssueInboxCredentialValidator: () => IssueInboxCredentialValidator,
|
114
|
+
IssueInboxSigningAuthorityValidator: () => IssueInboxSigningAuthorityValidator,
|
104
115
|
JWERecipientHeaderValidator: () => JWERecipientHeaderValidator,
|
105
116
|
JWERecipientValidator: () => JWERecipientValidator,
|
106
117
|
JWEValidator: () => JWEValidator2,
|
@@ -110,7 +121,10 @@ var require_types_cjs_development = __commonJS({
|
|
110
121
|
LCNBoostClaimLinkOptionsValidator: () => LCNBoostClaimLinkOptionsValidator,
|
111
122
|
LCNBoostClaimLinkSigningAuthorityValidator: () => LCNBoostClaimLinkSigningAuthorityValidator,
|
112
123
|
LCNBoostStatus: () => LCNBoostStatus,
|
124
|
+
LCNInboxContactMethodValidator: () => LCNInboxContactMethodValidator,
|
125
|
+
LCNInboxStatusEnumValidator: () => LCNInboxStatusEnumValidator,
|
113
126
|
LCNNotificationDataValidator: () => LCNNotificationDataValidator,
|
127
|
+
LCNNotificationInboxValidator: () => LCNNotificationInboxValidator,
|
114
128
|
LCNNotificationMessageValidator: () => LCNNotificationMessageValidator,
|
115
129
|
LCNNotificationTypeEnumValidator: () => LCNNotificationTypeEnumValidator,
|
116
130
|
LCNNotificationValidator: () => LCNNotificationValidator,
|
@@ -133,6 +147,7 @@ var require_types_cjs_development = __commonJS({
|
|
133
147
|
PaginatedContractCredentialsValidator: () => PaginatedContractCredentialsValidator,
|
134
148
|
PaginatedEncryptedCredentialRecordsValidator: () => PaginatedEncryptedCredentialRecordsValidator,
|
135
149
|
PaginatedEncryptedRecordsValidator: () => PaginatedEncryptedRecordsValidator,
|
150
|
+
PaginatedInboxCredentialsValidator: () => PaginatedInboxCredentialsValidator,
|
136
151
|
PaginatedLCNProfileManagersValidator: () => PaginatedLCNProfileManagersValidator,
|
137
152
|
PaginatedLCNProfilesAndManagersValidator: () => PaginatedLCNProfilesAndManagersValidator,
|
138
153
|
PaginatedLCNProfilesValidator: () => PaginatedLCNProfilesValidator,
|
@@ -150,6 +165,7 @@ var require_types_cjs_development = __commonJS({
|
|
150
165
|
RubricCriterionValidator: () => RubricCriterionValidator,
|
151
166
|
SentCredentialInfoValidator: () => SentCredentialInfoValidator,
|
152
167
|
ServiceValidator: () => ServiceValidator,
|
168
|
+
SetPrimaryContactMethodValidator: () => SetPrimaryContactMethodValidator,
|
153
169
|
StringQuery: () => StringQuery,
|
154
170
|
TermsOfUseValidator: () => TermsOfUseValidator,
|
155
171
|
UnsignedAchievementCredentialValidator: () => UnsignedAchievementCredentialValidator,
|
@@ -4634,7 +4650,7 @@ var require_types_cjs_development = __commonJS({
|
|
4634
4650
|
bio: z.string().default("").describe("Longer bio for the profile."),
|
4635
4651
|
did: z.string().describe("Decentralized Identifier for the profile. (auto-assigned)"),
|
4636
4652
|
isPrivate: z.boolean().optional().describe("Whether the profile is private or not and shows up in search results."),
|
4637
|
-
email: z.string().optional().describe("Contact email address for the profile."),
|
4653
|
+
email: z.string().optional().describe("Contact email address for the profile. (deprecated)"),
|
4638
4654
|
image: z.string().optional().describe("Profile image URL for the profile."),
|
4639
4655
|
heroImage: z.string().optional().describe("Hero image URL for the profile."),
|
4640
4656
|
websiteLink: z.string().optional().describe("Website link for the profile."),
|
@@ -4803,7 +4819,8 @@ var require_types_cjs_development = __commonJS({
|
|
4803
4819
|
name: z.string().max(15).regex(/^[a-z0-9-]+$/, {
|
4804
4820
|
message: "The input string must contain only lowercase letters, numbers, and hyphens."
|
4805
4821
|
}),
|
4806
|
-
did: z.string()
|
4822
|
+
did: z.string(),
|
4823
|
+
isPrimary: z.boolean().optional()
|
4807
4824
|
})
|
4808
4825
|
});
|
4809
4826
|
var AutoBoostConfigValidator = z.object({
|
@@ -4984,16 +5001,33 @@ var require_types_cjs_development = __commonJS({
|
|
4984
5001
|
"BOOST_ACCEPTED",
|
4985
5002
|
"PRESENTATION_REQUEST",
|
4986
5003
|
"PRESENTATION_RECEIVED",
|
4987
|
-
"CONSENT_FLOW_TRANSACTION"
|
5004
|
+
"CONSENT_FLOW_TRANSACTION",
|
5005
|
+
"ISSUANCE_CLAIMED",
|
5006
|
+
"ISSUANCE_DELIVERED"
|
4988
5007
|
]);
|
4989
5008
|
var LCNNotificationMessageValidator = z.object({
|
4990
5009
|
title: z.string().optional(),
|
4991
5010
|
body: z.string().optional()
|
4992
5011
|
});
|
5012
|
+
var LCNInboxContactMethodValidator = z.object({
|
5013
|
+
type: z.string(),
|
5014
|
+
value: z.string()
|
5015
|
+
});
|
5016
|
+
var LCNInboxStatusEnumValidator = z.enum(["PENDING", "DELIVERED", "CLAIMED", "EXPIRED"]);
|
5017
|
+
var LCNNotificationInboxValidator = z.object({
|
5018
|
+
issuanceId: z.string(),
|
5019
|
+
status: LCNInboxStatusEnumValidator,
|
5020
|
+
recipient: z.object({
|
5021
|
+
contactMethod: LCNInboxContactMethodValidator.optional(),
|
5022
|
+
learnCardId: z.string().optional()
|
5023
|
+
}),
|
5024
|
+
timestamp: z.string().datetime().optional()
|
5025
|
+
});
|
4993
5026
|
var LCNNotificationDataValidator = z.object({
|
4994
5027
|
vcUris: z.array(z.string()).optional(),
|
4995
5028
|
vpUris: z.array(z.string()).optional(),
|
4996
|
-
transaction: ConsentFlowTransactionValidator.optional()
|
5029
|
+
transaction: ConsentFlowTransactionValidator.optional(),
|
5030
|
+
inbox: LCNNotificationInboxValidator.optional()
|
4997
5031
|
});
|
4998
5032
|
var LCNNotificationValidator = z.object({
|
4999
5033
|
type: LCNNotificationTypeEnumValidator,
|
@@ -5001,7 +5035,8 @@ var require_types_cjs_development = __commonJS({
|
|
5001
5035
|
from: LCNProfileValidator.partial().and(z.object({ did: z.string() })),
|
5002
5036
|
message: LCNNotificationMessageValidator.optional(),
|
5003
5037
|
data: LCNNotificationDataValidator.optional(),
|
5004
|
-
sent: z.string().datetime().optional()
|
5038
|
+
sent: z.string().datetime().optional(),
|
5039
|
+
webhookUrl: z.string().optional()
|
5005
5040
|
});
|
5006
5041
|
var AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX = "auth-grant:";
|
5007
5042
|
var AuthGrantValidator = z.object({
|
@@ -5025,6 +5060,126 @@ var require_types_cjs_development = __commonJS({
|
|
5025
5060
|
description: StringQuery,
|
5026
5061
|
status: AuthGrantStatusValidator
|
5027
5062
|
}).partial();
|
5063
|
+
var contactMethodBase = z.object({
|
5064
|
+
id: z.string(),
|
5065
|
+
isVerified: z.boolean(),
|
5066
|
+
verifiedAt: z.string().optional(),
|
5067
|
+
isPrimary: z.boolean(),
|
5068
|
+
createdAt: z.string()
|
5069
|
+
});
|
5070
|
+
var ContactMethodValidator = z.discriminatedUnion("type", [
|
5071
|
+
z.object({
|
5072
|
+
type: z.literal("email"),
|
5073
|
+
value: z.string().email()
|
5074
|
+
}).merge(contactMethodBase),
|
5075
|
+
z.object({
|
5076
|
+
type: z.literal("phone"),
|
5077
|
+
value: z.string()
|
5078
|
+
}).merge(contactMethodBase)
|
5079
|
+
]);
|
5080
|
+
var createContactMethodBase = z.object({
|
5081
|
+
isVerified: z.boolean().optional(),
|
5082
|
+
isPrimary: z.boolean().optional()
|
5083
|
+
});
|
5084
|
+
var ContactMethodCreateValidator = z.discriminatedUnion("type", [
|
5085
|
+
z.object({
|
5086
|
+
type: z.literal("email"),
|
5087
|
+
value: z.string().email()
|
5088
|
+
}).merge(createContactMethodBase),
|
5089
|
+
z.object({
|
5090
|
+
type: z.literal("phone"),
|
5091
|
+
value: z.string()
|
5092
|
+
}).merge(createContactMethodBase)
|
5093
|
+
]);
|
5094
|
+
var ContactMethodQueryValidator = z.discriminatedUnion("type", [
|
5095
|
+
z.object({
|
5096
|
+
type: z.literal("email"),
|
5097
|
+
value: z.string().email()
|
5098
|
+
}),
|
5099
|
+
z.object({
|
5100
|
+
type: z.literal("phone"),
|
5101
|
+
value: z.string()
|
5102
|
+
})
|
5103
|
+
]);
|
5104
|
+
var ContactMethodVerificationRequestValidator = z.object({
|
5105
|
+
value: z.string(),
|
5106
|
+
type: z.enum(["email", "phone"])
|
5107
|
+
});
|
5108
|
+
var ContactMethodVerificationValidator = z.object({
|
5109
|
+
token: z.string()
|
5110
|
+
});
|
5111
|
+
var SetPrimaryContactMethodValidator = z.object({
|
5112
|
+
contactMethodId: z.string()
|
5113
|
+
});
|
5114
|
+
var InboxCredentialValidator = z.object({
|
5115
|
+
id: z.string(),
|
5116
|
+
credential: z.string(),
|
5117
|
+
isSigned: z.boolean(),
|
5118
|
+
currentStatus: LCNInboxStatusEnumValidator,
|
5119
|
+
expiresAt: z.string(),
|
5120
|
+
createdAt: z.string(),
|
5121
|
+
issuerDid: z.string(),
|
5122
|
+
webhookUrl: z.string().optional(),
|
5123
|
+
"signingAuthority.endpoint": z.string().optional(),
|
5124
|
+
"signingAuthority.name": z.string().optional()
|
5125
|
+
});
|
5126
|
+
var PaginatedInboxCredentialsValidator = z.object({
|
5127
|
+
hasMore: z.boolean(),
|
5128
|
+
records: z.array(InboxCredentialValidator),
|
5129
|
+
cursor: z.string().optional()
|
5130
|
+
});
|
5131
|
+
var InboxCredentialQueryValidator = z.object({
|
5132
|
+
currentStatus: LCNInboxStatusEnumValidator,
|
5133
|
+
id: z.string(),
|
5134
|
+
isSigned: z.boolean(),
|
5135
|
+
issuerDid: z.string()
|
5136
|
+
}).partial();
|
5137
|
+
var IssueInboxSigningAuthorityValidator = z.object({
|
5138
|
+
endpoint: z.string().url(),
|
5139
|
+
name: z.string()
|
5140
|
+
});
|
5141
|
+
var IssueInboxCredentialValidator = z.object({
|
5142
|
+
recipient: ContactMethodQueryValidator.describe("The recipient of the credential"),
|
5143
|
+
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."),
|
5144
|
+
configuration: z.object({
|
5145
|
+
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."),
|
5146
|
+
webhookUrl: z.string().url().optional().describe("The webhook URL to receive credential issuance events."),
|
5147
|
+
expiresInDays: z.number().min(1).max(365).optional().describe("The number of days the credential will be valid for."),
|
5148
|
+
delivery: z.object({
|
5149
|
+
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."),
|
5150
|
+
template: z.object({
|
5151
|
+
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."),
|
5152
|
+
model: z.object({
|
5153
|
+
issuer: z.object({
|
5154
|
+
name: z.string().optional().describe('The name of the organization (e.g., "State University").'),
|
5155
|
+
logoUrl: z.string().url().optional().describe("The URL of the organization's logo.")
|
5156
|
+
}).optional(),
|
5157
|
+
credential: z.object({
|
5158
|
+
name: z.string().optional().describe('The name of the credential (e.g., "Bachelor of Science").'),
|
5159
|
+
type: z.string().optional().describe('The type of the credential (e.g., "degree", "certificate").')
|
5160
|
+
}).optional(),
|
5161
|
+
recipient: z.object({
|
5162
|
+
name: z.string().optional().describe('The name of the recipient (e.g., "John Doe").')
|
5163
|
+
}).optional()
|
5164
|
+
}).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.")
|
5165
|
+
}).optional().describe("The template to use for the credential delivery. If not provided, the default template will be used.")
|
5166
|
+
}).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.")
|
5167
|
+
}).optional().describe("Configuration for the credential issuance. If not provided, the default configuration will be used.")
|
5168
|
+
});
|
5169
|
+
var IssueInboxCredentialResponseValidator = z.object({
|
5170
|
+
issuanceId: z.string(),
|
5171
|
+
status: LCNInboxStatusEnumValidator,
|
5172
|
+
recipient: ContactMethodQueryValidator,
|
5173
|
+
claimUrl: z.string().url().optional(),
|
5174
|
+
recipientDid: z.string().optional()
|
5175
|
+
});
|
5176
|
+
var ClaimTokenValidator = z.object({
|
5177
|
+
token: z.string(),
|
5178
|
+
contactMethodId: z.string(),
|
5179
|
+
createdAt: z.string(),
|
5180
|
+
expiresAt: z.string(),
|
5181
|
+
used: z.boolean()
|
5182
|
+
});
|
5028
5183
|
}
|
5029
5184
|
});
|
5030
5185
|
|
@@ -5073,8 +5228,15 @@ var RegExpTransformer = {
|
|
5073
5228
|
});
|
5074
5229
|
}
|
5075
5230
|
};
|
5231
|
+
var isVC2Format = /* @__PURE__ */ __name((credential) => {
|
5232
|
+
if (!credential["@context"] || !Array.isArray(credential["@context"])) {
|
5233
|
+
return false;
|
5234
|
+
}
|
5235
|
+
return credential["@context"].includes("https://www.w3.org/ns/credentials/v2");
|
5236
|
+
}, "isVC2Format");
|
5076
5237
|
export {
|
5077
5238
|
RegExpTransformer,
|
5078
5239
|
isEncrypted,
|
5079
|
-
isHex
|
5240
|
+
isHex,
|
5241
|
+
isVC2Format
|
5080
5242
|
};
|