@learncard/types 5.7.1 → 5.8.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.
package/dist/types.esm.js CHANGED
@@ -506,7 +506,7 @@ var LCNProfileValidator = z9.object({
506
506
  bio: z9.string().default("").describe("Longer bio for the profile."),
507
507
  did: z9.string().describe("Decentralized Identifier for the profile. (auto-assigned)"),
508
508
  isPrivate: z9.boolean().optional().describe("Whether the profile is private or not and shows up in search results."),
509
- email: z9.string().optional().describe("Contact email address for the profile."),
509
+ email: z9.string().optional().describe("Contact email address for the profile. (deprecated)"),
510
510
  image: z9.string().optional().describe("Profile image URL for the profile."),
511
511
  heroImage: z9.string().optional().describe("Hero image URL for the profile."),
512
512
  websiteLink: z9.string().optional().describe("Website link for the profile."),
@@ -675,7 +675,8 @@ var LCNSigningAuthorityForUserValidator = z9.object({
675
675
  name: z9.string().max(15).regex(/^[a-z0-9-]+$/, {
676
676
  message: "The input string must contain only lowercase letters, numbers, and hyphens."
677
677
  }),
678
- did: z9.string()
678
+ did: z9.string(),
679
+ isPrimary: z9.boolean().optional()
679
680
  })
680
681
  });
