@learncard/learn-cloud-plugin 2.3.41 → 2.3.43
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/learn-cloud-plugin.cjs.development.cjs +798 -169
- package/dist/learn-cloud-plugin.cjs.development.cjs.map +3 -3
- package/dist/learn-cloud-plugin.cjs.production.min.cjs +22 -22
- package/dist/learn-cloud-plugin.cjs.production.min.cjs.map +3 -3
- package/dist/learn-cloud-plugin.esm.js +798 -169
- package/dist/learn-cloud-plugin.esm.js.map +3 -3
- package/package.json +7 -7
|
@@ -21683,6 +21683,204 @@ var StringQuery = external_exports.union([
|
|
|
21683
21683
|
$or: BaseStringQuery.array()
|
|
21684
21684
|
})
|
|
21685
21685
|
]);
|
|
21686
|
+
var LearnCardRefreshAuthorizationValidator = external_exports.object({ type: external_exports.literal("LearnCardDIDAuth") }).catchall(external_exports.any());
|
|
21687
|
+
var ManagedCredentialRefreshServiceValidator = external_exports.object({
|
|
21688
|
+
id: external_exports.string().min(1),
|
|
21689
|
+
type: external_exports.literal("LearnCardCredentialRefresh2026"),
|
|
21690
|
+
authorization: LearnCardRefreshAuthorizationValidator.optional()
|
|
21691
|
+
}).catchall(external_exports.any());
|
|
21692
|
+
var StandardCredentialRefreshServiceValidator = external_exports.object({
|
|
21693
|
+
id: external_exports.string().min(1),
|
|
21694
|
+
type: external_exports.literal("1EdTechCredentialRefresh")
|
|
21695
|
+
}).catchall(external_exports.any());
|
|
21696
|
+
var SupportedCredentialRefreshServiceValidator = external_exports.union([
|
|
21697
|
+
ManagedCredentialRefreshServiceValidator,
|
|
21698
|
+
StandardCredentialRefreshServiceValidator
|
|
21699
|
+
]);
|
|
21700
|
+
var AllocateCredentialRefreshInputValidator = external_exports.object({
|
|
21701
|
+
holder: external_exports.object({
|
|
21702
|
+
profileId: external_exports.string().optional(),
|
|
21703
|
+
did: external_exports.string().min(1)
|
|
21704
|
+
}),
|
|
21705
|
+
credentialId: external_exports.string().min(1)
|
|
21706
|
+
});
|
|
21707
|
+
var AllocateCredentialRefreshResultValidator = external_exports.object({
|
|
21708
|
+
refreshId: external_exports.string().min(1),
|
|
21709
|
+
refreshService: ManagedCredentialRefreshServiceValidator.extend({
|
|
21710
|
+
authorization: LearnCardRefreshAuthorizationValidator
|
|
21711
|
+
})
|
|
21712
|
+
});
|
|
21713
|
+
var ManagedCredentialRefreshReceiptValidator = external_exports.object({
|
|
21714
|
+
refreshId: external_exports.string().min(1),
|
|
21715
|
+
refreshService: ManagedCredentialRefreshServiceValidator,
|
|
21716
|
+
credentialId: external_exports.string().min(1),
|
|
21717
|
+
issuerDid: external_exports.string().min(1),
|
|
21718
|
+
holderDid: external_exports.string().min(1),
|
|
21719
|
+
credentialStatus: CredentialStatusValidator.or(
|
|
21720
|
+
CredentialStatusValidator.array()
|
|
21721
|
+
).optional()
|
|
21722
|
+
}).strip();
|
|
21723
|
+
var InboxCredentialRefreshReceiptValidator = ManagedCredentialRefreshReceiptValidator.omit(
|
|
21724
|
+
{ holderDid: true }
|
|
21725
|
+
).extend({ holderDid: external_exports.string().min(1).optional() });
|
|
21726
|
+
var CredentialRefreshSigningModeValidator = external_exports.enum(["issuer-signed", "signing-authority"]);
|
|
21727
|
+
var PublishCredentialRefreshBaseFields = {
|
|
21728
|
+
refreshId: external_exports.string().min(1),
|
|
21729
|
+
notifyHolder: external_exports.boolean().optional(),
|
|
21730
|
+
updateSummary: external_exports.string().optional(),
|
|
21731
|
+
idempotencyKey: external_exports.string().optional()
|
|
21732
|
+
};
|
|
21733
|
+
var PublishIssuerSignedRefreshValidator = external_exports.object({
|
|
21734
|
+
...PublishCredentialRefreshBaseFields,
|
|
21735
|
+
mode: external_exports.literal("issuer-signed"),
|
|
21736
|
+
signedCredential: VCValidator
|
|
21737
|
+
});
|
|
21738
|
+
var PublishSigningAuthorityRefreshValidator = external_exports.object({
|
|
21739
|
+
...PublishCredentialRefreshBaseFields,
|
|
21740
|
+
mode: external_exports.literal("signing-authority"),
|
|
21741
|
+
credential: UnsignedVCValidator,
|
|
21742
|
+
signingAuthority: external_exports.object({
|
|
21743
|
+
type: external_exports.string().min(1)
|
|
21744
|
+
}).catchall(external_exports.any())
|
|
21745
|
+
});
|
|
21746
|
+
var PublishCredentialRefreshInputValidator = external_exports.object({
|
|
21747
|
+
...PublishCredentialRefreshBaseFields,
|
|
21748
|
+
mode: CredentialRefreshSigningModeValidator,
|
|
21749
|
+
signedCredential: VCValidator.optional(),
|
|
21750
|
+
credential: UnsignedVCValidator.optional(),
|
|
21751
|
+
signingAuthority: external_exports.object({
|
|
21752
|
+
type: external_exports.string().min(1)
|
|
21753
|
+
}).catchall(external_exports.any()).optional()
|
|
21754
|
+
}).superRefine((input, ctx) => {
|
|
21755
|
+
if (input.mode === "issuer-signed" && !input.signedCredential) {
|
|
21756
|
+
ctx.addIssue({
|
|
21757
|
+
code: "custom",
|
|
21758
|
+
path: ["signedCredential"],
|
|
21759
|
+
message: "signedCredential is required for issuer-signed publication"
|
|
21760
|
+
});
|
|
21761
|
+
}
|
|
21762
|
+
if (input.mode === "issuer-signed" && (input.credential !== void 0 || input.signingAuthority !== void 0)) {
|
|
21763
|
+
ctx.addIssue({
|
|
21764
|
+
code: "custom",
|
|
21765
|
+
path: ["mode"],
|
|
21766
|
+
message: "issuer-signed publication cannot include signing-authority fields"
|
|
21767
|
+
});
|
|
21768
|
+
}
|
|
21769
|
+
if (input.mode === "signing-authority") {
|
|
21770
|
+
if (input.signedCredential !== void 0) {
|
|
21771
|
+
ctx.addIssue({
|
|
21772
|
+
code: "custom",
|
|
21773
|
+
path: ["signedCredential"],
|
|
21774
|
+
message: "signing-authority publication cannot include signedCredential"
|
|
21775
|
+
});
|
|
21776
|
+
}
|
|
21777
|
+
if (!input.credential) {
|
|
21778
|
+
ctx.addIssue({
|
|
21779
|
+
code: "custom",
|
|
21780
|
+
path: ["credential"],
|
|
21781
|
+
message: "credential is required for signing-authority publication"
|
|
21782
|
+
});
|
|
21783
|
+
}
|
|
21784
|
+
if (!input.signingAuthority) {
|
|
21785
|
+
ctx.addIssue({
|
|
21786
|
+
code: "custom",
|
|
21787
|
+
path: ["signingAuthority"],
|
|
21788
|
+
message: "signingAuthority is required for signing-authority publication"
|
|
21789
|
+
});
|
|
21790
|
+
}
|
|
21791
|
+
}
|
|
21792
|
+
});
|
|
21793
|
+
var PublishCredentialRefreshNotificationValidator = external_exports.enum([
|
|
21794
|
+
"queued",
|
|
21795
|
+
"suppressed",
|
|
21796
|
+
"not-applicable",
|
|
21797
|
+
/** Publication succeeded, but the post-commit notification enqueue must be retried. */
|
|
21798
|
+
"delivery-failed"
|
|
21799
|
+
]);
|
|
21800
|
+
var PublishCredentialRefreshResultValidator = external_exports.object({
|
|
21801
|
+
refreshId: external_exports.string().min(1),
|
|
21802
|
+
version: external_exports.number().int().positive(),
|
|
21803
|
+
publishedAt: external_exports.string().min(1),
|
|
21804
|
+
notification: PublishCredentialRefreshNotificationValidator
|
|
21805
|
+
});
|
|
21806
|
+
var CredentialRefreshVersionMetadataValidator = external_exports.object({
|
|
21807
|
+
version: external_exports.number().int().positive(),
|
|
21808
|
+
publishedAt: external_exports.string().min(1),
|
|
21809
|
+
effectiveAt: external_exports.string().optional(),
|
|
21810
|
+
etag: external_exports.string().optional(),
|
|
21811
|
+
signingMode: CredentialRefreshSigningModeValidator.optional(),
|
|
21812
|
+
updateSummary: external_exports.string().optional()
|
|
21813
|
+
});
|
|
21814
|
+
var GetCredentialRefreshHistoryInputValidator = external_exports.object({
|
|
21815
|
+
refreshId: external_exports.string().min(1),
|
|
21816
|
+
cursor: external_exports.string().optional(),
|
|
21817
|
+
limit: external_exports.number().int().positive().optional()
|
|
21818
|
+
});
|
|
21819
|
+
var GetCredentialRefreshHistoryResultValidator = external_exports.object({
|
|
21820
|
+
records: CredentialRefreshVersionMetadataValidator.array(),
|
|
21821
|
+
hasMore: external_exports.boolean(),
|
|
21822
|
+
cursor: external_exports.string().optional()
|
|
21823
|
+
});
|
|
21824
|
+
var CredentialRefreshChallengeValidator = external_exports.object({
|
|
21825
|
+
challenge: external_exports.string().min(1),
|
|
21826
|
+
expiresAt: external_exports.string().min(1),
|
|
21827
|
+
domain: external_exports.string().optional(),
|
|
21828
|
+
scheme: external_exports.literal("LearnCardDIDAuth").optional()
|
|
21829
|
+
});
|
|
21830
|
+
var PublicCredentialRefreshEnvelopeValidator = external_exports.object({
|
|
21831
|
+
format: external_exports.literal("vc"),
|
|
21832
|
+
credential: VCValidator,
|
|
21833
|
+
etag: external_exports.string().optional()
|
|
21834
|
+
});
|
|
21835
|
+
var JweCredentialRefreshEnvelopeValidator = external_exports.object({
|
|
21836
|
+
format: external_exports.literal("jwe"),
|
|
21837
|
+
jwe: JWEValidator,
|
|
21838
|
+
etag: external_exports.string().optional(),
|
|
21839
|
+
/** Present on LearnCard-managed endpoints; optional for interoperable JWE services. */
|
|
21840
|
+
version: external_exports.number().int().positive().optional()
|
|
21841
|
+
});
|
|
21842
|
+
var CredentialRefreshResponseEnvelopeValidator = external_exports.discriminatedUnion("format", [
|
|
21843
|
+
PublicCredentialRefreshEnvelopeValidator,
|
|
21844
|
+
JweCredentialRefreshEnvelopeValidator
|
|
21845
|
+
]);
|
|
21846
|
+
var CredentialRefreshFailureCodeValidator = external_exports.enum([
|
|
21847
|
+
"UNAVAILABLE",
|
|
21848
|
+
"TIMEOUT",
|
|
21849
|
+
"UNSUPPORTED_SERVICE",
|
|
21850
|
+
"UNAUTHORIZED",
|
|
21851
|
+
"MALFORMED_RESPONSE",
|
|
21852
|
+
"INVALID_PROOF",
|
|
21853
|
+
"ISSUER_MISMATCH",
|
|
21854
|
+
"ID_MISMATCH",
|
|
21855
|
+
"ROLLBACK",
|
|
21856
|
+
"REVOKED",
|
|
21857
|
+
"UNSAFE_ENDPOINT"
|
|
21858
|
+
]);
|
|
21859
|
+
var CredentialRefreshUpdatedResultValidator = external_exports.object({
|
|
21860
|
+
status: external_exports.literal("updated"),
|
|
21861
|
+
credential: VCValidator,
|
|
21862
|
+
etag: external_exports.string().optional(),
|
|
21863
|
+
managedVersion: external_exports.number().int().positive().optional()
|
|
21864
|
+
});
|
|
21865
|
+
var CredentialRefreshUnchangedResultValidator = external_exports.object({
|
|
21866
|
+
status: external_exports.literal("unchanged"),
|
|
21867
|
+
checkedAt: external_exports.string().min(1),
|
|
21868
|
+
etag: external_exports.string().optional()
|
|
21869
|
+
});
|
|
21870
|
+
var CredentialRefreshUnsupportedResultValidator = external_exports.object({
|
|
21871
|
+
status: external_exports.literal("unsupported")
|
|
21872
|
+
});
|
|
21873
|
+
var CredentialRefreshFailedResultValidator = external_exports.object({
|
|
21874
|
+
status: external_exports.literal("failed"),
|
|
21875
|
+
code: CredentialRefreshFailureCodeValidator,
|
|
21876
|
+
retryable: external_exports.boolean()
|
|
21877
|
+
});
|
|
21878
|
+
var CredentialRefreshResultValidator = external_exports.discriminatedUnion("status", [
|
|
21879
|
+
CredentialRefreshUpdatedResultValidator,
|
|
21880
|
+
CredentialRefreshUnchangedResultValidator,
|
|
21881
|
+
CredentialRefreshUnsupportedResultValidator,
|
|
21882
|
+
CredentialRefreshFailedResultValidator
|
|
21883
|
+
]);
|
|
21686
21884
|
var LCNProfileDisplayValidator = external_exports.object({
|
|
21687
21885
|
backgroundColor: external_exports.string().optional(),
|
|
21688
21886
|
backgroundImage: external_exports.string().optional(),
|
|
@@ -22018,7 +22216,13 @@ var SendBoostInputValidator = external_exports.object({
|
|
|
22018
22216
|
"Options for email/phone recipients (Universal Inbox)"
|
|
22019
22217
|
),
|
|
22020
22218
|
templateData: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
22021
|
-
integrationId: external_exports.string().optional().describe("Integration ID for activity tracking")
|
|
22219
|
+
integrationId: external_exports.string().optional().describe("Integration ID for activity tracking"),
|
|
22220
|
+
refresh: external_exports.boolean().optional().describe(
|
|
22221
|
+
"Request managed credential refresh for this send. Profile/DID recipients use immediate issuance; email/phone recipients use deferred Universal Inbox signing and bind the holder at claim."
|
|
22222
|
+
),
|
|
22223
|
+
idempotencyKey: external_exports.string().min(1).max(200).optional().describe(
|
|
22224
|
+
"Caller-chosen key that makes a managed refresh send (refresh: true) safe to retry as a whole: retries with the same key reuse the same boost, refresh allocation and result. Reusing a key for a different request is rejected. With signedCredential, requires prior tRPC prepareRefreshableSend; direct REST callers omit the key and retry the exact signed credential and templateUri."
|
|
22225
|
+
)
|
|
22022
22226
|
}).refine((data) => data.templateUri || data.template || data.signedCredential, {
|
|
22023
22227
|
message: "Either templateUri, template, or signedCredential must be provided.",
|
|
22024
22228
|
path: ["templateUri"]
|
|
@@ -22033,8 +22237,12 @@ var SendBoostInputValidator = external_exports.object({
|
|
|
22033
22237
|
message: "guardianEmail must differ from recipient (self-approval not allowed)",
|
|
22034
22238
|
path: ["options", "guardianEmail"]
|
|
22035
22239
|
}
|
|
22036
|
-
)
|
|
22240
|
+
).refine((data) => !data.idempotencyKey || data.refresh === true, {
|
|
22241
|
+
message: "idempotencyKey is only supported with refresh: true.",
|
|
22242
|
+
path: ["idempotencyKey"]
|
|
22243
|
+
});
|
|
22037
22244
|
var SendInboxResponseValidator = external_exports.object({
|
|
22245
|
+
refresh: InboxCredentialRefreshReceiptValidator.optional(),
|
|
22038
22246
|
issuanceId: external_exports.string(),
|
|
22039
22247
|
status: external_exports.enum(["PENDING", "ISSUED", "EXPIRED", "DELIVERED", "CLAIMED"]),
|
|
22040
22248
|
claimUrl: external_exports.string().url().optional().describe("Present when suppressDelivery=true"),
|
|
@@ -22049,8 +22257,34 @@ var SendBoostResponseValidator = external_exports.object({
|
|
|
22049
22257
|
activityId: external_exports.string().describe("Links to the activity lifecycle for this issuance"),
|
|
22050
22258
|
inbox: SendInboxResponseValidator.optional().describe(
|
|
22051
22259
|
"Present when sent via email/phone (Universal Inbox)"
|
|
22260
|
+
),
|
|
22261
|
+
refresh: ManagedCredentialRefreshReceiptValidator.optional().describe(
|
|
22262
|
+
"Present when managed refresh was requested: issuance metadata the issuer keeps to publish future updates"
|
|
22052
22263
|
)
|
|
22053
22264
|
});
|
|
22265
|
+
var PrepareRefreshableSendInputValidator = external_exports.object({
|
|
22266
|
+
recipient: external_exports.string(),
|
|
22267
|
+
templateUri: external_exports.string().optional(),
|
|
22268
|
+
template: SendBoostTemplateValidator.optional(),
|
|
22269
|
+
contractUri: external_exports.string().optional(),
|
|
22270
|
+
templateData: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
22271
|
+
integrationId: external_exports.string().optional(),
|
|
22272
|
+
/** Credential ID to allocate for; generated server-side when omitted. */
|
|
22273
|
+
credentialId: external_exports.string().min(1).optional(),
|
|
22274
|
+
idempotencyKey: external_exports.string().min(1).max(200).optional()
|
|
22275
|
+
}).refine((data) => Boolean(data.templateUri) !== Boolean(data.template), {
|
|
22276
|
+
message: "Provide exactly one of templateUri or template."
|
|
22277
|
+
});
|
|
22278
|
+
var PrepareRefreshableSendResultValidator = external_exports.object({
|
|
22279
|
+
boostUri: external_exports.string(),
|
|
22280
|
+
credentialId: external_exports.string(),
|
|
22281
|
+
refreshId: external_exports.string(),
|
|
22282
|
+
refreshService: ManagedCredentialRefreshServiceValidator,
|
|
22283
|
+
/** The DID to use as credentialSubject.id (recipient DID, or the profile's did:web). */
|
|
22284
|
+
holderDid: external_exports.string(),
|
|
22285
|
+
/** Present when this idempotencyKey already completed: return it without signing. */
|
|
22286
|
+
completed: SendBoostResponseValidator.optional()
|
|
22287
|
+
});
|
|
22054
22288
|
var SendInputValidator = external_exports.discriminatedUnion("type", [SendBoostInputValidator]);
|
|
22055
22289
|
var SendResponseValidator = external_exports.discriminatedUnion("type", [SendBoostResponseValidator]);
|
|
22056
22290
|
var ConsentFlowTermsStatusValidator = external_exports.enum(["live", "stale", "withdrawn"]);
|
|
@@ -22381,6 +22615,7 @@ var AuthGrantValidator = external_exports.object({
|
|
|
22381
22615
|
}, "error")
|
|
22382
22616
|
}),
|
|
22383
22617
|
scope: external_exports.string(),
|
|
22618
|
+
actAs: external_exports.string().optional(),
|
|
22384
22619
|
createdAt: external_exports.iso.datetime({ error: "createdAt must be a valid ISO 8601 datetime string" }),
|
|
22385
22620
|
expiresAt: external_exports.iso.datetime({ error: "expiresAt must be a valid ISO 8601 datetime string" }).nullish().optional()
|
|
22386
22621
|
});
|
|
@@ -22452,6 +22687,8 @@ var CreateContactMethodSessionResponseValidator = external_exports.object({
|
|
|
22452
22687
|
sessionJwt: external_exports.string()
|
|
22453
22688
|
});
|
|
22454
22689
|
var InboxCredentialValidator = external_exports.object({
|
|
22690
|
+
refresh: InboxCredentialRefreshReceiptValidator.optional(),
|
|
22691
|
+
refreshId: external_exports.string().optional(),
|
|
22455
22692
|
id: external_exports.string(),
|
|
22456
22693
|
credential: external_exports.string().optional(),
|
|
22457
22694
|
isSigned: external_exports.boolean(),
|
|
@@ -22506,12 +22743,19 @@ var IssueInboxCredentialValidator = external_exports.object({
|
|
|
22506
22743
|
templateUri: external_exports.string().optional().describe(
|
|
22507
22744
|
"URI of a boost template to use for issuance. The boost credential will be resolved and used. Mutually exclusive with credential field."
|
|
22508
22745
|
),
|
|
22746
|
+
refresh: external_exports.boolean().optional().describe(
|
|
22747
|
+
"Allocate managed refresh before signing. Requires unsigned content and a registered signing authority; binds the holder on claim."
|
|
22748
|
+
),
|
|
22749
|
+
idempotencyKey: external_exports.string().min(1).max(200).optional(),
|
|
22509
22750
|
// === OPTIONAL FEATURES ===
|
|
22510
22751
|
// Add major, distinct features at the top level.
|
|
22511
22752
|
//consentRequest: ConsentRequestValidator.optional(),
|
|
22512
22753
|
// === PROCESS CONFIGURATION (Optional) ===
|
|
22513
22754
|
// HOW should this issuance be handled?
|
|
22514
22755
|
configuration: external_exports.object({
|
|
22756
|
+
guardianEmail: external_exports.string().email().optional().describe(
|
|
22757
|
+
"Require approval from this guardian before the recipient can claim. Must differ from the recipient email."
|
|
22758
|
+
),
|
|
22515
22759
|
signingAuthority: IssueInboxSigningAuthorityValidator.optional().describe(
|
|
22516
22760
|
"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."
|
|
22517
22761
|
),
|
|
@@ -22565,17 +22809,130 @@ var IssueInboxCredentialValidator = external_exports.object({
|
|
|
22565
22809
|
}).optional().describe(
|
|
22566
22810
|
"Configuration for the credential issuance. If not provided, the default configuration will be used."
|
|
22567
22811
|
)
|
|
22812
|
+
}).refine((data) => !data.idempotencyKey || data.refresh === true, {
|
|
22813
|
+
message: "idempotencyKey requires refresh: true."
|
|
22568
22814
|
}).refine((data) => data.credential || data.templateUri, {
|
|
22569
22815
|
message: "Either credential or templateUri must be provided.",
|
|
22570
22816
|
path: ["credential"]
|
|
22571
|
-
})
|
|
22817
|
+
}).refine(
|
|
22818
|
+
(data) => !data.configuration?.guardianEmail || data.recipient.type !== "email" || data.configuration.guardianEmail.toLowerCase() !== data.recipient.value.toLowerCase(),
|
|
22819
|
+
{
|
|
22820
|
+
message: "guardianEmail must differ from recipient (self-approval not allowed)",
|
|
22821
|
+
path: ["configuration", "guardianEmail"]
|
|
22822
|
+
}
|
|
22823
|
+
);
|
|
22572
22824
|
var IssueInboxCredentialResponseValidator = external_exports.object({
|
|
22825
|
+
refresh: InboxCredentialRefreshReceiptValidator.optional(),
|
|
22573
22826
|
issuanceId: external_exports.string(),
|
|
22574
22827
|
status: LCNInboxStatusEnumValidator,
|
|
22575
22828
|
recipient: ContactMethodQueryValidator,
|
|
22576
22829
|
claimUrl: external_exports.string().url().optional(),
|
|
22577
22830
|
recipientDid: external_exports.string().optional()
|
|
22578
22831
|
});
|
|
22832
|
+
var InboxBatchConfigurationValidator = IssueInboxCredentialValidator.shape.configuration.unwrap().extend({
|
|
22833
|
+
refresh: IssueInboxCredentialValidator.shape.refresh.describe(
|
|
22834
|
+
"Enable managed refresh by default. An item configuration.refresh overrides this value, including false."
|
|
22835
|
+
),
|
|
22836
|
+
delivery: IssueInboxCredentialValidator.shape.configuration.unwrap().shape.delivery.unwrap().extend({ suppress: external_exports.boolean().optional() }).optional()
|
|
22837
|
+
});
|
|
22838
|
+
var InboxBatchItemConfigurationValidator = InboxBatchConfigurationValidator.extend({
|
|
22839
|
+
guardianEmail: InboxBatchConfigurationValidator.shape.guardianEmail.nullable().describe(
|
|
22840
|
+
"Require guardian approval, or set null to clear a batch-level guardianEmail for this item."
|
|
22841
|
+
)
|
|
22842
|
+
});
|
|
22843
|
+
var IssueInboxCredentialBatchItemValidator = external_exports.object({
|
|
22844
|
+
...IssueInboxCredentialValidator.shape,
|
|
22845
|
+
configuration: InboxBatchItemConfigurationValidator.optional(),
|
|
22846
|
+
idempotencyKey: external_exports.string().max(256).optional()
|
|
22847
|
+
}).refine((data) => data.credential || data.templateUri, {
|
|
22848
|
+
message: "Either credential or templateUri must be provided.",
|
|
22849
|
+
path: ["credential"]
|
|
22850
|
+
}).describe(
|
|
22851
|
+
"One issuance: provide credential or templateUri. Invalid input is rejected at submission with its item index."
|
|
22852
|
+
);
|
|
22853
|
+
var IssueInboxCredentialBatchValidator = external_exports.object({
|
|
22854
|
+
requestId: external_exports.string().min(1).max(256).optional(),
|
|
22855
|
+
items: external_exports.array(IssueInboxCredentialBatchItemValidator).min(1).max(100),
|
|
22856
|
+
configuration: InboxBatchConfigurationValidator.optional()
|
|
22857
|
+
}).superRefine((batch, ctx) => {
|
|
22858
|
+
batch.items.forEach((item, index) => {
|
|
22859
|
+
const itemGuardian = item.configuration?.guardianEmail;
|
|
22860
|
+
const guardian = itemGuardian === null ? void 0 : itemGuardian ?? batch.configuration?.guardianEmail;
|
|
22861
|
+
if (guardian && item.recipient.type === "email" && guardian.toLowerCase() === item.recipient.value.toLowerCase()) {
|
|
22862
|
+
ctx.addIssue({
|
|
22863
|
+
code: "custom",
|
|
22864
|
+
path: ["items", index, "configuration", "guardianEmail"],
|
|
22865
|
+
message: "guardianEmail must differ from recipient (self-approval not allowed)"
|
|
22866
|
+
});
|
|
22867
|
+
}
|
|
22868
|
+
});
|
|
22869
|
+
});
|
|
22870
|
+
var InboxBatchErrorReasonValidator = external_exports.enum([
|
|
22871
|
+
"DUPLICATE_KEY",
|
|
22872
|
+
"IDEMPOTENCY_MISMATCH",
|
|
22873
|
+
"IN_PROGRESS",
|
|
22874
|
+
"UNCONFIRMED"
|
|
22875
|
+
]);
|
|
22876
|
+
var IssueInboxCredentialBatchItemResultValidator = external_exports.discriminatedUnion("success", [
|
|
22877
|
+
IssueInboxCredentialResponseValidator.extend({
|
|
22878
|
+
success: external_exports.literal(true),
|
|
22879
|
+
index: external_exports.number().int().nonnegative(),
|
|
22880
|
+
deduplicated: external_exports.boolean().optional(),
|
|
22881
|
+
guardianStatus: GuardianStatusValidator.optional(),
|
|
22882
|
+
idempotencyKey: external_exports.string().optional()
|
|
22883
|
+
}),
|
|
22884
|
+
external_exports.object({
|
|
22885
|
+
success: external_exports.literal(false),
|
|
22886
|
+
index: external_exports.number().int().nonnegative(),
|
|
22887
|
+
idempotencyKey: external_exports.string().optional(),
|
|
22888
|
+
recipient: ContactMethodQueryValidator.optional(),
|
|
22889
|
+
error: external_exports.object({
|
|
22890
|
+
code: external_exports.string(),
|
|
22891
|
+
message: external_exports.string(),
|
|
22892
|
+
reason: InboxBatchErrorReasonValidator.optional()
|
|
22893
|
+
}),
|
|
22894
|
+
issuanceId: external_exports.string().optional().describe(
|
|
22895
|
+
"Present when issuance completed but replay storage could not be confirmed. Reconcile this issuance; do not issue again with a new key."
|
|
22896
|
+
),
|
|
22897
|
+
claimUrl: external_exports.string().url().optional().describe(
|
|
22898
|
+
"Claim URL of the completed issuance, if available, when replay storage could not be confirmed."
|
|
22899
|
+
)
|
|
22900
|
+
})
|
|
22901
|
+
]);
|
|
22902
|
+
var IssueInboxCredentialBatchResponseValidator = external_exports.object({
|
|
22903
|
+
results: external_exports.array(IssueInboxCredentialBatchItemResultValidator),
|
|
22904
|
+
summary: external_exports.object({
|
|
22905
|
+
total: external_exports.number(),
|
|
22906
|
+
succeeded: external_exports.number(),
|
|
22907
|
+
failed: external_exports.number(),
|
|
22908
|
+
deduplicated: external_exports.number()
|
|
22909
|
+
})
|
|
22910
|
+
});
|
|
22911
|
+
var InboxBatchReceiptValidator = external_exports.object({
|
|
22912
|
+
batchId: external_exports.string(),
|
|
22913
|
+
status: external_exports.enum(["QUEUED", "PROCESSING", "COMPLETED", "NEEDS_RECONCILIATION"]),
|
|
22914
|
+
createdAt: external_exports.string()
|
|
22915
|
+
});
|
|
22916
|
+
var InboxBatchStatusValidator = external_exports.object({
|
|
22917
|
+
batchId: external_exports.string(),
|
|
22918
|
+
createdAt: external_exports.string(),
|
|
22919
|
+
done: external_exports.boolean().describe(
|
|
22920
|
+
"True when no queued or processing items remain, including unconfirmed outcomes."
|
|
22921
|
+
),
|
|
22922
|
+
status: external_exports.enum(["QUEUED", "PROCESSING", "COMPLETED", "NEEDS_RECONCILIATION"]),
|
|
22923
|
+
items: external_exports.array(
|
|
22924
|
+
external_exports.object({
|
|
22925
|
+
index: external_exports.number().int().nonnegative(),
|
|
22926
|
+
state: external_exports.enum(["QUEUED", "PROCESSING", "COMPLETED", "NEEDS_RECONCILIATION"]),
|
|
22927
|
+
result: IssueInboxCredentialBatchItemResultValidator.optional()
|
|
22928
|
+
})
|
|
22929
|
+
),
|
|
22930
|
+
summary: IssueInboxCredentialBatchResponseValidator.shape.summary.extend({
|
|
22931
|
+
completed: external_exports.number(),
|
|
22932
|
+
pending: external_exports.number(),
|
|
22933
|
+
unconfirmed: external_exports.number()
|
|
22934
|
+
})
|
|
22935
|
+
});
|
|
22579
22936
|
var CredentialNameRefValidator = external_exports.object({ name: external_exports.string() }).passthrough();
|
|
22580
22937
|
var ClaimInboxCredentialValidator = external_exports.object({
|
|
22581
22938
|
credential: VCValidator.or(VPValidator).or(UnsignedVCValidator).or(CredentialNameRefValidator).describe("The credential to issue, or a { name } reference to resolve a boost template."),
|
|
@@ -23061,6 +23418,7 @@ var CredentialActivityValidator = external_exports.object({
|
|
|
23061
23418
|
eventType: CredentialActivityEventTypeValidator,
|
|
23062
23419
|
timestamp: external_exports.string(),
|
|
23063
23420
|
actorProfileId: external_exports.string().optional(),
|
|
23421
|
+
onBehalfOf: external_exports.string().optional(),
|
|
23064
23422
|
recipientType: CredentialActivityRecipientTypeValidator,
|
|
23065
23423
|
recipientIdentifier: external_exports.string(),
|
|
23066
23424
|
boostUri: external_exports.string().optional(),
|
|
@@ -23102,6 +23460,12 @@ var AuthSessionError = (_a3 = class extends Error {
|
|
|
23102
23460
|
this.name = "AuthSessionError";
|
|
23103
23461
|
}
|
|
23104
23462
|
}, __name(_a3, "AuthSessionError"), __name2(_a3, "AuthSessionError"), _a3);
|
|
23463
|
+
var EscrowPinStatusValidator = external_exports.object({
|
|
23464
|
+
state: external_exports.enum(["none", "enabled", "locked", "stale"]),
|
|
23465
|
+
enabled: external_exports.boolean(),
|
|
23466
|
+
attemptsRemaining: external_exports.number().int().nonnegative(),
|
|
23467
|
+
salt: external_exports.string().optional()
|
|
23468
|
+
});
|
|
23105
23469
|
var BITSTRING_STATUS_PURPOSES = ["revocation", "suspension"];
|
|
23106
23470
|
var BitstringStatusPurposeValidator = external_exports.enum(BITSTRING_STATUS_PURPOSES);
|
|
23107
23471
|
var BitstringStatusListEntryValidator = external_exports.object({
|
|
@@ -23210,191 +23574,456 @@ var inAppMessagesFlagValidator = external_exports.object({
|
|
|
23210
23574
|
version: external_exports.number().default(1),
|
|
23211
23575
|
messages: external_exports.array(inAppMessageValidator).default([])
|
|
23212
23576
|
}).passthrough();
|
|
23213
|
-
var
|
|
23214
|
-
var
|
|
23215
|
-
|
|
23216
|
-
|
|
23217
|
-
|
|
23218
|
-
|
|
23219
|
-
var
|
|
23220
|
-
|
|
23221
|
-
|
|
23222
|
-
|
|
23223
|
-
var
|
|
23224
|
-
|
|
23225
|
-
|
|
23226
|
-
|
|
23227
|
-
var
|
|
23228
|
-
|
|
23229
|
-
|
|
23230
|
-
|
|
23231
|
-
}
|
|
23232
|
-
|
|
23233
|
-
});
|
|
23234
|
-
var
|
|
23235
|
-
|
|
23236
|
-
|
|
23237
|
-
|
|
23238
|
-
|
|
23239
|
-
|
|
23240
|
-
|
|
23241
|
-
|
|
23242
|
-
|
|
23243
|
-
|
|
23244
|
-
|
|
23245
|
-
|
|
23246
|
-
}
|
|
23247
|
-
|
|
23248
|
-
|
|
23249
|
-
|
|
23250
|
-
|
|
23251
|
-
|
|
23252
|
-
|
|
23253
|
-
|
|
23254
|
-
|
|
23255
|
-
|
|
23256
|
-
|
|
23257
|
-
|
|
23258
|
-
|
|
23259
|
-
|
|
23260
|
-
|
|
23261
|
-
|
|
23262
|
-
|
|
23263
|
-
|
|
23264
|
-
|
|
23265
|
-
|
|
23266
|
-
|
|
23267
|
-
|
|
23268
|
-
}
|
|
23269
|
-
|
|
23270
|
-
|
|
23271
|
-
|
|
23272
|
-
|
|
23273
|
-
|
|
23274
|
-
|
|
23577
|
+
var SHARE_LINK_ID_BYTES = 16;
|
|
23578
|
+
var SHARE_CONTENT_KEY_BYTES = 32;
|
|
23579
|
+
var SHARE_IV_BYTES = 12;
|
|
23580
|
+
var SHARE_TAG_BYTES = 16;
|
|
23581
|
+
var MAX_SHARE_CIPHERTEXT_BYTES = 512 * 1024;
|
|
23582
|
+
var MAX_SHARE_RECOVERY_JWE_BYTES = 64 * 1024;
|
|
23583
|
+
var MAX_SELECTED_CREDENTIALS = 50;
|
|
23584
|
+
var MAX_ENDORSEMENTS = 200;
|
|
23585
|
+
var MAX_VP_MEMBERS = MAX_SELECTED_CREDENTIALS + MAX_ENDORSEMENTS;
|
|
23586
|
+
var MAX_SHARE_SOURCE_URI_CHARS = 2048;
|
|
23587
|
+
var MAX_SHARE_LINK_REQUEST_BYTES = 1024 * 1024;
|
|
23588
|
+
var SHARE_LINK_PROTOCOL = "lc-share/v1";
|
|
23589
|
+
var SHARE_RECOVERY_PROTOCOL = "lc-share-recovery/v1";
|
|
23590
|
+
var BASE64URL_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
23591
|
+
var BASE64URL_LOOKUP = (() => {
|
|
23592
|
+
const table = new Int16Array(128).fill(-1);
|
|
23593
|
+
for (let index = 0; index < BASE64URL_ALPHABET.length; index += 1) {
|
|
23594
|
+
table[BASE64URL_ALPHABET.charCodeAt(index)] = index;
|
|
23595
|
+
}
|
|
23596
|
+
return table;
|
|
23597
|
+
})();
|
|
23598
|
+
var encodeBase64Url = /* @__PURE__ */ __name2((bytes) => {
|
|
23599
|
+
let output = "";
|
|
23600
|
+
for (let index = 0; index < bytes.length; index += 3) {
|
|
23601
|
+
const first = bytes[index];
|
|
23602
|
+
const second = bytes[index + 1];
|
|
23603
|
+
const third = bytes[index + 2];
|
|
23604
|
+
output += BASE64URL_ALPHABET[first >> 2];
|
|
23605
|
+
output += BASE64URL_ALPHABET[(first & 3) << 4 | (second ?? 0) >> 4];
|
|
23606
|
+
if (second === void 0) break;
|
|
23607
|
+
output += BASE64URL_ALPHABET[(second & 15) << 2 | (third ?? 0) >> 6];
|
|
23608
|
+
if (third === void 0) break;
|
|
23609
|
+
output += BASE64URL_ALPHABET[third & 63];
|
|
23610
|
+
}
|
|
23611
|
+
return output;
|
|
23612
|
+
}, "encodeBase64Url");
|
|
23613
|
+
var decodeBase64Url = /* @__PURE__ */ __name2((value) => {
|
|
23614
|
+
if (typeof value !== "string") return null;
|
|
23615
|
+
const output = new Uint8Array(Math.floor(value.length * 6 / 8));
|
|
23616
|
+
let bits = 0;
|
|
23617
|
+
let bitCount = 0;
|
|
23618
|
+
let outputIndex = 0;
|
|
23619
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
23620
|
+
const code = value.charCodeAt(index);
|
|
23621
|
+
const digit = code < 128 ? BASE64URL_LOOKUP[code] : -1;
|
|
23622
|
+
if (digit < 0) return null;
|
|
23623
|
+
bits = bits << 6 | digit;
|
|
23624
|
+
bitCount += 6;
|
|
23625
|
+
if (bitCount >= 8) {
|
|
23626
|
+
bitCount -= 8;
|
|
23627
|
+
output[outputIndex] = bits >> bitCount & 255;
|
|
23628
|
+
outputIndex += 1;
|
|
23629
|
+
}
|
|
23630
|
+
}
|
|
23631
|
+
return output;
|
|
23632
|
+
}, "decodeBase64Url");
|
|
23633
|
+
var isCanonicalBase64Url = /* @__PURE__ */ __name2((value, expectedBytes) => {
|
|
23634
|
+
if (typeof value !== "string") return false;
|
|
23635
|
+
if (expectedBytes !== void 0 && value.length !== Math.ceil(expectedBytes * 4 / 3))
|
|
23636
|
+
return false;
|
|
23637
|
+
const decoded = decodeBase64Url(value);
|
|
23638
|
+
if (decoded === null) return false;
|
|
23639
|
+
if (expectedBytes !== void 0 && decoded.length !== expectedBytes) return false;
|
|
23640
|
+
return encodeBase64Url(decoded) === value;
|
|
23641
|
+
}, "isCanonicalBase64Url");
|
|
23642
|
+
var utf8ByteLength = /* @__PURE__ */ __name2((value) => new TextEncoder().encode(value).length, "utf8ByteLength");
|
|
23643
|
+
var canonicalBase64Url = /* @__PURE__ */ __name2((bytes) => external_exports.string().refine((value) => isCanonicalBase64Url(value, bytes), {
|
|
23644
|
+
message: `must be canonical base64url for exactly ${bytes} bytes`
|
|
23645
|
+
}), "canonicalBase64Url");
|
|
23646
|
+
var ShareLinkIdValidator = canonicalBase64Url(SHARE_LINK_ID_BYTES);
|
|
23647
|
+
var ShareContentKeyValidator = canonicalBase64Url(SHARE_CONTENT_KEY_BYTES);
|
|
23648
|
+
var ShareIvValidator = canonicalBase64Url(SHARE_IV_BYTES);
|
|
23649
|
+
var ShareCiphertextValidator = external_exports.string().refine(
|
|
23650
|
+
(value) => {
|
|
23651
|
+
if (value.length > Math.ceil(MAX_SHARE_CIPHERTEXT_BYTES * 4 / 3)) return false;
|
|
23652
|
+
const decoded = decodeBase64Url(value);
|
|
23653
|
+
if (decoded === null) return false;
|
|
23654
|
+
if (encodeBase64Url(decoded) !== value) return false;
|
|
23655
|
+
return decoded.length >= SHARE_TAG_BYTES && decoded.length <= MAX_SHARE_CIPHERTEXT_BYTES;
|
|
23656
|
+
},
|
|
23657
|
+
{
|
|
23658
|
+
message: `must be canonical base64url decoding to ${SHARE_TAG_BYTES}..${MAX_SHARE_CIPHERTEXT_BYTES} bytes`
|
|
23275
23659
|
}
|
|
23276
|
-
|
|
23660
|
+
);
|
|
23661
|
+
var ShareEnvelopeValidator = external_exports.object({
|
|
23662
|
+
v: external_exports.literal(1),
|
|
23663
|
+
alg: external_exports.literal("A256GCM"),
|
|
23664
|
+
iv: ShareIvValidator,
|
|
23665
|
+
ct: ShareCiphertextValidator
|
|
23666
|
+
}).strict();
|
|
23667
|
+
var safeVersion = external_exports.number().int().min(1).max(2 ** 31 - 1);
|
|
23668
|
+
var safeCredentialIndex = external_exports.number().int().min(0).max(MAX_VP_MEMBERS - 1);
|
|
23669
|
+
var ShareSelectionEntryValidator = external_exports.object({ credentialIndex: safeCredentialIndex }).strict();
|
|
23670
|
+
var ShareEndorsementEntryValidator = external_exports.object({ credentialIndex: safeCredentialIndex, targetCredentialIndex: safeCredentialIndex }).strict();
|
|
23671
|
+
var ShareSharerValidator = external_exports.object({
|
|
23672
|
+
profileId: external_exports.string().min(1).max(128),
|
|
23673
|
+
displayName: external_exports.string().min(1).max(120),
|
|
23674
|
+
avatar: external_exports.string().max(2048).optional()
|
|
23675
|
+
}).strict();
|
|
23676
|
+
var presentationShape = VPValidator.extend({
|
|
23677
|
+
verifiableCredential: VCValidator.array().min(1).max(MAX_VP_MEMBERS)
|
|
23678
|
+
});
|
|
23679
|
+
var hasBoundedPresentation = /* @__PURE__ */ __name2((value) => {
|
|
23680
|
+
let credentialCount = 0;
|
|
23681
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
23682
|
+
const visit = /* @__PURE__ */ __name2((node, depth) => {
|
|
23683
|
+
if (node === null || typeof node !== "object") return true;
|
|
23684
|
+
if (depth > 32 || ancestors.has(node)) return false;
|
|
23685
|
+
ancestors.add(node);
|
|
23686
|
+
try {
|
|
23687
|
+
for (const [key, child] of Object.entries(node)) {
|
|
23688
|
+
if (key === "verifiableCredential") {
|
|
23689
|
+
credentialCount += Array.isArray(child) ? child.length : 1;
|
|
23690
|
+
if (credentialCount > MAX_VP_MEMBERS) return false;
|
|
23691
|
+
}
|
|
23692
|
+
if (!visit(child, depth + 1)) return false;
|
|
23693
|
+
}
|
|
23694
|
+
return true;
|
|
23695
|
+
} finally {
|
|
23696
|
+
ancestors.delete(node);
|
|
23697
|
+
}
|
|
23698
|
+
}, "visit");
|
|
23699
|
+
return visit(value, 0);
|
|
23700
|
+
}, "hasBoundedPresentation");
|
|
23701
|
+
var ShareManifestPresentationValidator = external_exports.custom(
|
|
23702
|
+
(value) => hasBoundedPresentation(value) && presentationShape.safeParse(value).success,
|
|
23703
|
+
{ message: "invalid share presentation" }
|
|
23704
|
+
);
|
|
23705
|
+
var SharePayloadValidatorShape = external_exports.object({
|
|
23706
|
+
protocol: external_exports.literal(SHARE_LINK_PROTOCOL),
|
|
23707
|
+
shareId: ShareLinkIdValidator,
|
|
23708
|
+
contentVersion: safeVersion,
|
|
23709
|
+
createdAt: external_exports.iso.datetime(),
|
|
23710
|
+
sharer: ShareSharerValidator,
|
|
23711
|
+
presentation: ShareManifestPresentationValidator,
|
|
23712
|
+
selection: ShareSelectionEntryValidator.array().min(1).max(MAX_SELECTED_CREDENTIALS),
|
|
23713
|
+
endorsements: ShareEndorsementEntryValidator.array().max(MAX_ENDORSEMENTS).default([])
|
|
23714
|
+
}).strict();
|
|
23715
|
+
var classificationFailure = /* @__PURE__ */ __name2((code, message, path = []) => ({ ok: false, code, message, path }), "classificationFailure");
|
|
23716
|
+
var readSignedClaimId = /* @__PURE__ */ __name2((member) => {
|
|
23717
|
+
if (member === null || typeof member !== "object") return void 0;
|
|
23718
|
+
const record2 = member;
|
|
23719
|
+
const claim = record2.credentialSubject ?? record2.endorsement;
|
|
23720
|
+
if (claim === null || typeof claim !== "object") return void 0;
|
|
23721
|
+
const claimRecord = claim;
|
|
23722
|
+
const nested = claimRecord.endorsement;
|
|
23723
|
+
const nestedId = nested !== null && typeof nested === "object" ? nested.id : void 0;
|
|
23724
|
+
return claimRecord.id ?? nestedId;
|
|
23725
|
+
}, "readSignedClaimId");
|
|
23726
|
+
var classifyShareManifest = /* @__PURE__ */ __name2((payload) => {
|
|
23727
|
+
const members = payload.presentation?.verifiableCredential;
|
|
23728
|
+
if (!Array.isArray(members) || members.length === 0) {
|
|
23729
|
+
return classificationFailure("NO_PRESENTATION_MEMBERS", "presentation has no credentials");
|
|
23730
|
+
}
|
|
23731
|
+
if (members.length > MAX_VP_MEMBERS) {
|
|
23732
|
+
return classificationFailure(
|
|
23733
|
+
"TOO_MANY_VP_MEMBERS",
|
|
23734
|
+
`presentation has ${members.length} members, over the ${MAX_VP_MEMBERS} bound`
|
|
23735
|
+
);
|
|
23736
|
+
}
|
|
23737
|
+
const selection = payload.selection;
|
|
23738
|
+
const endorsements = payload.endorsements ?? [];
|
|
23739
|
+
if (!Array.isArray(selection) || selection.length < 1 || selection.length > MAX_SELECTED_CREDENTIALS) {
|
|
23740
|
+
return classificationFailure("BAD_SELECTION", "selection must contain 1..50 entries");
|
|
23741
|
+
}
|
|
23742
|
+
if (!Array.isArray(endorsements) || endorsements.length > MAX_ENDORSEMENTS) {
|
|
23743
|
+
return classificationFailure(
|
|
23744
|
+
"BAD_ENDORSEMENTS",
|
|
23745
|
+
"endorsements must contain at most 200 entries"
|
|
23746
|
+
);
|
|
23747
|
+
}
|
|
23748
|
+
const selectedIndices = [];
|
|
23749
|
+
const selected = /* @__PURE__ */ new Set();
|
|
23750
|
+
for (let index = 0; index < selection.length; index += 1) {
|
|
23751
|
+
const entry = selection[index];
|
|
23752
|
+
const credentialIndex = entry?.credentialIndex;
|
|
23753
|
+
if (!Number.isSafeInteger(credentialIndex) || credentialIndex < 0 || credentialIndex >= members.length) {
|
|
23754
|
+
return classificationFailure(
|
|
23755
|
+
"SELECTION_INDEX_OUT_OF_BOUNDS",
|
|
23756
|
+
`selection[${index}].credentialIndex is out of bounds`,
|
|
23757
|
+
["selection", index, "credentialIndex"]
|
|
23758
|
+
);
|
|
23759
|
+
}
|
|
23760
|
+
if (selected.has(credentialIndex)) {
|
|
23761
|
+
return classificationFailure(
|
|
23762
|
+
"SELECTION_INDEX_DUPLICATE",
|
|
23763
|
+
`selection[${index}].credentialIndex is duplicated`,
|
|
23764
|
+
["selection", index, "credentialIndex"]
|
|
23765
|
+
);
|
|
23766
|
+
}
|
|
23767
|
+
selected.add(credentialIndex);
|
|
23768
|
+
selectedIndices.push(credentialIndex);
|
|
23769
|
+
}
|
|
23770
|
+
const classified = new Set(selected);
|
|
23771
|
+
const endorsementIndices = [];
|
|
23772
|
+
for (let index = 0; index < endorsements.length; index += 1) {
|
|
23773
|
+
const entry = endorsements[index];
|
|
23774
|
+
const credentialIndex = entry?.credentialIndex;
|
|
23775
|
+
const targetIndex = entry?.targetCredentialIndex;
|
|
23776
|
+
if (!Number.isSafeInteger(credentialIndex) || credentialIndex < 0 || credentialIndex >= members.length) {
|
|
23777
|
+
return classificationFailure(
|
|
23778
|
+
"ENDORSEMENT_INDEX_OUT_OF_BOUNDS",
|
|
23779
|
+
`endorsements[${index}].credentialIndex is out of bounds`,
|
|
23780
|
+
["endorsements", index, "credentialIndex"]
|
|
23781
|
+
);
|
|
23782
|
+
}
|
|
23783
|
+
if (classified.has(credentialIndex)) {
|
|
23784
|
+
return classificationFailure(
|
|
23785
|
+
"VP_MEMBER_CLASSIFIED_TWICE",
|
|
23786
|
+
`endorsements[${index}].credentialIndex was already classified`,
|
|
23787
|
+
["endorsements", index, "credentialIndex"]
|
|
23788
|
+
);
|
|
23789
|
+
}
|
|
23790
|
+
if (!selected.has(targetIndex)) {
|
|
23791
|
+
return classificationFailure(
|
|
23792
|
+
"ENDORSEMENT_TARGET_NOT_SELECTED",
|
|
23793
|
+
`endorsements[${index}].targetCredentialIndex must reference a selected credential`,
|
|
23794
|
+
["endorsements", index, "targetCredentialIndex"]
|
|
23795
|
+
);
|
|
23796
|
+
}
|
|
23797
|
+
const referenced = readSignedClaimId(members[credentialIndex]);
|
|
23798
|
+
const target = members[targetIndex];
|
|
23799
|
+
const targetId = target !== null && typeof target === "object" ? target.id : void 0;
|
|
23800
|
+
if (typeof referenced !== "string" || typeof targetId !== "string" || referenced !== targetId) {
|
|
23801
|
+
return classificationFailure(
|
|
23802
|
+
"ENDORSEMENT_TARGET_UNBOUND",
|
|
23803
|
+
`endorsements[${index}] claim does not reference the target credential id`,
|
|
23804
|
+
["endorsements", index]
|
|
23805
|
+
);
|
|
23806
|
+
}
|
|
23807
|
+
classified.add(credentialIndex);
|
|
23808
|
+
endorsementIndices.push(credentialIndex);
|
|
23809
|
+
}
|
|
23810
|
+
if (classified.size !== members.length) {
|
|
23811
|
+
return classificationFailure(
|
|
23812
|
+
"UNCLASSIFIED_VP_MEMBER",
|
|
23813
|
+
"every presentation member must be classified exactly once",
|
|
23814
|
+
["presentation", "verifiableCredential"]
|
|
23815
|
+
);
|
|
23816
|
+
}
|
|
23817
|
+
return {
|
|
23818
|
+
ok: true,
|
|
23819
|
+
classification: { selectedIndices, endorsementIndices, memberCount: members.length }
|
|
23820
|
+
};
|
|
23821
|
+
}, "classifyShareManifest");
|
|
23822
|
+
var SharePayloadValidator = SharePayloadValidatorShape.superRefine((payload, ctx) => {
|
|
23823
|
+
const result = classifyShareManifest(payload);
|
|
23824
|
+
if (!result.ok) {
|
|
23277
23825
|
ctx.addIssue({
|
|
23278
23826
|
code: "custom",
|
|
23279
|
-
|
|
23280
|
-
|
|
23827
|
+
message: result.message,
|
|
23828
|
+
path: result.path,
|
|
23829
|
+
params: { shareLinkCode: result.code }
|
|
23281
23830
|
});
|
|
23282
23831
|
}
|
|
23283
|
-
|
|
23284
|
-
|
|
23285
|
-
|
|
23286
|
-
|
|
23287
|
-
|
|
23288
|
-
|
|
23289
|
-
|
|
23290
|
-
|
|
23291
|
-
|
|
23832
|
+
});
|
|
23833
|
+
var ShareRecoverySelectionValidator = external_exports.object({
|
|
23834
|
+
ref: external_exports.string().min(1).max(MAX_SHARE_SOURCE_URI_CHARS),
|
|
23835
|
+
order: external_exports.number().int().min(0).max(MAX_SELECTED_CREDENTIALS - 1)
|
|
23836
|
+
}).strict();
|
|
23837
|
+
var ShareRecoveryEndorsementValidator = external_exports.object({ targetRef: external_exports.string().min(1).max(MAX_SHARE_SOURCE_URI_CHARS) }).strict();
|
|
23838
|
+
var ShareRecoveryPlaintextValidator = external_exports.object({
|
|
23839
|
+
protocol: external_exports.literal(SHARE_RECOVERY_PROTOCOL),
|
|
23840
|
+
shareId: ShareLinkIdValidator,
|
|
23841
|
+
ownerProfileId: external_exports.string().min(1).max(128),
|
|
23842
|
+
createdAt: external_exports.iso.datetime(),
|
|
23843
|
+
latest: external_exports.object({ contentVersion: safeVersion, key: ShareContentKeyValidator }).strict(),
|
|
23844
|
+
selection: ShareRecoverySelectionValidator.array().min(1).max(MAX_SELECTED_CREDENTIALS),
|
|
23845
|
+
endorsements: ShareRecoveryEndorsementValidator.array().max(MAX_ENDORSEMENTS).default([])
|
|
23846
|
+
}).strict().superRefine((recovery, ctx) => {
|
|
23847
|
+
const orders = /* @__PURE__ */ new Set();
|
|
23848
|
+
recovery.selection.forEach((entry, index) => {
|
|
23849
|
+
if (entry.order >= recovery.selection.length) {
|
|
23292
23850
|
ctx.addIssue({
|
|
23293
23851
|
code: "custom",
|
|
23294
|
-
|
|
23295
|
-
|
|
23852
|
+
message: "order must be within the selection bounds",
|
|
23853
|
+
path: ["selection", index, "order"]
|
|
23296
23854
|
});
|
|
23297
23855
|
}
|
|
23298
|
-
if (
|
|
23856
|
+
if (orders.has(entry.order)) {
|
|
23299
23857
|
ctx.addIssue({
|
|
23300
23858
|
code: "custom",
|
|
23301
|
-
|
|
23302
|
-
|
|
23859
|
+
message: "order must be unique within the selection",
|
|
23860
|
+
path: ["selection", index, "order"]
|
|
23303
23861
|
});
|
|
23304
23862
|
}
|
|
23863
|
+
orders.add(entry.order);
|
|
23864
|
+
});
|
|
23865
|
+
});
|
|
23866
|
+
var ShareOwnerRecoveryValidator = JWEValidator.refine(
|
|
23867
|
+
(value) => utf8ByteLength(JSON.stringify(value)) <= MAX_SHARE_RECOVERY_JWE_BYTES,
|
|
23868
|
+
{ message: `serialized recovery JWE must be at most ${MAX_SHARE_RECOVERY_JWE_BYTES} bytes` }
|
|
23869
|
+
);
|
|
23870
|
+
var ShareLinkStatusValidator = external_exports.enum(["pending", "active", "stopped"]);
|
|
23871
|
+
var ShareContentStateValidator = external_exports.enum(["staging", "finalized", "content_missing"]);
|
|
23872
|
+
var ShareLinkValidator = external_exports.object({
|
|
23873
|
+
id: ShareLinkIdValidator,
|
|
23874
|
+
title: external_exports.string().min(1).max(120),
|
|
23875
|
+
note: external_exports.string().max(500).optional(),
|
|
23876
|
+
selectedCount: external_exports.number().int().min(1).max(MAX_SELECTED_CREDENTIALS),
|
|
23877
|
+
version: safeVersion,
|
|
23878
|
+
contentVersion: safeVersion,
|
|
23879
|
+
status: ShareLinkStatusValidator,
|
|
23880
|
+
contentState: ShareContentStateValidator,
|
|
23881
|
+
createdAt: external_exports.iso.datetime(),
|
|
23882
|
+
updatedAt: external_exports.iso.datetime(),
|
|
23883
|
+
expiresAt: external_exports.iso.datetime().nullable(),
|
|
23884
|
+
stoppedAt: external_exports.iso.datetime().nullable(),
|
|
23885
|
+
lastViewedAt: external_exports.iso.datetime().nullable(),
|
|
23886
|
+
viewCount: external_exports.number().int().min(0).optional(),
|
|
23887
|
+
passcodeProtected: external_exports.boolean(),
|
|
23888
|
+
notifyOnView: external_exports.boolean(),
|
|
23889
|
+
minorPolicy: external_exports.object({
|
|
23890
|
+
isMinor: external_exports.boolean().nullable(),
|
|
23891
|
+
policyResolved: external_exports.boolean(),
|
|
23892
|
+
defaultExpiryDays: external_exports.union([external_exports.literal(30), external_exports.literal(365)]),
|
|
23893
|
+
viewCountingEnabled: external_exports.boolean()
|
|
23894
|
+
}),
|
|
23895
|
+
/**
|
|
23896
|
+
* Guarded application/API URL for the content. Optional because owner APIs in
|
|
23897
|
+
* D1 have no public resolve/content endpoint yet; it must never be a
|
|
23898
|
+
* LearnCloud object URL or carry a fabricated decryption key.
|
|
23899
|
+
*/
|
|
23900
|
+
contentUrl: external_exports.string().optional()
|
|
23901
|
+
});
|
|
23902
|
+
var clientRequestId = external_exports.string().uuid();
|
|
23903
|
+
var CreateShareLinkInputValidator = external_exports.object({
|
|
23904
|
+
id: ShareLinkIdValidator,
|
|
23905
|
+
clientRequestId,
|
|
23906
|
+
title: external_exports.string().min(1).max(120),
|
|
23907
|
+
note: external_exports.string().max(500).optional(),
|
|
23908
|
+
expiresAt: external_exports.iso.datetime().nullable().optional(),
|
|
23909
|
+
passcode: external_exports.string().min(8).max(64).optional(),
|
|
23910
|
+
notifyOnView: external_exports.boolean().default(false),
|
|
23911
|
+
selectedCount: external_exports.number().int().min(1).max(MAX_SELECTED_CREDENTIALS),
|
|
23912
|
+
contentVersion: external_exports.literal(1),
|
|
23913
|
+
envelope: ShareEnvelopeValidator,
|
|
23914
|
+
ownerEncryptedRecovery: ShareOwnerRecoveryValidator
|
|
23915
|
+
}).strict();
|
|
23916
|
+
var UpdateShareLinkInputValidator = external_exports.object({
|
|
23917
|
+
id: ShareLinkIdValidator,
|
|
23918
|
+
expectedVersion: safeVersion,
|
|
23919
|
+
clientRequestId,
|
|
23920
|
+
title: external_exports.string().min(1).max(120).optional(),
|
|
23921
|
+
note: external_exports.string().max(500).nullable().optional(),
|
|
23922
|
+
expiresAt: external_exports.iso.datetime().nullable().optional(),
|
|
23923
|
+
/** Omitted preserves the current passcode, null removes it, and a string replaces it. */
|
|
23924
|
+
passcode: external_exports.string().min(8).max(64).nullable().optional(),
|
|
23925
|
+
notifyOnView: external_exports.boolean().optional(),
|
|
23926
|
+
contentVersion: safeVersion.optional(),
|
|
23927
|
+
selectedCount: external_exports.number().int().min(1).max(MAX_SELECTED_CREDENTIALS).optional(),
|
|
23928
|
+
envelope: ShareEnvelopeValidator.optional(),
|
|
23929
|
+
ownerEncryptedRecovery: ShareOwnerRecoveryValidator.optional()
|
|
23930
|
+
}).strict().superRefine((value, ctx) => {
|
|
23931
|
+
const provided = [
|
|
23932
|
+
value.contentVersion,
|
|
23933
|
+
value.selectedCount,
|
|
23934
|
+
value.envelope,
|
|
23935
|
+
value.ownerEncryptedRecovery
|
|
23936
|
+
].filter((field) => field !== void 0).length;
|
|
23937
|
+
if (provided !== 0 && provided !== 4) {
|
|
23938
|
+
ctx.addIssue({
|
|
23939
|
+
code: "custom",
|
|
23940
|
+
message: "content replacement requires contentVersion, selectedCount, envelope and ownerEncryptedRecovery together"
|
|
23941
|
+
});
|
|
23305
23942
|
}
|
|
23306
23943
|
});
|
|
23307
|
-
var
|
|
23308
|
-
|
|
23309
|
-
|
|
23310
|
-
"
|
|
23311
|
-
|
|
23312
|
-
|
|
23944
|
+
var ShareLinkIdInputValidator = external_exports.object({ id: ShareLinkIdValidator }).strict();
|
|
23945
|
+
var ShareLinkOperationKeyInputValidator = external_exports.object({ id: ShareLinkIdValidator, operationId: external_exports.string().uuid() }).strict();
|
|
23946
|
+
var ShareLinkOwnerCommitOutputValidator = external_exports.discriminatedUnion("status", [
|
|
23947
|
+
external_exports.object({ status: external_exports.literal("completed"), share: ShareLinkValidator }).strict(),
|
|
23948
|
+
external_exports.object({
|
|
23949
|
+
status: external_exports.literal("pending"),
|
|
23950
|
+
id: ShareLinkIdValidator,
|
|
23951
|
+
operationId: external_exports.string().uuid()
|
|
23952
|
+
}).strict()
|
|
23313
23953
|
]);
|
|
23314
|
-
var
|
|
23315
|
-
|
|
23316
|
-
|
|
23317
|
-
|
|
23318
|
-
|
|
23319
|
-
|
|
23320
|
-
|
|
23321
|
-
|
|
23322
|
-
publishedAt: external_exports.string().min(1),
|
|
23323
|
-
effectiveAt: external_exports.string().optional(),
|
|
23324
|
-
etag: external_exports.string().optional(),
|
|
23325
|
-
signingMode: CredentialRefreshSigningModeValidator.optional(),
|
|
23326
|
-
updateSummary: external_exports.string().optional()
|
|
23327
|
-
});
|
|
23328
|
-
var GetCredentialRefreshHistoryInputValidator = external_exports.object({
|
|
23329
|
-
refreshId: external_exports.string().min(1),
|
|
23330
|
-
cursor: external_exports.string().optional(),
|
|
23331
|
-
limit: external_exports.number().int().positive().optional()
|
|
23332
|
-
});
|
|
23333
|
-
var GetCredentialRefreshHistoryResultValidator = external_exports.object({
|
|
23334
|
-
records: CredentialRefreshVersionMetadataValidator.array(),
|
|
23335
|
-
hasMore: external_exports.boolean(),
|
|
23336
|
-
cursor: external_exports.string().optional()
|
|
23337
|
-
});
|
|
23338
|
-
var CredentialRefreshChallengeValidator = external_exports.object({
|
|
23339
|
-
challenge: external_exports.string().min(1),
|
|
23340
|
-
expiresAt: external_exports.string().min(1),
|
|
23341
|
-
domain: external_exports.string().optional(),
|
|
23342
|
-
scheme: external_exports.literal("LearnCardDIDAuth").optional()
|
|
23343
|
-
});
|
|
23344
|
-
var PublicCredentialRefreshEnvelopeValidator = external_exports.object({
|
|
23345
|
-
format: external_exports.literal("vc"),
|
|
23346
|
-
credential: VCValidator,
|
|
23347
|
-
etag: external_exports.string().optional()
|
|
23348
|
-
});
|
|
23349
|
-
var JweCredentialRefreshEnvelopeValidator = external_exports.object({
|
|
23350
|
-
format: external_exports.literal("jwe"),
|
|
23351
|
-
jwe: JWEValidator,
|
|
23352
|
-
etag: external_exports.string().optional(),
|
|
23353
|
-
/** Present on LearnCard-managed endpoints; optional for interoperable JWE services. */
|
|
23354
|
-
version: external_exports.number().int().positive().optional()
|
|
23355
|
-
});
|
|
23356
|
-
var CredentialRefreshResponseEnvelopeValidator = external_exports.discriminatedUnion("format", [
|
|
23357
|
-
PublicCredentialRefreshEnvelopeValidator,
|
|
23358
|
-
JweCredentialRefreshEnvelopeValidator
|
|
23954
|
+
var ShareLinkOwnerStatusOutputValidator = external_exports.discriminatedUnion("status", [
|
|
23955
|
+
external_exports.object({ status: external_exports.literal("found"), share: ShareLinkValidator }).strict(),
|
|
23956
|
+
external_exports.object({
|
|
23957
|
+
status: external_exports.literal("pending"),
|
|
23958
|
+
id: ShareLinkIdValidator,
|
|
23959
|
+
operationId: external_exports.string().uuid()
|
|
23960
|
+
}).strict(),
|
|
23961
|
+
external_exports.object({ status: external_exports.literal("not_found"), id: ShareLinkIdValidator }).strict()
|
|
23359
23962
|
]);
|
|
23360
|
-
var
|
|
23361
|
-
|
|
23362
|
-
|
|
23363
|
-
|
|
23364
|
-
|
|
23365
|
-
|
|
23366
|
-
|
|
23367
|
-
|
|
23368
|
-
|
|
23369
|
-
|
|
23370
|
-
|
|
23371
|
-
|
|
23963
|
+
var ShareLinkOwnerRecoveryOutputValidator = external_exports.object({ recovery: ShareOwnerRecoveryValidator }).strict();
|
|
23964
|
+
var ShareLinkOwnerContentOutputValidator = external_exports.object({
|
|
23965
|
+
id: ShareLinkIdValidator,
|
|
23966
|
+
contentVersion: safeVersion,
|
|
23967
|
+
envelope: ShareEnvelopeValidator
|
|
23968
|
+
}).strict();
|
|
23969
|
+
var ResolveShareLinkInputValidator = external_exports.object({
|
|
23970
|
+
id: ShareLinkIdValidator,
|
|
23971
|
+
/** Sent only in a POST body; it must never be placed in a share URL. */
|
|
23972
|
+
passcode: external_exports.string().min(4).max(64).optional()
|
|
23973
|
+
}).strict();
|
|
23974
|
+
var ShareLinkPublicStateValidator = external_exports.discriminatedUnion("state", [
|
|
23975
|
+
external_exports.object({
|
|
23976
|
+
state: external_exports.literal("passcode_required"),
|
|
23977
|
+
id: ShareLinkIdValidator
|
|
23978
|
+
}).strict(),
|
|
23979
|
+
external_exports.object({ state: external_exports.literal("try_later"), id: ShareLinkIdValidator }).strict(),
|
|
23980
|
+
external_exports.object({
|
|
23981
|
+
state: external_exports.literal("active"),
|
|
23982
|
+
id: ShareLinkIdValidator,
|
|
23983
|
+
title: external_exports.string().max(120),
|
|
23984
|
+
note: external_exports.string().max(500).optional(),
|
|
23985
|
+
selectedCount: external_exports.number().int().min(1).max(MAX_SELECTED_CREDENTIALS),
|
|
23986
|
+
contentVersion: safeVersion,
|
|
23987
|
+
contentUrl: external_exports.string(),
|
|
23988
|
+
sharer: external_exports.object({
|
|
23989
|
+
displayName: external_exports.string().max(120),
|
|
23990
|
+
avatar: external_exports.string().max(2048).optional()
|
|
23991
|
+
}),
|
|
23992
|
+
createdAt: external_exports.iso.datetime(),
|
|
23993
|
+
updatedAt: external_exports.iso.datetime(),
|
|
23994
|
+
expiresAt: external_exports.iso.datetime().nullable()
|
|
23995
|
+
}).strict(),
|
|
23996
|
+
external_exports.object({
|
|
23997
|
+
state: external_exports.literal("expired"),
|
|
23998
|
+
id: ShareLinkIdValidator,
|
|
23999
|
+
expiresAt: external_exports.iso.datetime()
|
|
24000
|
+
}).strict(),
|
|
24001
|
+
external_exports.object({
|
|
24002
|
+
state: external_exports.literal("stopped"),
|
|
24003
|
+
id: ShareLinkIdValidator,
|
|
24004
|
+
stoppedAt: external_exports.iso.datetime()
|
|
24005
|
+
}).strict(),
|
|
24006
|
+
external_exports.object({ state: external_exports.literal("not_found"), id: ShareLinkIdValidator }).strict()
|
|
23372
24007
|
]);
|
|
23373
|
-
var
|
|
23374
|
-
|
|
23375
|
-
|
|
23376
|
-
|
|
23377
|
-
|
|
23378
|
-
|
|
23379
|
-
var CredentialRefreshUnchangedResultValidator = external_exports.object({
|
|
23380
|
-
status: external_exports.literal("unchanged"),
|
|
23381
|
-
checkedAt: external_exports.string().min(1),
|
|
23382
|
-
etag: external_exports.string().optional()
|
|
23383
|
-
});
|
|
23384
|
-
var CredentialRefreshUnsupportedResultValidator = external_exports.object({
|
|
23385
|
-
status: external_exports.literal("unsupported")
|
|
23386
|
-
});
|
|
23387
|
-
var CredentialRefreshFailedResultValidator = external_exports.object({
|
|
23388
|
-
status: external_exports.literal("failed"),
|
|
23389
|
-
code: CredentialRefreshFailureCodeValidator,
|
|
23390
|
-
retryable: external_exports.boolean()
|
|
24008
|
+
var ListShareLinksInputValidator = external_exports.object({
|
|
24009
|
+
limit: external_exports.number().int().min(1).max(50).default(25),
|
|
24010
|
+
cursor: external_exports.string().max(512).optional()
|
|
24011
|
+
}).strict();
|
|
24012
|
+
var PaginatedShareLinksValidator = PaginationResponseValidator.extend({
|
|
24013
|
+
records: ShareLinkValidator.array()
|
|
23391
24014
|
});
|
|
23392
|
-
var
|
|
23393
|
-
|
|
23394
|
-
|
|
23395
|
-
|
|
23396
|
-
|
|
23397
|
-
|
|
24015
|
+
var AcknowledgeViewInputValidator = external_exports.object({
|
|
24016
|
+
receipt: external_exports.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/)
|
|
24017
|
+
}).strict();
|
|
24018
|
+
var AcknowledgeViewOutputValidator = external_exports.object({ ok: external_exports.literal(true) }).strict();
|
|
24019
|
+
var SHARE_VIEW_RECEIPT_TTL_SECONDS = 10 * 60;
|
|
24020
|
+
var ShareLinkPublicContentViewValidator = external_exports.object({
|
|
24021
|
+
id: ShareLinkIdValidator,
|
|
24022
|
+
contentVersion: safeVersion,
|
|
24023
|
+
envelope: ShareEnvelopeValidator,
|
|
24024
|
+
contentUrl: external_exports.string(),
|
|
24025
|
+
receipt: external_exports.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/)
|
|
24026
|
+
}).strict();
|
|
23398
24027
|
|
|
23399
24028
|
// src/helpers.ts
|
|
23400
24029
|
var import_json_stringify_deterministic = __toESM(require_lib(), 1);
|