@learncard/network-plugin 2.13.17 → 2.14.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/lcn-plugin.cjs.development.cjs +342 -24
- package/dist/lcn-plugin.cjs.development.cjs.map +3 -3
- package/dist/lcn-plugin.cjs.production.min.cjs +9 -9
- package/dist/lcn-plugin.cjs.production.min.cjs.map +3 -3
- package/dist/lcn-plugin.esm.js +342 -24
- package/dist/lcn-plugin.esm.js.map +3 -3
- package/dist/plugin.d.ts.map +1 -1
- package/dist/test/verify-boost-regression.test.d.ts +2 -0
- package/dist/test/verify-boost-regression.test.d.ts.map +1 -0
- package/dist/types.d.ts +57 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/plugin.ts +177 -11
- package/src/test/index.test.ts +438 -4
- package/src/test/verify-boost-regression.test.ts +167 -0
- package/src/types.ts +66 -0
|
@@ -15126,14 +15126,22 @@ var UnsignedVCValidator = external_exports.object({
|
|
|
15126
15126
|
}).catchall(external_exports.any());
|
|
15127
15127
|
var ProofValidator = external_exports.object({
|
|
15128
15128
|
type: external_exports.string(),
|
|
15129
|
-
created: external_exports.string(),
|
|
15129
|
+
created: external_exports.string().optional(),
|
|
15130
15130
|
challenge: external_exports.string().optional(),
|
|
15131
15131
|
domain: external_exports.string().optional(),
|
|
15132
15132
|
nonce: external_exports.string().optional(),
|
|
15133
15133
|
proofPurpose: external_exports.string(),
|
|
15134
15134
|
verificationMethod: external_exports.string(),
|
|
15135
15135
|
jws: external_exports.string().optional()
|
|
15136
|
-
}).catchall(external_exports.any())
|
|
15136
|
+
}).catchall(external_exports.any()).superRefine((proof, ctx) => {
|
|
15137
|
+
if (proof.created === void 0 && (proof.type !== "DataIntegrityProof" || proof.cryptosuite !== "ecdsa-rdfc-2019")) {
|
|
15138
|
+
ctx.addIssue({
|
|
15139
|
+
code: "custom",
|
|
15140
|
+
path: ["created"],
|
|
15141
|
+
message: "created is required for this proof suite"
|
|
15142
|
+
});
|
|
15143
|
+
}
|
|
15144
|
+
});
|
|
15137
15145
|
var VCValidator = UnsignedVCValidator.extend({
|
|
15138
15146
|
proof: ProofValidator.or(ProofValidator.array())
|
|
15139
15147
|
});
|
|
@@ -15894,7 +15902,10 @@ var SendOptionsValidator = external_exports.object({
|
|
|
15894
15902
|
webhookUrl: external_exports.string().url().optional().describe("Webhook URL to receive claim notifications"),
|
|
15895
15903
|
suppressDelivery: external_exports.boolean().optional().describe("If true, returns claimUrl without sending email/SMS"),
|
|
15896
15904
|
branding: SendBrandingOptionsValidator.optional().describe("Branding for email/SMS delivery"),
|
|
15897
|
-
guardianEmail: external_exports.string().email().optional().describe("Guardian email that must approve before student can claim")
|
|
15905
|
+
guardianEmail: external_exports.string().email().optional().describe("Guardian email that must approve before student can claim"),
|
|
15906
|
+
expiresInDays: external_exports.number().int().min(1).max(720).optional().describe(
|
|
15907
|
+
"How many days the credential stays claimable in the Universal Inbox (default 30). Does not change the credential validity period."
|
|
15908
|
+
)
|
|
15898
15909
|
});
|
|
15899
15910
|
var SendBoostInputValidator = external_exports.object({
|
|
15900
15911
|
type: external_exports.literal("boost"),
|
|
@@ -16015,15 +16026,6 @@ var ConsentFlowContractDataValidator = external_exports.object({
|
|
|
16015
16026
|
var PaginatedConsentFlowDataValidator = PaginationResponseValidator.extend({
|
|
16016
16027
|
records: ConsentFlowContractDataValidator.array()
|
|
16017
16028
|
});
|
|
16018
|
-
var ConsentFlowContractDataForDidValidator = external_exports.object({
|
|
16019
|
-
credentials: external_exports.object({ category: external_exports.string(), uri: external_exports.string() }).array(),
|
|
16020
|
-
personal: external_exports.record(external_exports.string(), external_exports.string()).default({}),
|
|
16021
|
-
date: external_exports.string(),
|
|
16022
|
-
contractUri: external_exports.string()
|
|
16023
|
-
});
|
|
16024
|
-
var PaginatedConsentFlowDataForDidValidator = PaginationResponseValidator.extend({
|
|
16025
|
-
records: ConsentFlowContractDataForDidValidator.array()
|
|
16026
|
-
});
|
|
16027
16029
|
var ConsentFlowTermValidator = external_exports.object({
|
|
16028
16030
|
sharing: external_exports.boolean().optional(),
|
|
16029
16031
|
shared: external_exports.string().array().optional(),
|
|
@@ -16057,6 +16059,34 @@ var PaginatedConsentFlowTermsValidator = PaginationResponseValidator.extend({
|
|
|
16057
16059
|
status: ConsentFlowTermsStatusValidator
|
|
16058
16060
|
}).array()
|
|
16059
16061
|
});
|
|
16062
|
+
var ConsentFlowGuardianApprovalValidator = external_exports.object({
|
|
16063
|
+
guardianProfileId: external_exports.string(),
|
|
16064
|
+
guardianDid: external_exports.string(),
|
|
16065
|
+
approvedAt: external_exports.string().datetime(),
|
|
16066
|
+
contractUpdatedAt: external_exports.string()
|
|
16067
|
+
});
|
|
16068
|
+
var ConsentFlowContractDataForDidValidator = external_exports.object({
|
|
16069
|
+
credentials: external_exports.object({ category: external_exports.string(), uri: external_exports.string() }).array(),
|
|
16070
|
+
personal: external_exports.record(external_exports.string(), external_exports.string()).default({}),
|
|
16071
|
+
date: external_exports.string(),
|
|
16072
|
+
createdAt: external_exports.string().optional(),
|
|
16073
|
+
contractUpdatedAt: external_exports.string(),
|
|
16074
|
+
contractExpiresAt: external_exports.string().optional(),
|
|
16075
|
+
reasonForAccessing: external_exports.string().optional(),
|
|
16076
|
+
guardian: external_exports.object({
|
|
16077
|
+
required: external_exports.boolean(),
|
|
16078
|
+
approved: external_exports.boolean(),
|
|
16079
|
+
approval: ConsentFlowGuardianApprovalValidator.optional()
|
|
16080
|
+
}),
|
|
16081
|
+
contractUri: external_exports.string(),
|
|
16082
|
+
termsUri: external_exports.string(),
|
|
16083
|
+
status: ConsentFlowTermsStatusValidator,
|
|
16084
|
+
expiresAt: external_exports.string().optional(),
|
|
16085
|
+
terms: ConsentFlowTermsValidator
|
|
16086
|
+
});
|
|
16087
|
+
var PaginatedConsentFlowDataForDidValidator = PaginationResponseValidator.extend({
|
|
16088
|
+
records: ConsentFlowContractDataForDidValidator.array()
|
|
16089
|
+
});
|
|
16060
16090
|
var ConsentFlowContractQueryValidator = external_exports.object({
|
|
16061
16091
|
read: external_exports.object({
|
|
16062
16092
|
anonymize: external_exports.boolean().optional(),
|
|
@@ -16117,6 +16147,7 @@ var ConsentFlowTransactionValidator = external_exports.object({
|
|
|
16117
16147
|
expiresAt: external_exports.string().optional(),
|
|
16118
16148
|
oneTime: external_exports.boolean().optional(),
|
|
16119
16149
|
terms: ConsentFlowTermsValidator.optional(),
|
|
16150
|
+
guardianApproval: ConsentFlowGuardianApprovalValidator.optional(),
|
|
16120
16151
|
id: external_exports.string(),
|
|
16121
16152
|
action: ConsentFlowTransactionActionValidator,
|
|
16122
16153
|
date: external_exports.string(),
|
|
@@ -16189,7 +16220,8 @@ var LCNNotificationTypeEnumValidator = external_exports.enum([
|
|
|
16189
16220
|
"APP_NOTIFICATION",
|
|
16190
16221
|
"CREDENTIAL_REVOKED",
|
|
16191
16222
|
"CREDENTIAL_SUSPENDED",
|
|
16192
|
-
"CREDENTIAL_UNSUSPENDED"
|
|
16223
|
+
"CREDENTIAL_UNSUSPENDED",
|
|
16224
|
+
"CREDENTIAL_REFRESHED"
|
|
16193
16225
|
]);
|
|
16194
16226
|
var LCNNotificationMessageValidator = external_exports.object({
|
|
16195
16227
|
title: external_exports.string().optional(),
|
|
@@ -16321,12 +16353,16 @@ var CreateContactMethodSessionResponseValidator = external_exports.object({
|
|
|
16321
16353
|
});
|
|
16322
16354
|
var InboxCredentialValidator = external_exports.object({
|
|
16323
16355
|
id: external_exports.string(),
|
|
16324
|
-
credential: external_exports.string(),
|
|
16356
|
+
credential: external_exports.string().optional(),
|
|
16325
16357
|
isSigned: external_exports.boolean(),
|
|
16326
16358
|
currentStatus: LCNInboxStatusEnumValidator,
|
|
16327
16359
|
isAccepted: external_exports.boolean().optional(),
|
|
16328
16360
|
expiresAt: external_exports.string(),
|
|
16329
16361
|
createdAt: external_exports.string(),
|
|
16362
|
+
finalizedAt: external_exports.string().optional(),
|
|
16363
|
+
expiredAt: external_exports.string().optional(),
|
|
16364
|
+
credentialName: external_exports.string().optional(),
|
|
16365
|
+
achievementType: external_exports.string().optional(),
|
|
16330
16366
|
issuerDid: external_exports.string(),
|
|
16331
16367
|
webhookUrl: external_exports.string().optional(),
|
|
16332
16368
|
boostUri: external_exports.string().optional(),
|
|
@@ -16380,7 +16416,9 @@ var IssueInboxCredentialValidator = external_exports.object({
|
|
|
16380
16416
|
"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."
|
|
16381
16417
|
),
|
|
16382
16418
|
webhookUrl: external_exports.string().url().optional().describe("The webhook URL to receive credential issuance events."),
|
|
16383
|
-
expiresInDays: external_exports.number().min(1).max(
|
|
16419
|
+
expiresInDays: external_exports.number().int().min(1).max(720).optional().describe(
|
|
16420
|
+
"How many days the encrypted inbox payload remains claimable. This does not change the credential validity period."
|
|
16421
|
+
),
|
|
16384
16422
|
templateData: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe(
|
|
16385
16423
|
"Template data to render into the boost credential template using Mustache syntax. Only used when boostUri is provided."
|
|
16386
16424
|
),
|
|
@@ -16443,6 +16481,9 @@ var ClaimInboxCredentialValidator = external_exports.object({
|
|
|
16443
16481
|
credential: VCValidator.or(VPValidator).or(UnsignedVCValidator).or(CredentialNameRefValidator).describe("The credential to issue, or a { name } reference to resolve a boost template."),
|
|
16444
16482
|
configuration: external_exports.object({
|
|
16445
16483
|
publishableKey: external_exports.string(),
|
|
16484
|
+
expiresInDays: external_exports.number().int().min(1).max(720).optional().describe(
|
|
16485
|
+
"Inbox claim window in days. Defaults to 720; use a shorter window for sensitive records."
|
|
16486
|
+
),
|
|
16446
16487
|
signingAuthorityName: external_exports.string().optional(),
|
|
16447
16488
|
listingId: external_exports.string().optional(),
|
|
16448
16489
|
listingSlug: external_exports.string().optional()
|
|
@@ -17069,6 +17110,191 @@ var inAppMessagesFlagValidator = external_exports.object({
|
|
|
17069
17110
|
version: external_exports.number().default(1),
|
|
17070
17111
|
messages: external_exports.array(inAppMessageValidator).default([])
|
|
17071
17112
|
}).passthrough();
|
|
17113
|
+
var LearnCardRefreshAuthorizationValidator = external_exports.object({ type: external_exports.literal("LearnCardDIDAuth") }).catchall(external_exports.any());
|
|
17114
|
+
var ManagedCredentialRefreshServiceValidator = external_exports.object({
|
|
17115
|
+
id: external_exports.string().min(1),
|
|
17116
|
+
type: external_exports.literal("LearnCardCredentialRefresh2026"),
|
|
17117
|
+
authorization: LearnCardRefreshAuthorizationValidator.optional()
|
|
17118
|
+
}).catchall(external_exports.any());
|
|
17119
|
+
var StandardCredentialRefreshServiceValidator = external_exports.object({
|
|
17120
|
+
id: external_exports.string().min(1),
|
|
17121
|
+
type: external_exports.literal("1EdTechCredentialRefresh")
|
|
17122
|
+
}).catchall(external_exports.any());
|
|
17123
|
+
var SupportedCredentialRefreshServiceValidator = external_exports.union([
|
|
17124
|
+
ManagedCredentialRefreshServiceValidator,
|
|
17125
|
+
StandardCredentialRefreshServiceValidator
|
|
17126
|
+
]);
|
|
17127
|
+
var AllocateCredentialRefreshInputValidator = external_exports.object({
|
|
17128
|
+
holder: external_exports.object({
|
|
17129
|
+
profileId: external_exports.string().optional(),
|
|
17130
|
+
did: external_exports.string().min(1)
|
|
17131
|
+
}),
|
|
17132
|
+
credentialId: external_exports.string().min(1)
|
|
17133
|
+
});
|
|
17134
|
+
var AllocateCredentialRefreshResultValidator = external_exports.object({
|
|
17135
|
+
refreshId: external_exports.string().min(1),
|
|
17136
|
+
refreshService: ManagedCredentialRefreshServiceValidator.extend({
|
|
17137
|
+
authorization: LearnCardRefreshAuthorizationValidator
|
|
17138
|
+
})
|
|
17139
|
+
});
|
|
17140
|
+
var CredentialRefreshSigningModeValidator = external_exports.enum(["issuer-signed", "signing-authority"]);
|
|
17141
|
+
var PublishCredentialRefreshBaseFields = {
|
|
17142
|
+
refreshId: external_exports.string().min(1),
|
|
17143
|
+
notifyHolder: external_exports.boolean().optional(),
|
|
17144
|
+
updateSummary: external_exports.string().optional(),
|
|
17145
|
+
idempotencyKey: external_exports.string().optional()
|
|
17146
|
+
};
|
|
17147
|
+
var PublishIssuerSignedRefreshValidator = external_exports.object({
|
|
17148
|
+
...PublishCredentialRefreshBaseFields,
|
|
17149
|
+
mode: external_exports.literal("issuer-signed"),
|
|
17150
|
+
signedCredential: VCValidator
|
|
17151
|
+
});
|
|
17152
|
+
var PublishSigningAuthorityRefreshValidator = external_exports.object({
|
|
17153
|
+
...PublishCredentialRefreshBaseFields,
|
|
17154
|
+
mode: external_exports.literal("signing-authority"),
|
|
17155
|
+
credential: UnsignedVCValidator,
|
|
17156
|
+
signingAuthority: external_exports.object({
|
|
17157
|
+
type: external_exports.string().min(1)
|
|
17158
|
+
}).catchall(external_exports.any())
|
|
17159
|
+
});
|
|
17160
|
+
var PublishCredentialRefreshInputValidator = external_exports.object({
|
|
17161
|
+
...PublishCredentialRefreshBaseFields,
|
|
17162
|
+
mode: CredentialRefreshSigningModeValidator,
|
|
17163
|
+
signedCredential: VCValidator.optional(),
|
|
17164
|
+
credential: UnsignedVCValidator.optional(),
|
|
17165
|
+
signingAuthority: external_exports.object({
|
|
17166
|
+
type: external_exports.string().min(1)
|
|
17167
|
+
}).catchall(external_exports.any()).optional()
|
|
17168
|
+
}).superRefine((input, ctx) => {
|
|
17169
|
+
if (input.mode === "issuer-signed" && !input.signedCredential) {
|
|
17170
|
+
ctx.addIssue({
|
|
17171
|
+
code: "custom",
|
|
17172
|
+
path: ["signedCredential"],
|
|
17173
|
+
message: "signedCredential is required for issuer-signed publication"
|
|
17174
|
+
});
|
|
17175
|
+
}
|
|
17176
|
+
if (input.mode === "issuer-signed" && (input.credential !== void 0 || input.signingAuthority !== void 0)) {
|
|
17177
|
+
ctx.addIssue({
|
|
17178
|
+
code: "custom",
|
|
17179
|
+
path: ["mode"],
|
|
17180
|
+
message: "issuer-signed publication cannot include signing-authority fields"
|
|
17181
|
+
});
|
|
17182
|
+
}
|
|
17183
|
+
if (input.mode === "signing-authority") {
|
|
17184
|
+
if (input.signedCredential !== void 0) {
|
|
17185
|
+
ctx.addIssue({
|
|
17186
|
+
code: "custom",
|
|
17187
|
+
path: ["signedCredential"],
|
|
17188
|
+
message: "signing-authority publication cannot include signedCredential"
|
|
17189
|
+
});
|
|
17190
|
+
}
|
|
17191
|
+
if (!input.credential) {
|
|
17192
|
+
ctx.addIssue({
|
|
17193
|
+
code: "custom",
|
|
17194
|
+
path: ["credential"],
|
|
17195
|
+
message: "credential is required for signing-authority publication"
|
|
17196
|
+
});
|
|
17197
|
+
}
|
|
17198
|
+
if (!input.signingAuthority) {
|
|
17199
|
+
ctx.addIssue({
|
|
17200
|
+
code: "custom",
|
|
17201
|
+
path: ["signingAuthority"],
|
|
17202
|
+
message: "signingAuthority is required for signing-authority publication"
|
|
17203
|
+
});
|
|
17204
|
+
}
|
|
17205
|
+
}
|
|
17206
|
+
});
|
|
17207
|
+
var PublishCredentialRefreshNotificationValidator = external_exports.enum([
|
|
17208
|
+
"queued",
|
|
17209
|
+
"suppressed",
|
|
17210
|
+
"not-applicable",
|
|
17211
|
+
/** Publication succeeded, but the post-commit notification enqueue must be retried. */
|
|
17212
|
+
"delivery-failed"
|
|
17213
|
+
]);
|
|
17214
|
+
var PublishCredentialRefreshResultValidator = external_exports.object({
|
|
17215
|
+
refreshId: external_exports.string().min(1),
|
|
17216
|
+
version: external_exports.number().int().positive(),
|
|
17217
|
+
publishedAt: external_exports.string().min(1),
|
|
17218
|
+
notification: PublishCredentialRefreshNotificationValidator
|
|
17219
|
+
});
|
|
17220
|
+
var CredentialRefreshVersionMetadataValidator = external_exports.object({
|
|
17221
|
+
version: external_exports.number().int().positive(),
|
|
17222
|
+
publishedAt: external_exports.string().min(1),
|
|
17223
|
+
effectiveAt: external_exports.string().optional(),
|
|
17224
|
+
etag: external_exports.string().optional(),
|
|
17225
|
+
signingMode: CredentialRefreshSigningModeValidator.optional(),
|
|
17226
|
+
updateSummary: external_exports.string().optional()
|
|
17227
|
+
});
|
|
17228
|
+
var GetCredentialRefreshHistoryInputValidator = external_exports.object({
|
|
17229
|
+
refreshId: external_exports.string().min(1),
|
|
17230
|
+
cursor: external_exports.string().optional(),
|
|
17231
|
+
limit: external_exports.number().int().positive().optional()
|
|
17232
|
+
});
|
|
17233
|
+
var GetCredentialRefreshHistoryResultValidator = external_exports.object({
|
|
17234
|
+
records: CredentialRefreshVersionMetadataValidator.array(),
|
|
17235
|
+
hasMore: external_exports.boolean(),
|
|
17236
|
+
cursor: external_exports.string().optional()
|
|
17237
|
+
});
|
|
17238
|
+
var CredentialRefreshChallengeValidator = external_exports.object({
|
|
17239
|
+
challenge: external_exports.string().min(1),
|
|
17240
|
+
expiresAt: external_exports.string().min(1),
|
|
17241
|
+
domain: external_exports.string().optional(),
|
|
17242
|
+
scheme: external_exports.literal("LearnCardDIDAuth").optional()
|
|
17243
|
+
});
|
|
17244
|
+
var PublicCredentialRefreshEnvelopeValidator = external_exports.object({
|
|
17245
|
+
format: external_exports.literal("vc"),
|
|
17246
|
+
credential: VCValidator,
|
|
17247
|
+
etag: external_exports.string().optional()
|
|
17248
|
+
});
|
|
17249
|
+
var JweCredentialRefreshEnvelopeValidator = external_exports.object({
|
|
17250
|
+
format: external_exports.literal("jwe"),
|
|
17251
|
+
jwe: JWEValidator,
|
|
17252
|
+
etag: external_exports.string().optional(),
|
|
17253
|
+
/** Present on LearnCard-managed endpoints; optional for interoperable JWE services. */
|
|
17254
|
+
version: external_exports.number().int().positive().optional()
|
|
17255
|
+
});
|
|
17256
|
+
var CredentialRefreshResponseEnvelopeValidator = external_exports.discriminatedUnion("format", [
|
|
17257
|
+
PublicCredentialRefreshEnvelopeValidator,
|
|
17258
|
+
JweCredentialRefreshEnvelopeValidator
|
|
17259
|
+
]);
|
|
17260
|
+
var CredentialRefreshFailureCodeValidator = external_exports.enum([
|
|
17261
|
+
"UNAVAILABLE",
|
|
17262
|
+
"TIMEOUT",
|
|
17263
|
+
"UNSUPPORTED_SERVICE",
|
|
17264
|
+
"UNAUTHORIZED",
|
|
17265
|
+
"MALFORMED_RESPONSE",
|
|
17266
|
+
"INVALID_PROOF",
|
|
17267
|
+
"ISSUER_MISMATCH",
|
|
17268
|
+
"ID_MISMATCH",
|
|
17269
|
+
"ROLLBACK",
|
|
17270
|
+
"REVOKED",
|
|
17271
|
+
"UNSAFE_ENDPOINT"
|
|
17272
|
+
]);
|
|
17273
|
+
var CredentialRefreshUpdatedResultValidator = external_exports.object({
|
|
17274
|
+
status: external_exports.literal("updated"),
|
|
17275
|
+
credential: VCValidator,
|
|
17276
|
+
etag: external_exports.string().optional(),
|
|
17277
|
+
managedVersion: external_exports.number().int().positive().optional()
|
|
17278
|
+
});
|
|
17279
|
+
var CredentialRefreshUnchangedResultValidator = external_exports.object({
|
|
17280
|
+
status: external_exports.literal("unchanged"),
|
|
17281
|
+
checkedAt: external_exports.string().min(1),
|
|
17282
|
+
etag: external_exports.string().optional()
|
|
17283
|
+
});
|
|
17284
|
+
var CredentialRefreshUnsupportedResultValidator = external_exports.object({
|
|
17285
|
+
status: external_exports.literal("unsupported")
|
|
17286
|
+
});
|
|
17287
|
+
var CredentialRefreshFailedResultValidator = external_exports.object({
|
|
17288
|
+
status: external_exports.literal("failed"),
|
|
17289
|
+
code: CredentialRefreshFailureCodeValidator,
|
|
17290
|
+
retryable: external_exports.boolean()
|
|
17291
|
+
});
|
|
17292
|
+
var CredentialRefreshResultValidator = external_exports.discriminatedUnion("status", [
|
|
17293
|
+
CredentialRefreshUpdatedResultValidator,
|
|
17294
|
+
CredentialRefreshUnchangedResultValidator,
|
|
17295
|
+
CredentialRefreshUnsupportedResultValidator,
|
|
17296
|
+
CredentialRefreshFailedResultValidator
|
|
17297
|
+
]);
|
|
17072
17298
|
|
|
17073
17299
|
// src/plugin.ts
|
|
17074
17300
|
var import_helpers = require("@learncard/helpers");
|
|
@@ -17686,6 +17912,27 @@ var issueCredentialWithNetworkStatus = /* @__PURE__ */ __name(async (learnCard,
|
|
|
17686
17912
|
await appendNetworkCredentialStatus(client, credential, statusPurposes)
|
|
17687
17913
|
);
|
|
17688
17914
|
}, "issueCredentialWithNetworkStatus");
|
|
17915
|
+
var MANAGED_REFRESH_SERVICE_CONTEXT = {
|
|
17916
|
+
"LearnCardCredentialRefresh2026": "https://learncard.com/refresh#LearnCardCredentialRefresh2026",
|
|
17917
|
+
authorization: {
|
|
17918
|
+
"@id": "https://purl.imsglobal.org/spec/ob/v3p0#authorization",
|
|
17919
|
+
"@context": {
|
|
17920
|
+
LearnCardDIDAuth: "https://docs.learncard.com/definitions#LearnCardDIDAuth"
|
|
17921
|
+
}
|
|
17922
|
+
}
|
|
17923
|
+
};
|
|
17924
|
+
var injectManagedRefreshService = /* @__PURE__ */ __name((credential, refreshService) => {
|
|
17925
|
+
const existingContext = credential["@context"];
|
|
17926
|
+
const contextList = Array.isArray(existingContext) ? existingContext : [existingContext];
|
|
17927
|
+
const hasMapping = contextList.some(
|
|
17928
|
+
(entry) => !!entry && typeof entry === "object" && "LearnCardCredentialRefresh2026" in entry
|
|
17929
|
+
);
|
|
17930
|
+
return {
|
|
17931
|
+
...credential,
|
|
17932
|
+
"@context": hasMapping ? contextList : [...contextList, MANAGED_REFRESH_SERVICE_CONTEXT],
|
|
17933
|
+
refreshService
|
|
17934
|
+
};
|
|
17935
|
+
}, "injectManagedRefreshService");
|
|
17689
17936
|
async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, options) {
|
|
17690
17937
|
const apiToken = typeof apiTokenOrOptions === "string" ? apiTokenOrOptions : void 0;
|
|
17691
17938
|
const resolvedOptions = (typeof apiTokenOrOptions === "object" ? apiTokenOrOptions : options) ?? {};
|
|
@@ -18447,6 +18694,27 @@ async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, opt
|
|
|
18447
18694
|
await ensureUser();
|
|
18448
18695
|
return client.boost.allocateCredentialStatus.mutate(options2);
|
|
18449
18696
|
}, "allocateCredentialStatus"),
|
|
18697
|
+
allocateCredentialRefresh: /* @__PURE__ */ __name(async (_learnCard, input) => {
|
|
18698
|
+
await ensureUser();
|
|
18699
|
+
return client.credentialRefresh.allocateCredentialRefresh.mutate(input);
|
|
18700
|
+
}, "allocateCredentialRefresh"),
|
|
18701
|
+
sendRefreshableCredential: /* @__PURE__ */ __name(async (_learnCard, refreshId, credential, boostUri, skipNotification) => {
|
|
18702
|
+
await ensureUser();
|
|
18703
|
+
return client.credentialRefresh.sendRefreshableCredential.mutate({
|
|
18704
|
+
refreshId,
|
|
18705
|
+
credential,
|
|
18706
|
+
boostUri,
|
|
18707
|
+
...skipNotification ? { skipNotification: true } : {}
|
|
18708
|
+
});
|
|
18709
|
+
}, "sendRefreshableCredential"),
|
|
18710
|
+
publishCredentialRefresh: /* @__PURE__ */ __name(async (_learnCard, input) => {
|
|
18711
|
+
await ensureUser();
|
|
18712
|
+
return client.credentialRefresh.publishCredentialRefresh.mutate(input);
|
|
18713
|
+
}, "publishCredentialRefresh"),
|
|
18714
|
+
getCredentialRefreshHistory: /* @__PURE__ */ __name(async (_learnCard, input) => {
|
|
18715
|
+
await ensureUser();
|
|
18716
|
+
return client.credentialRefresh.getCredentialRefreshHistory.query(input);
|
|
18717
|
+
}, "getCredentialRefreshHistory"),
|
|
18450
18718
|
revokeBoostRecipient: /* @__PURE__ */ __name(async (_learnCard, boostUri, recipientProfileId, credentialUri) => {
|
|
18451
18719
|
await ensureUser();
|
|
18452
18720
|
const input = { boostUri, recipientProfileId };
|
|
@@ -18513,6 +18781,17 @@ async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, opt
|
|
|
18513
18781
|
if (typeof options2 === "object" && options2.overideFn) {
|
|
18514
18782
|
boost = options2.overideFn(boost);
|
|
18515
18783
|
}
|
|
18784
|
+
const enableRefresh = typeof options2 === "object" && options2.enableRefresh === true;
|
|
18785
|
+
let managedRefreshId;
|
|
18786
|
+
if (enableRefresh) {
|
|
18787
|
+
if (!boost.id) boost.id = `urn:uuid:${crypto.randomUUID()}`;
|
|
18788
|
+
const allocation = await client.credentialRefresh.allocateCredentialRefresh.mutate({
|
|
18789
|
+
holder: { profileId, did: targetProfile.did },
|
|
18790
|
+
credentialId: boost.id
|
|
18791
|
+
});
|
|
18792
|
+
managedRefreshId = allocation.refreshId;
|
|
18793
|
+
boost = injectManagedRefreshService(boost, allocation.refreshService);
|
|
18794
|
+
}
|
|
18516
18795
|
const statusPurposes = typeof options2 === "object" ? options2.statusPurposes : void 0;
|
|
18517
18796
|
const vc = await issueCredentialWithNetworkStatus(
|
|
18518
18797
|
_learnCard,
|
|
@@ -18520,6 +18799,14 @@ async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, opt
|
|
|
18520
18799
|
boost,
|
|
18521
18800
|
statusPurposes
|
|
18522
18801
|
);
|
|
18802
|
+
if (managedRefreshId) {
|
|
18803
|
+
return client.credentialRefresh.sendRefreshableCredential.mutate({
|
|
18804
|
+
refreshId: managedRefreshId,
|
|
18805
|
+
credential: vc,
|
|
18806
|
+
boostUri,
|
|
18807
|
+
...typeof options2 === "object" && options2.skipNotification ? { skipNotification: true } : {}
|
|
18808
|
+
});
|
|
18809
|
+
}
|
|
18523
18810
|
if (typeof options2 === "object" && !options2.encrypt || !options2) {
|
|
18524
18811
|
return client.boost.sendBoost.mutate({
|
|
18525
18812
|
profileId,
|
|
@@ -19002,6 +19289,23 @@ async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, opt
|
|
|
19002
19289
|
await ensureUser();
|
|
19003
19290
|
return client.inbox.finalize.mutate();
|
|
19004
19291
|
}, "finalizeInboxCredentials"),
|
|
19292
|
+
recoverInboxCredentials: /* @__PURE__ */ __name(async (learnCard2, options2 = {}) => {
|
|
19293
|
+
const result = await client.inbox.getMyInboxDeliveries.query(options2);
|
|
19294
|
+
const results = await Promise.allSettled(
|
|
19295
|
+
result.records.map(async (record2) => ({
|
|
19296
|
+
...record2,
|
|
19297
|
+
credential: VCValidator.parse(
|
|
19298
|
+
await learnCard2.invoke.decryptDagJwe(record2.credential, [
|
|
19299
|
+
learnCard2.id.keypair()
|
|
19300
|
+
])
|
|
19301
|
+
)
|
|
19302
|
+
}))
|
|
19303
|
+
);
|
|
19304
|
+
const records = results.flatMap(
|
|
19305
|
+
(record2) => record2.status === "fulfilled" ? [record2.value] : []
|
|
19306
|
+
);
|
|
19307
|
+
return { ...result, records, failed: results.length - records.length };
|
|
19308
|
+
}, "recoverInboxCredentials"),
|
|
19005
19309
|
sendGuardianApprovalEmail: /* @__PURE__ */ __name(async (_learnCard, options2) => {
|
|
19006
19310
|
await ensureUser();
|
|
19007
19311
|
return client.inbox.sendGuardianApprovalEmail.mutate(options2);
|
|
@@ -19435,6 +19739,13 @@ var getVerifyBoostPlugin = /* @__PURE__ */ __name(async (learnCard, trustedBoost
|
|
|
19435
19739
|
if (!issuerDID) return;
|
|
19436
19740
|
return boostRegistry.find((o) => o.did === issuerDID);
|
|
19437
19741
|
}, "getTrustedBoostVerifier");
|
|
19742
|
+
const getTrustedBoostNetwork = /* @__PURE__ */ __name((boostId) => {
|
|
19743
|
+
if (typeof boostId !== "string") return;
|
|
19744
|
+
const match = /^lc:network:([^?#\s]+)\/(?:trpc:)?boost:([^/?#\s]+)$/.exec(boostId);
|
|
19745
|
+
if (!match) return;
|
|
19746
|
+
const networkDid = `did:web:${match[1].replace(/\//g, ":")}`;
|
|
19747
|
+
return boostRegistry.find((entry) => entry.did === networkDid);
|
|
19748
|
+
}, "getTrustedBoostNetwork");
|
|
19438
19749
|
return {
|
|
19439
19750
|
name: "VerifyBoost",
|
|
19440
19751
|
displayName: "Verify Boost Extension",
|
|
@@ -19445,18 +19756,20 @@ var getVerifyBoostPlugin = /* @__PURE__ */ __name(async (learnCard, trustedBoost
|
|
|
19445
19756
|
credential,
|
|
19446
19757
|
options
|
|
19447
19758
|
);
|
|
19759
|
+
const hasOuterVerificationErrors = Boolean(verificationCheck.errors?.length);
|
|
19448
19760
|
const boostCredential = credential?.boostCredential;
|
|
19449
19761
|
try {
|
|
19450
|
-
|
|
19451
|
-
|
|
19452
|
-
const
|
|
19453
|
-
|
|
19762
|
+
const boostId = boostCredential?.boostId ?? credential?.boostId;
|
|
19763
|
+
if (boostCredential || credential?.boostId || credential?.type?.includes("BoostCredential")) {
|
|
19764
|
+
const verifyBoostCredential = boostCredential ? await learnCard.invoke.verifyCredential(boostCredential) : verificationCheck;
|
|
19765
|
+
const boostCredentialErrors = boostCredential ? verifyBoostCredential.errors ?? [] : [];
|
|
19766
|
+
if (boostCredential && verifyBoostCredential.status?.length) {
|
|
19454
19767
|
verificationCheck.status = [
|
|
19455
19768
|
...verificationCheck.status ?? [],
|
|
19456
19769
|
...verifyBoostCredential.status
|
|
19457
19770
|
];
|
|
19458
19771
|
}
|
|
19459
|
-
if (!
|
|
19772
|
+
if (!boostId) {
|
|
19460
19773
|
verificationCheck.warnings.push(
|
|
19461
19774
|
"Boost Authenticity could not be verified: Boost ID metadata is missing."
|
|
19462
19775
|
);
|
|
@@ -19474,21 +19787,26 @@ var getVerifyBoostPlugin = /* @__PURE__ */ __name(async (learnCard, trustedBoost
|
|
|
19474
19787
|
...verificationCheck.errors || [],
|
|
19475
19788
|
"Boost Credential could not be verified."
|
|
19476
19789
|
];
|
|
19477
|
-
} else if (
|
|
19790
|
+
} else if (hasOuterVerificationErrors) {
|
|
19791
|
+
verificationCheck.warnings.push(
|
|
19792
|
+
"Boost Authenticity could not be verified: Credential verification failed."
|
|
19793
|
+
);
|
|
19794
|
+
} else if (!boostId) {
|
|
19795
|
+
} else if (boostCredential && boostCredential.boostId !== credential.boostId) {
|
|
19478
19796
|
verificationCheck.errors.push(
|
|
19479
19797
|
"Boost Authenticity could not be verified: Boost ID metadata is mismatched."
|
|
19480
19798
|
);
|
|
19481
19799
|
} else {
|
|
19482
|
-
const trustedBoostIssuer = getTrustedBoostVerifier(credential?.issuer);
|
|
19800
|
+
const trustedBoostIssuer = boostCredential ? getTrustedBoostVerifier(credential?.issuer) : getTrustedBoostNetwork(boostId);
|
|
19483
19801
|
if (trustedBoostIssuer) {
|
|
19484
19802
|
verificationCheck.checks.push(
|
|
19485
19803
|
`Boost is Authentic. Verified by ${trustedBoostIssuer.id}.`
|
|
19486
19804
|
);
|
|
19487
19805
|
} else {
|
|
19488
19806
|
verificationCheck.warnings.push(
|
|
19489
|
-
`Boost Authenticity could not be verified. Issuer is outside of trust network: ${getIssuerDID(
|
|
19807
|
+
boostCredential ? `Boost Authenticity could not be verified. Issuer is outside of trust network: ${getIssuerDID(
|
|
19490
19808
|
credential?.issuer
|
|
19491
|
-
)}`
|
|
19809
|
+
)}` : `Boost Authenticity could not be verified. Boost ID does not identify a trusted network: ${boostId}`
|
|
19492
19810
|
);
|
|
19493
19811
|
}
|
|
19494
19812
|
}
|