681
682
  var AutoBoostConfigValidator = z9.object({
@@ -689,12 +690,12 @@ var ConsentFlowTermsStatusValidator = z9.enum(["live", "stale", "withdrawn"]);
689
690
  var ConsentFlowContractValidator = z9.object({
690
691
  read: z9.object({
691
692
  anonymize: z9.boolean().optional(),
692
- credentials: z9.object({ categories: z9.record(z9.object({ required: z9.boolean() })).default({}) }).default({}),
693
- personal: z9.record(z9.object({ required: z9.boolean() })).default({})
693
+ credentials: z9.object({ categories: z9.record(z9.object({ required: z9.boolean(), defaultEnabled: z9.boolean().optional() })).default({}) }).default({}),
694
+ personal: z9.record(z9.object({ required: z9.boolean(), defaultEnabled: z9.boolean().optional() })).default({})
694
695
  }).default({}),
695
696
  write: z9.object({
696
- credentials: z9.object({ categories: z9.record(z9.object({ required: z9.boolean() })).default({}) }).default({}),
697
- personal: z9.record(z9.object({ required: z9.boolean() })).default({})
697
+ credentials: z9.object({ categories: z9.record(z9.object({ required: z9.boolean(), defaultEnabled: z9.boolean().optional() })).default({}) }).default({}),
698
+ personal: z9.record(z9.object({ required: z9.boolean(), defaultEnabled: z9.boolean().optional() })).default({})
698
699
  }).default({})
699
700
  });
700
701
  var ConsentFlowContractDetailsValidator = z9.object({
@@ -856,16 +857,33 @@ var LCNNotificationTypeEnumValidator = z9.enum([
856
857
  "BOOST_ACCEPTED",
857
858
  "PRESENTATION_REQUEST",
858
859
  "PRESENTATION_RECEIVED",
859
- "CONSENT_FLOW_TRANSACTION"
860
+ "CONSENT_FLOW_TRANSACTION",
861
+ "ISSUANCE_CLAIMED",
862
+ "ISSUANCE_DELIVERED"
860
863
  ]);
861
864
  var LCNNotificationMessageValidator = z9.object({
862
865
  title: z9.string().optional(),
863
866
  body: z9.string().optional()
864
867
  });
868
+ var LCNInboxContactMethodValidator = z9.object({
869
+ type: z9.string(),
870
+ value: z9.string()
871
+ });
872
+ var LCNInboxStatusEnumValidator = z9.enum(["PENDING", "DELIVERED", "CLAIMED", "EXPIRED"]);
873
+ var LCNNotificationInboxValidator = z9.object({
874
+ issuanceId: z9.string(),
875
+ status: LCNInboxStatusEnumValidator,
876
+ recipient: z9.object({
877
+ contactMethod: LCNInboxContactMethodValidator.optional(),
878
+ learnCardId: z9.string().optional()
879
+ }),
880
+ timestamp: z9.string().datetime().optional()
881
+ });
865
882
  var LCNNotificationDataValidator = z9.object({
866
883
  vcUris: z9.array(z9.string()).optional(),
867
884
  vpUris: z9.array(z9.string()).optional(),
868
- transaction: ConsentFlowTransactionValidator.optional()
885
+ transaction: ConsentFlowTransactionValidator.optional(),
886
+ inbox: LCNNotificationInboxValidator.optional()
869
887
  });
870
888
  var LCNNotificationValidator = z9.object({
871
889
  type: LCNNotificationTypeEnumValidator,
@@ -873,7 +891,8 @@ var LCNNotificationValidator = z9.object({
873
891
  from: LCNProfileValidator.partial().and(z9.object({ did: z9.string() })),
874
892
  message: LCNNotificationMessageValidator.optional(),
875
893
  data: LCNNotificationDataValidator.optional(),
876
- sent: z9.string().datetime().optional()
894
+ sent: z9.string().datetime().optional(),
895
+ webhookUrl: z9.string().optional()
877
896
  });
878
897
  var AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX = "auth-grant:";
879
898
  var AuthGrantValidator = z9.object({
@@ -897,6 +916,135 @@ var AuthGrantQueryValidator = z9.object({
897
916
  description: StringQuery,
898
917
  status: AuthGrantStatusValidator
899
918
  }).partial();
919
+ var contactMethodBase = z9.object({
920
+ id: z9.string(),
921
+ isVerified: z9.boolean(),
922
+ verifiedAt: z9.string().optional(),
923
+ isPrimary: z9.boolean(),
924
+ createdAt: z9.string()
925
+ });
926
+ var ContactMethodValidator = z9.discriminatedUnion("type", [
927
+ z9.object({
928
+ type: z9.literal("email"),
929
+ value: z9.string().email()
930
+ }).merge(contactMethodBase),
931
+ z9.object({
932
+ type: z9.literal("phone"),
933
+ value: z9.string()
934
+ // Can be improved with a regex later
935
+ }).merge(contactMethodBase)
936
+ ]);
937
+ var createContactMethodBase = z9.object({
938
+ isVerified: z9.boolean().optional(),
939
+ isPrimary: z9.boolean().optional()
940
+ });
941
+ var ContactMethodCreateValidator = z9.discriminatedUnion("type", [
942
+ z9.object({
943
+ type: z9.literal("email"),
944
+ value: z9.string().email()
945
+ }).merge(createContactMethodBase),
946
+ z9.object({
947
+ type: z9.literal("phone"),
948
+ value: z9.string()
949
+ }).merge(createContactMethodBase)
950
+ ]);
951
+ var ContactMethodQueryValidator = z9.discriminatedUnion("type", [
952
+ z9.object({
953
+ type: z9.literal("email"),
954
+ value: z9.string().email()
955
+ }),
956
+ z9.object({
957
+ type: z9.literal("phone"),
958
+ value: z9.string()
959
+ })
960
+ ]);
961
+ var ContactMethodVerificationRequestValidator = z9.object({
962
+ value: z9.string(),
963
+ type: z9.enum(["email", "phone"])
964
+ });
965
+ var ContactMethodVerificationValidator = z9.object({
966
+ token: z9.string()
967
+ });
968
+ var SetPrimaryContactMethodValidator = z9.object({
969
+ contactMethodId: z9.string()
970
+ });
971
+ var InboxCredentialValidator = z9.object({
972
+ id: z9.string(),
973
+ credential: z9.string(),
974
+ isSigned: z9.boolean(),
975
+ currentStatus: LCNInboxStatusEnumValidator,
976
+ expiresAt: z9.string(),
977
+ createdAt: z9.string(),
978
+ issuerDid: z9.string(),
979
+ webhookUrl: z9.string().optional(),
980
+ "signingAuthority.endpoint": z9.string().optional(),
981
+ "signingAuthority.name": z9.string().optional()
982
+ });
983
+ var PaginatedInboxCredentialsValidator = z9.object({
984
+ hasMore: z9.boolean(),
985
+ records: z9.array(InboxCredentialValidator),
986
+ cursor: z9.string().optional()
987
+ });
988
+ var InboxCredentialQueryValidator = z9.object({
989
+ currentStatus: LCNInboxStatusEnumValidator,
990
+ id: z9.string(),
991
+ isSigned: z9.boolean(),
992
+ issuerDid: z9.string()
993
+ }).partial();
994
+ var IssueInboxSigningAuthorityValidator = z9.object({
995
+ endpoint: z9.string().url(),
996
+ name: z9.string()
997
+ });
998
+ var IssueInboxCredentialValidator = z9.object({
999
+ // === CORE DATA (Required) ===
1000
+ // WHAT is being sent and WHO is it for?
1001
+ recipient: ContactMethodQueryValidator.describe("The recipient of the credential"),
1002
+ 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."),
1003
+ // === OPTIONAL FEATURES ===
1004
+ // Add major, distinct features at the top level.
1005
+ //consentRequest: ConsentRequestValidator.optional(),
1006
+ // === PROCESS CONFIGURATION (Optional) ===
1007
+ // HOW should this issuance be handled?
1008
+ configuration: z9.object({
1009
+ 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."),
1010
+ webhookUrl: z9.string().url().optional().describe("The webhook URL to receive credential issuance events."),
1011
+ expiresInDays: z9.number().min(1).max(365).optional().describe("The number of days the credential will be valid for."),
1012
+ // --- For User-Facing Delivery (Email/SMS) ---
1013
+ delivery: z9.object({
1014
+ suppress: z9.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."),
1015
+ template: z9.object({
1016
+ id: z9.enum(["universal-inbox-claim"]).optional().describe("The template ID to use for the credential delivery. If not provided, the default template will be used."),
1017
+ model: z9.object({
1018
+ issuer: z9.object({
1019
+ name: z9.string().optional().describe('The name of the organization (e.g., "State University").'),
1020
+ logoUrl: z9.string().url().optional().describe("The URL of the organization's logo.")
1021
+ }).optional(),
1022
+ credential: z9.object({
1023
+ name: z9.string().optional().describe('The name of the credential (e.g., "Bachelor of Science").'),
1024
+ type: z9.string().optional().describe('The type of the credential (e.g., "degree", "certificate").')
1025
+ }).optional(),
1026
+ recipient: z9.object({
1027
+ name: z9.string().optional().describe('The name of the recipient (e.g., "John Doe").')
1028
+ }).optional()
1029
+ }).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.")
1030
+ }).optional().describe("The template to use for the credential delivery. If not provided, the default template will be used.")
1031
+ }).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.")
1032
+ }).optional().describe("Configuration for the credential issuance. If not provided, the default configuration will be used.")
1033
+ });
1034
+ var IssueInboxCredentialResponseValidator = z9.object({
1035
+ issuanceId: z9.string(),
1036
+ status: LCNInboxStatusEnumValidator,
1037
+ recipient: ContactMethodQueryValidator,
1038
+ claimUrl: z9.string().url().optional(),
1039
+ recipientDid: z9.string().optional()
1040
+ });
1041
+ var ClaimTokenValidator = z9.object({
1042
+ token: z9.string(),
1043
+ contactMethodId: z9.string(),
1044
+ createdAt: z9.string(),
1045
+ expiresAt: z9.string(),
1046
+ used: z9.boolean()
1047
+ });
900
1048
  export {
901
1049
  AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX,
902
1050
  AchievementCredentialValidator,
@@ -919,6 +1067,7 @@ export {
919
1067
  ClaimHookQueryValidator,
920
1068
  ClaimHookTypeValidator,
921
1069
  ClaimHookValidator,
1070
+ ClaimTokenValidator,
922
1071
  ConsentFlowContractDataForDidValidator,
923
1072
  ConsentFlowContractDataValidator,
924
1073
  ConsentFlowContractDetailsValidator,
@@ -933,6 +1082,11 @@ export {
933
1082
  ConsentFlowTransactionActionValidator,
934
1083
  ConsentFlowTransactionValidator,
935
1084
  ConsentFlowTransactionsQueryValidator,
1085
+ ContactMethodCreateValidator,
1086
+ ContactMethodQueryValidator,
1087
+ ContactMethodValidator,
1088
+ ContactMethodVerificationRequestValidator,
1089
+ ContactMethodVerificationValidator,
936
1090
  ContextValidator,
937
1091
  ContractCredentialValidator,
938
1092
  CredentialInfoValidator,
@@ -954,6 +1108,11 @@ export {
954
1108
  IdentifierTypeValidator,
955
1109
  IdentityObjectValidator,
956
1110
  ImageValidator,
1111
+ InboxCredentialQueryValidator,
1112
+ InboxCredentialValidator,
1113
+ IssueInboxCredentialResponseValidator,
1114
+ IssueInboxCredentialValidator,
1115
+ IssueInboxSigningAuthorityValidator,
957
1116
  JWERecipientHeaderValidator,
958
1117
  JWERecipientValidator,
959
1118
  JWEValidator,
@@ -963,7 +1122,10 @@ export {
963
1122
  LCNBoostClaimLinkOptionsValidator,
964
1123
  LCNBoostClaimLinkSigningAuthorityValidator,
965
1124
  LCNBoostStatus,
1125
+ LCNInboxContactMethodValidator,
1126
+ LCNInboxStatusEnumValidator,
966
1127
  LCNNotificationDataValidator,
1128
+ LCNNotificationInboxValidator,
967
1129
  LCNNotificationMessageValidator,
968
1130
  LCNNotificationTypeEnumValidator,
969
1131
  LCNNotificationValidator,
@@ -986,6 +1148,7 @@ export {
986
1148
  PaginatedContractCredentialsValidator,
987
1149
  PaginatedEncryptedCredentialRecordsValidator,
988
1150
  PaginatedEncryptedRecordsValidator,
1151
+ PaginatedInboxCredentialsValidator,
989
1152
  PaginatedLCNProfileManagersValidator,
990
1153
  PaginatedLCNProfilesAndManagersValidator,
991
1154
  PaginatedLCNProfilesValidator,
@@ -1003,6 +1166,7 @@ export {
1003
1166
  RubricCriterionValidator,
1004
1167
  SentCredentialInfoValidator,
1005
1168
  ServiceValidator,
1169
+ SetPrimaryContactMethodValidator,
1006
1170
  StringQuery,
1007
1171
  TermsOfUseValidator,
1008
1172
  UnsignedAchievementCredentialValidator,