@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
package/dist/lcn-plugin.esm.js
CHANGED
|
@@ -15105,14 +15105,22 @@ var UnsignedVCValidator = external_exports.object({
|
|
|
15105
15105
|
}).catchall(external_exports.any());
|
|
15106
15106
|
var ProofValidator = external_exports.object({
|
|
15107
15107
|
type: external_exports.string(),
|
|
15108
|
-
created: external_exports.string(),
|
|
15108
|
+
created: external_exports.string().optional(),
|
|
15109
15109
|
challenge: external_exports.string().optional(),
|
|
15110
15110
|
domain: external_exports.string().optional(),
|
|
15111
15111
|
nonce: external_exports.string().optional(),
|
|
15112
15112
|
proofPurpose: external_exports.string(),
|
|
15113
15113
|
verificationMethod: external_exports.string(),
|
|
15114
15114
|
jws: external_exports.string().optional()
|
|
15115
|
-
}).catchall(external_exports.any())
|
|
15115
|
+
}).catchall(external_exports.any()).superRefine((proof, ctx) => {
|
|
15116
|
+
if (proof.created === void 0 && (proof.type !== "DataIntegrityProof" || proof.cryptosuite !== "ecdsa-rdfc-2019")) {
|
|
15117
|
+
ctx.addIssue({
|
|
15118
|
+
code: "custom",
|
|
15119
|
+
path: ["created"],
|
|
15120
|
+
message: "created is required for this proof suite"
|
|
15121
|
+
});
|
|
15122
|
+
}
|
|
15123
|
+
});
|
|
15116
15124
|
var VCValidator = UnsignedVCValidator.extend({
|
|
15117
15125
|
proof: ProofValidator.or(ProofValidator.array())
|
|
15118
15126
|
});
|
|
@@ -15873,7 +15881,10 @@ var SendOptionsValidator = external_exports.object({
|
|
|
15873
15881
|
webhookUrl: external_exports.string().url().optional().describe("Webhook URL to receive claim notifications"),
|
|
15874
15882
|
suppressDelivery: external_exports.boolean().optional().describe("If true, returns claimUrl without sending email/SMS"),
|
|
15875
15883
|
branding: SendBrandingOptionsValidator.optional().describe("Branding for email/SMS delivery"),
|
|
15876
|
-
guardianEmail: external_exports.string().email().optional().describe("Guardian email that must approve before student can claim")
|
|
15884
|
+
guardianEmail: external_exports.string().email().optional().describe("Guardian email that must approve before student can claim"),
|
|
15885
|
+
expiresInDays: external_exports.number().int().min(1).max(720).optional().describe(
|
|
15886
|
+
"How many days the credential stays claimable in the Universal Inbox (default 30). Does not change the credential validity period."
|
|
15887
|
+
)
|
|
15877
15888
|
});
|
|
15878
15889
|
var SendBoostInputValidator = external_exports.object({
|
|
15879
15890
|
type: external_exports.literal("boost"),
|
|
@@ -15994,15 +16005,6 @@ var ConsentFlowContractDataValidator = external_exports.object({
|
|
|
15994
16005
|
var PaginatedConsentFlowDataValidator = PaginationResponseValidator.extend({
|
|
15995
16006
|
records: ConsentFlowContractDataValidator.array()
|
|
15996
16007
|
});
|
|
15997
|
-
var ConsentFlowContractDataForDidValidator = external_exports.object({
|
|
15998
|
-
credentials: external_exports.object({ category: external_exports.string(), uri: external_exports.string() }).array(),
|
|
15999
|
-
personal: external_exports.record(external_exports.string(), external_exports.string()).default({}),
|
|
16000
|
-
date: external_exports.string(),
|
|
16001
|
-
contractUri: external_exports.string()
|
|
16002
|
-
});
|
|
16003
|
-
var PaginatedConsentFlowDataForDidValidator = PaginationResponseValidator.extend({
|
|
16004
|
-
records: ConsentFlowContractDataForDidValidator.array()
|
|
16005
|
-
});
|
|
16006
16008
|
var ConsentFlowTermValidator = external_exports.object({
|
|
16007
16009
|
sharing: external_exports.boolean().optional(),
|
|
16008
16010
|
shared: external_exports.string().array().optional(),
|
|
@@ -16036,6 +16038,34 @@ var PaginatedConsentFlowTermsValidator = PaginationResponseValidator.extend({
|
|
|
16036
16038
|
status: ConsentFlowTermsStatusValidator
|
|
16037
16039
|
}).array()
|
|
16038
16040
|
});
|
|
16041
|
+
var ConsentFlowGuardianApprovalValidator = external_exports.object({
|
|
16042
|
+
guardianProfileId: external_exports.string(),
|
|
16043
|
+
guardianDid: external_exports.string(),
|
|
16044
|
+
approvedAt: external_exports.string().datetime(),
|
|
16045
|
+
contractUpdatedAt: external_exports.string()
|
|
16046
|
+
});
|
|
16047
|
+
var ConsentFlowContractDataForDidValidator = external_exports.object({
|
|
16048
|
+
credentials: external_exports.object({ category: external_exports.string(), uri: external_exports.string() }).array(),
|
|
16049
|
+
personal: external_exports.record(external_exports.string(), external_exports.string()).default({}),
|
|
16050
|
+
date: external_exports.string(),
|
|
16051
|
+
createdAt: external_exports.string().optional(),
|
|
16052
|
+
contractUpdatedAt: external_exports.string(),
|
|
16053
|
+
contractExpiresAt: external_exports.string().optional(),
|
|
16054
|
+
reasonForAccessing: external_exports.string().optional(),
|
|
16055
|
+
guardian: external_exports.object({
|
|
16056
|
+
required: external_exports.boolean(),
|
|
16057
|
+
approved: external_exports.boolean(),
|
|
16058
|
+
approval: ConsentFlowGuardianApprovalValidator.optional()
|
|
16059
|
+
}),
|
|
16060
|
+
contractUri: external_exports.string(),
|
|
16061
|
+
termsUri: external_exports.string(),
|
|
16062
|
+
status: ConsentFlowTermsStatusValidator,
|
|
16063
|
+
expiresAt: external_exports.string().optional(),
|
|
16064
|
+
terms: ConsentFlowTermsValidator
|
|
16065
|
+
});
|
|
16066
|
+
var PaginatedConsentFlowDataForDidValidator = PaginationResponseValidator.extend({
|
|
16067
|
+
records: ConsentFlowContractDataForDidValidator.array()
|
|
16068
|
+
});
|
|
16039
16069
|
var ConsentFlowContractQueryValidator = external_exports.object({
|
|
16040
16070
|
read: external_exports.object({
|
|
16041
16071
|
anonymize: external_exports.boolean().optional(),
|
|
@@ -16096,6 +16126,7 @@ var ConsentFlowTransactionValidator = external_exports.object({
|
|
|
16096
16126
|
expiresAt: external_exports.string().optional(),
|
|
16097
16127
|
oneTime: external_exports.boolean().optional(),
|
|
16098
16128
|
terms: ConsentFlowTermsValidator.optional(),
|
|
16129
|
+
guardianApproval: ConsentFlowGuardianApprovalValidator.optional(),
|
|
16099
16130
|
id: external_exports.string(),
|
|
16100
16131
|
action: ConsentFlowTransactionActionValidator,
|
|
16101
16132
|
date: external_exports.string(),
|
|
@@ -16168,7 +16199,8 @@ var LCNNotificationTypeEnumValidator = external_exports.enum([
|
|
|
16168
16199
|
"APP_NOTIFICATION",
|
|
16169
16200
|
"CREDENTIAL_REVOKED",
|
|
16170
16201
|
"CREDENTIAL_SUSPENDED",
|
|
16171
|
-
"CREDENTIAL_UNSUSPENDED"
|
|
16202
|
+
"CREDENTIAL_UNSUSPENDED",
|
|
16203
|
+
"CREDENTIAL_REFRESHED"
|
|
16172
16204
|
]);
|
|
16173
16205
|
var LCNNotificationMessageValidator = external_exports.object({
|
|
16174
16206
|
title: external_exports.string().optional(),
|
|
@@ -16300,12 +16332,16 @@ var CreateContactMethodSessionResponseValidator = external_exports.object({
|
|
|
16300
16332
|
});
|
|
16301
16333
|
var InboxCredentialValidator = external_exports.object({
|
|
16302
16334
|
id: external_exports.string(),
|
|
16303
|
-
credential: external_exports.string(),
|
|
16335
|
+
credential: external_exports.string().optional(),
|
|
16304
16336
|
isSigned: external_exports.boolean(),
|
|
16305
16337
|
currentStatus: LCNInboxStatusEnumValidator,
|
|
16306
16338
|
isAccepted: external_exports.boolean().optional(),
|
|
16307
16339
|
expiresAt: external_exports.string(),
|
|
16308
16340
|
createdAt: external_exports.string(),
|
|
16341
|
+
finalizedAt: external_exports.string().optional(),
|
|
16342
|
+
expiredAt: external_exports.string().optional(),
|
|
16343
|
+
credentialName: external_exports.string().optional(),
|
|
16344
|
+
achievementType: external_exports.string().optional(),
|
|
16309
16345
|
issuerDid: external_exports.string(),
|
|
16310
16346
|
webhookUrl: external_exports.string().optional(),
|
|
16311
16347
|
boostUri: external_exports.string().optional(),
|
|
@@ -16359,7 +16395,9 @@ var IssueInboxCredentialValidator = external_exports.object({
|
|
|
16359
16395
|
"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."
|
|
16360
16396
|
),
|
|
16361
16397
|
webhookUrl: external_exports.string().url().optional().describe("The webhook URL to receive credential issuance events."),
|
|
16362
|
-
expiresInDays: external_exports.number().min(1).max(
|
|
16398
|
+
expiresInDays: external_exports.number().int().min(1).max(720).optional().describe(
|
|
16399
|
+
"How many days the encrypted inbox payload remains claimable. This does not change the credential validity period."
|
|
16400
|
+
),
|
|
16363
16401
|
templateData: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe(
|
|
16364
16402
|
"Template data to render into the boost credential template using Mustache syntax. Only used when boostUri is provided."
|
|
16365
16403
|
),
|
|
@@ -16422,6 +16460,9 @@ var ClaimInboxCredentialValidator = external_exports.object({
|
|
|
16422
16460
|
credential: VCValidator.or(VPValidator).or(UnsignedVCValidator).or(CredentialNameRefValidator).describe("The credential to issue, or a { name } reference to resolve a boost template."),
|
|
16423
16461
|
configuration: external_exports.object({
|
|
16424
16462
|
publishableKey: external_exports.string(),
|
|
16463
|
+
expiresInDays: external_exports.number().int().min(1).max(720).optional().describe(
|
|
16464
|
+
"Inbox claim window in days. Defaults to 720; use a shorter window for sensitive records."
|
|
16465
|
+
),
|
|
16425
16466
|
signingAuthorityName: external_exports.string().optional(),
|
|
16426
16467
|
listingId: external_exports.string().optional(),
|
|
16427
16468
|
listingSlug: external_exports.string().optional()
|
|
@@ -17048,6 +17089,191 @@ var inAppMessagesFlagValidator = external_exports.object({
|
|
|
17048
17089
|
version: external_exports.number().default(1),
|
|
17049
17090
|
messages: external_exports.array(inAppMessageValidator).default([])
|
|
17050
17091
|
}).passthrough();
|
|
17092
|
+
var LearnCardRefreshAuthorizationValidator = external_exports.object({ type: external_exports.literal("LearnCardDIDAuth") }).catchall(external_exports.any());
|
|
17093
|
+
var ManagedCredentialRefreshServiceValidator = external_exports.object({
|
|
17094
|
+
id: external_exports.string().min(1),
|
|
17095
|
+
type: external_exports.literal("LearnCardCredentialRefresh2026"),
|
|
17096
|
+
authorization: LearnCardRefreshAuthorizationValidator.optional()
|
|
17097
|
+
}).catchall(external_exports.any());
|
|
17098
|
+
var StandardCredentialRefreshServiceValidator = external_exports.object({
|
|
17099
|
+
id: external_exports.string().min(1),
|
|
17100
|
+
type: external_exports.literal("1EdTechCredentialRefresh")
|
|
17101
|
+
}).catchall(external_exports.any());
|
|
17102
|
+
var SupportedCredentialRefreshServiceValidator = external_exports.union([
|
|
17103
|
+
ManagedCredentialRefreshServiceValidator,
|
|
17104
|
+
StandardCredentialRefreshServiceValidator
|
|
17105
|
+
]);
|
|
17106
|
+
var AllocateCredentialRefreshInputValidator = external_exports.object({
|
|
17107
|
+
holder: external_exports.object({
|
|
17108
|
+
profileId: external_exports.string().optional(),
|
|
17109
|
+
did: external_exports.string().min(1)
|
|
17110
|
+
}),
|
|
17111
|
+
credentialId: external_exports.string().min(1)
|
|
17112
|
+
});
|
|
17113
|
+
var AllocateCredentialRefreshResultValidator = external_exports.object({
|
|
17114
|
+
refreshId: external_exports.string().min(1),
|
|
17115
|
+
refreshService: ManagedCredentialRefreshServiceValidator.extend({
|
|
17116
|
+
authorization: LearnCardRefreshAuthorizationValidator
|
|
17117
|
+
})
|
|
17118
|
+
});
|
|
17119
|
+
var CredentialRefreshSigningModeValidator = external_exports.enum(["issuer-signed", "signing-authority"]);
|
|
17120
|
+
var PublishCredentialRefreshBaseFields = {
|
|
17121
|
+
refreshId: external_exports.string().min(1),
|
|
17122
|
+
notifyHolder: external_exports.boolean().optional(),
|
|
17123
|
+
updateSummary: external_exports.string().optional(),
|
|
17124
|
+
idempotencyKey: external_exports.string().optional()
|
|
17125
|
+
};
|
|
17126
|
+
var PublishIssuerSignedRefreshValidator = external_exports.object({
|
|
17127
|
+
...PublishCredentialRefreshBaseFields,
|
|
17128
|
+
mode: external_exports.literal("issuer-signed"),
|
|
17129
|
+
signedCredential: VCValidator
|
|
17130
|
+
});
|
|
17131
|
+
var PublishSigningAuthorityRefreshValidator = external_exports.object({
|
|
17132
|
+
...PublishCredentialRefreshBaseFields,
|
|
17133
|
+
mode: external_exports.literal("signing-authority"),
|
|
17134
|
+
credential: UnsignedVCValidator,
|
|
17135
|
+
signingAuthority: external_exports.object({
|
|
17136
|
+
type: external_exports.string().min(1)
|
|
17137
|
+
}).catchall(external_exports.any())
|
|
17138
|
+
});
|
|
17139
|
+
var PublishCredentialRefreshInputValidator = external_exports.object({
|
|
17140
|
+
...PublishCredentialRefreshBaseFields,
|
|
17141
|
+
mode: CredentialRefreshSigningModeValidator,
|
|
17142
|
+
signedCredential: VCValidator.optional(),
|
|
17143
|
+
credential: UnsignedVCValidator.optional(),
|
|
17144
|
+
signingAuthority: external_exports.object({
|
|
17145
|
+
type: external_exports.string().min(1)
|
|
17146
|
+
}).catchall(external_exports.any()).optional()
|
|
17147
|
+
}).superRefine((input, ctx) => {
|
|
17148
|
+
if (input.mode === "issuer-signed" && !input.signedCredential) {
|
|
17149
|
+
ctx.addIssue({
|
|
17150
|
+
code: "custom",
|
|
17151
|
+
path: ["signedCredential"],
|
|
17152
|
+
message: "signedCredential is required for issuer-signed publication"
|
|
17153
|
+
});
|
|
17154
|
+
}
|
|
17155
|
+
if (input.mode === "issuer-signed" && (input.credential !== void 0 || input.signingAuthority !== void 0)) {
|
|
17156
|
+
ctx.addIssue({
|
|
17157
|
+
code: "custom",
|
|
17158
|
+
path: ["mode"],
|
|
17159
|
+
message: "issuer-signed publication cannot include signing-authority fields"
|
|
17160
|
+
});
|
|
17161
|
+
}
|
|
17162
|
+
if (input.mode === "signing-authority") {
|
|
17163
|
+
if (input.signedCredential !== void 0) {
|
|
17164
|
+
ctx.addIssue({
|
|
17165
|
+
code: "custom",
|
|
17166
|
+
path: ["signedCredential"],
|
|
17167
|
+
message: "signing-authority publication cannot include signedCredential"
|
|
17168
|
+
});
|
|
17169
|
+
}
|
|
17170
|
+
if (!input.credential) {
|
|
17171
|
+
ctx.addIssue({
|
|
17172
|
+
code: "custom",
|
|
17173
|
+
path: ["credential"],
|
|
17174
|
+
message: "credential is required for signing-authority publication"
|
|
17175
|
+
});
|
|
17176
|
+
}
|
|
17177
|
+
if (!input.signingAuthority) {
|
|
17178
|
+
ctx.addIssue({
|
|
17179
|
+
code: "custom",
|
|
17180
|
+
path: ["signingAuthority"],
|
|
17181
|
+
message: "signingAuthority is required for signing-authority publication"
|
|
17182
|
+
});
|
|
17183
|
+
}
|
|
17184
|
+
}
|
|
17185
|
+
});
|
|
17186
|
+
var PublishCredentialRefreshNotificationValidator = external_exports.enum([
|
|
17187
|
+
"queued",
|
|
17188
|
+
"suppressed",
|
|
17189
|
+
"not-applicable",
|
|
17190
|
+
/** Publication succeeded, but the post-commit notification enqueue must be retried. */
|
|
17191
|
+
"delivery-failed"
|
|
17192
|
+
]);
|
|
17193
|
+
var PublishCredentialRefreshResultValidator = external_exports.object({
|
|
17194
|
+
refreshId: external_exports.string().min(1),
|
|
17195
|
+
version: external_exports.number().int().positive(),
|
|
17196
|
+
publishedAt: external_exports.string().min(1),
|
|
17197
|
+
notification: PublishCredentialRefreshNotificationValidator
|
|
17198
|
+
});
|
|
17199
|
+
var CredentialRefreshVersionMetadataValidator = external_exports.object({
|
|
17200
|
+
version: external_exports.number().int().positive(),
|
|
17201
|
+
publishedAt: external_exports.string().min(1),
|
|
17202
|
+
effectiveAt: external_exports.string().optional(),
|
|
17203
|
+
etag: external_exports.string().optional(),
|
|
17204
|
+
signingMode: CredentialRefreshSigningModeValidator.optional(),
|
|
17205
|
+
updateSummary: external_exports.string().optional()
|
|
17206
|
+
});
|
|
17207
|
+
var GetCredentialRefreshHistoryInputValidator = external_exports.object({
|
|
17208
|
+
refreshId: external_exports.string().min(1),
|
|
17209
|
+
cursor: external_exports.string().optional(),
|
|
17210
|
+
limit: external_exports.number().int().positive().optional()
|
|
17211
|
+
});
|
|
17212
|
+
var GetCredentialRefreshHistoryResultValidator = external_exports.object({
|
|
17213
|
+
records: CredentialRefreshVersionMetadataValidator.array(),
|
|
17214
|
+
hasMore: external_exports.boolean(),
|
|
17215
|
+
cursor: external_exports.string().optional()
|
|
17216
|
+
});
|
|
17217
|
+
var CredentialRefreshChallengeValidator = external_exports.object({
|
|
17218
|
+
challenge: external_exports.string().min(1),
|
|
17219
|
+
expiresAt: external_exports.string().min(1),
|
|
17220
|
+
domain: external_exports.string().optional(),
|
|
17221
|
+
scheme: external_exports.literal("LearnCardDIDAuth").optional()
|
|
17222
|
+
});
|
|
17223
|
+
var PublicCredentialRefreshEnvelopeValidator = external_exports.object({
|
|
17224
|
+
format: external_exports.literal("vc"),
|
|
17225
|
+
credential: VCValidator,
|
|
17226
|
+
etag: external_exports.string().optional()
|
|
17227
|
+
});
|
|
17228
|
+
var JweCredentialRefreshEnvelopeValidator = external_exports.object({
|
|
17229
|
+
format: external_exports.literal("jwe"),
|
|
17230
|
+
jwe: JWEValidator,
|
|
17231
|
+
etag: external_exports.string().optional(),
|
|
17232
|
+
/** Present on LearnCard-managed endpoints; optional for interoperable JWE services. */
|
|
17233
|
+
version: external_exports.number().int().positive().optional()
|
|
17234
|
+
});
|
|
17235
|
+
var CredentialRefreshResponseEnvelopeValidator = external_exports.discriminatedUnion("format", [
|
|
17236
|
+
PublicCredentialRefreshEnvelopeValidator,
|
|
17237
|
+
JweCredentialRefreshEnvelopeValidator
|
|
17238
|
+
]);
|
|
17239
|
+
var CredentialRefreshFailureCodeValidator = external_exports.enum([
|
|
17240
|
+
"UNAVAILABLE",
|
|
17241
|
+
"TIMEOUT",
|
|
17242
|
+
"UNSUPPORTED_SERVICE",
|
|
17243
|
+
"UNAUTHORIZED",
|
|
17244
|
+
"MALFORMED_RESPONSE",
|
|
17245
|
+
"INVALID_PROOF",
|
|
17246
|
+
"ISSUER_MISMATCH",
|
|
17247
|
+
"ID_MISMATCH",
|
|
17248
|
+
"ROLLBACK",
|
|
17249
|
+
"REVOKED",
|
|
17250
|
+
"UNSAFE_ENDPOINT"
|
|
17251
|
+
]);
|
|
17252
|
+
var CredentialRefreshUpdatedResultValidator = external_exports.object({
|
|
17253
|
+
status: external_exports.literal("updated"),
|
|
17254
|
+
credential: VCValidator,
|
|
17255
|
+
etag: external_exports.string().optional(),
|
|
17256
|
+
managedVersion: external_exports.number().int().positive().optional()
|
|
17257
|
+
});
|
|
17258
|
+
var CredentialRefreshUnchangedResultValidator = external_exports.object({
|
|
17259
|
+
status: external_exports.literal("unchanged"),
|
|
17260
|
+
checkedAt: external_exports.string().min(1),
|
|
17261
|
+
etag: external_exports.string().optional()
|
|
17262
|
+
});
|
|
17263
|
+
var CredentialRefreshUnsupportedResultValidator = external_exports.object({
|
|
17264
|
+
status: external_exports.literal("unsupported")
|
|
17265
|
+
});
|
|
17266
|
+
var CredentialRefreshFailedResultValidator = external_exports.object({
|
|
17267
|
+
status: external_exports.literal("failed"),
|
|
17268
|
+
code: CredentialRefreshFailureCodeValidator,
|
|
17269
|
+
retryable: external_exports.boolean()
|
|
17270
|
+
});
|
|
17271
|
+
var CredentialRefreshResultValidator = external_exports.discriminatedUnion("status", [
|
|
17272
|
+
CredentialRefreshUpdatedResultValidator,
|
|
17273
|
+
CredentialRefreshUnchangedResultValidator,
|
|
17274
|
+
CredentialRefreshUnsupportedResultValidator,
|
|
17275
|
+
CredentialRefreshFailedResultValidator
|
|
17276
|
+
]);
|
|
17051
17277
|
|
|
17052
17278
|
// src/plugin.ts
|
|
17053
17279
|
import {
|
|
@@ -17669,6 +17895,27 @@ var issueCredentialWithNetworkStatus = /* @__PURE__ */ __name(async (learnCard,
|
|
|
17669
17895
|
await appendNetworkCredentialStatus(client, credential, statusPurposes)
|
|
17670
17896
|
);
|
|
17671
17897
|
}, "issueCredentialWithNetworkStatus");
|
|
17898
|
+
var MANAGED_REFRESH_SERVICE_CONTEXT = {
|
|
17899
|
+
"LearnCardCredentialRefresh2026": "https://learncard.com/refresh#LearnCardCredentialRefresh2026",
|
|
17900
|
+
authorization: {
|
|
17901
|
+
"@id": "https://purl.imsglobal.org/spec/ob/v3p0#authorization",
|
|
17902
|
+
"@context": {
|
|
17903
|
+
LearnCardDIDAuth: "https://docs.learncard.com/definitions#LearnCardDIDAuth"
|
|
17904
|
+
}
|
|
17905
|
+
}
|
|
17906
|
+
};
|
|
17907
|
+
var injectManagedRefreshService = /* @__PURE__ */ __name((credential, refreshService) => {
|
|
17908
|
+
const existingContext = credential["@context"];
|
|
17909
|
+
const contextList = Array.isArray(existingContext) ? existingContext : [existingContext];
|
|
17910
|
+
const hasMapping = contextList.some(
|
|
17911
|
+
(entry) => !!entry && typeof entry === "object" && "LearnCardCredentialRefresh2026" in entry
|
|
17912
|
+
);
|
|
17913
|
+
return {
|
|
17914
|
+
...credential,
|
|
17915
|
+
"@context": hasMapping ? contextList : [...contextList, MANAGED_REFRESH_SERVICE_CONTEXT],
|
|
17916
|
+
refreshService
|
|
17917
|
+
};
|
|
17918
|
+
}, "injectManagedRefreshService");
|
|
17672
17919
|
async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, options) {
|
|
17673
17920
|
const apiToken = typeof apiTokenOrOptions === "string" ? apiTokenOrOptions : void 0;
|
|
17674
17921
|
const resolvedOptions = (typeof apiTokenOrOptions === "object" ? apiTokenOrOptions : options) ?? {};
|
|
@@ -18430,6 +18677,27 @@ async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, opt
|
|
|
18430
18677
|
await ensureUser();
|
|
18431
18678
|
return client.boost.allocateCredentialStatus.mutate(options2);
|
|
18432
18679
|
}, "allocateCredentialStatus"),
|
|
18680
|
+
allocateCredentialRefresh: /* @__PURE__ */ __name(async (_learnCard, input) => {
|
|
18681
|
+
await ensureUser();
|
|
18682
|
+
return client.credentialRefresh.allocateCredentialRefresh.mutate(input);
|
|
18683
|
+
}, "allocateCredentialRefresh"),
|
|
18684
|
+
sendRefreshableCredential: /* @__PURE__ */ __name(async (_learnCard, refreshId, credential, boostUri, skipNotification) => {
|
|
18685
|
+
await ensureUser();
|
|
18686
|
+
return client.credentialRefresh.sendRefreshableCredential.mutate({
|
|
18687
|
+
refreshId,
|
|
18688
|
+
credential,
|
|
18689
|
+
boostUri,
|
|
18690
|
+
...skipNotification ? { skipNotification: true } : {}
|
|
18691
|
+
});
|
|
18692
|
+
}, "sendRefreshableCredential"),
|
|
18693
|
+
publishCredentialRefresh: /* @__PURE__ */ __name(async (_learnCard, input) => {
|
|
18694
|
+
await ensureUser();
|
|
18695
|
+
return client.credentialRefresh.publishCredentialRefresh.mutate(input);
|
|
18696
|
+
}, "publishCredentialRefresh"),
|
|
18697
|
+
getCredentialRefreshHistory: /* @__PURE__ */ __name(async (_learnCard, input) => {
|
|
18698
|
+
await ensureUser();
|
|
18699
|
+
return client.credentialRefresh.getCredentialRefreshHistory.query(input);
|
|
18700
|
+
}, "getCredentialRefreshHistory"),
|
|
18433
18701
|
revokeBoostRecipient: /* @__PURE__ */ __name(async (_learnCard, boostUri, recipientProfileId, credentialUri) => {
|
|
18434
18702
|
await ensureUser();
|
|
18435
18703
|
const input = { boostUri, recipientProfileId };
|
|
@@ -18496,6 +18764,17 @@ async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, opt
|
|
|
18496
18764
|
if (typeof options2 === "object" && options2.overideFn) {
|
|
18497
18765
|
boost = options2.overideFn(boost);
|
|
18498
18766
|
}
|
|
18767
|
+
const enableRefresh = typeof options2 === "object" && options2.enableRefresh === true;
|
|
18768
|
+
let managedRefreshId;
|
|
18769
|
+
if (enableRefresh) {
|
|
18770
|
+
if (!boost.id) boost.id = `urn:uuid:${crypto.randomUUID()}`;
|
|
18771
|
+
const allocation = await client.credentialRefresh.allocateCredentialRefresh.mutate({
|
|
18772
|
+
holder: { profileId, did: targetProfile.did },
|
|
18773
|
+
credentialId: boost.id
|
|
18774
|
+
});
|
|
18775
|
+
managedRefreshId = allocation.refreshId;
|
|
18776
|
+
boost = injectManagedRefreshService(boost, allocation.refreshService);
|
|
18777
|
+
}
|
|
18499
18778
|
const statusPurposes = typeof options2 === "object" ? options2.statusPurposes : void 0;
|
|
18500
18779
|
const vc = await issueCredentialWithNetworkStatus(
|
|
18501
18780
|
_learnCard,
|
|
@@ -18503,6 +18782,14 @@ async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, opt
|
|
|
18503
18782
|
boost,
|
|
18504
18783
|
statusPurposes
|
|
18505
18784
|
);
|
|
18785
|
+
if (managedRefreshId) {
|
|
18786
|
+
return client.credentialRefresh.sendRefreshableCredential.mutate({
|
|
18787
|
+
refreshId: managedRefreshId,
|
|
18788
|
+
credential: vc,
|
|
18789
|
+
boostUri,
|
|
18790
|
+
...typeof options2 === "object" && options2.skipNotification ? { skipNotification: true } : {}
|
|
18791
|
+
});
|
|
18792
|
+
}
|
|
18506
18793
|
if (typeof options2 === "object" && !options2.encrypt || !options2) {
|
|
18507
18794
|
return client.boost.sendBoost.mutate({
|
|
18508
18795
|
profileId,
|
|
@@ -18985,6 +19272,23 @@ async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, opt
|
|
|
18985
19272
|
await ensureUser();
|
|
18986
19273
|
return client.inbox.finalize.mutate();
|
|
18987
19274
|
}, "finalizeInboxCredentials"),
|
|
19275
|
+
recoverInboxCredentials: /* @__PURE__ */ __name(async (learnCard2, options2 = {}) => {
|
|
19276
|
+
const result = await client.inbox.getMyInboxDeliveries.query(options2);
|
|
19277
|
+
const results = await Promise.allSettled(
|
|
19278
|
+
result.records.map(async (record2) => ({
|
|
19279
|
+
...record2,
|
|
19280
|
+
credential: VCValidator.parse(
|
|
19281
|
+
await learnCard2.invoke.decryptDagJwe(record2.credential, [
|
|
19282
|
+
learnCard2.id.keypair()
|
|
19283
|
+
])
|
|
19284
|
+
)
|
|
19285
|
+
}))
|
|
19286
|
+
);
|
|
19287
|
+
const records = results.flatMap(
|
|
19288
|
+
(record2) => record2.status === "fulfilled" ? [record2.value] : []
|
|
19289
|
+
);
|
|
19290
|
+
return { ...result, records, failed: results.length - records.length };
|
|
19291
|
+
}, "recoverInboxCredentials"),
|
|
18988
19292
|
sendGuardianApprovalEmail: /* @__PURE__ */ __name(async (_learnCard, options2) => {
|
|
18989
19293
|
await ensureUser();
|
|
18990
19294
|
return client.inbox.sendGuardianApprovalEmail.mutate(options2);
|
|
@@ -19418,6 +19722,13 @@ var getVerifyBoostPlugin = /* @__PURE__ */ __name(async (learnCard, trustedBoost
|
|
|
19418
19722
|
if (!issuerDID) return;
|
|
19419
19723
|
return boostRegistry.find((o) => o.did === issuerDID);
|
|
19420
19724
|
}, "getTrustedBoostVerifier");
|
|
19725
|
+
const getTrustedBoostNetwork = /* @__PURE__ */ __name((boostId) => {
|
|
19726
|
+
if (typeof boostId !== "string") return;
|
|
19727
|
+
const match = /^lc:network:([^?#\s]+)\/(?:trpc:)?boost:([^/?#\s]+)$/.exec(boostId);
|
|
19728
|
+
if (!match) return;
|
|
19729
|
+
const networkDid = `did:web:${match[1].replace(/\//g, ":")}`;
|
|
19730
|
+
return boostRegistry.find((entry) => entry.did === networkDid);
|
|
19731
|
+
}, "getTrustedBoostNetwork");
|
|
19421
19732
|
return {
|
|
19422
19733
|
name: "VerifyBoost",
|
|
19423
19734
|
displayName: "Verify Boost Extension",
|
|
@@ -19428,18 +19739,20 @@ var getVerifyBoostPlugin = /* @__PURE__ */ __name(async (learnCard, trustedBoost
|
|
|
19428
19739
|
credential,
|
|
19429
19740
|
options
|
|
19430
19741
|
);
|
|
19742
|
+
const hasOuterVerificationErrors = Boolean(verificationCheck.errors?.length);
|
|
19431
19743
|
const boostCredential = credential?.boostCredential;
|
|
19432
19744
|
try {
|
|
19433
|
-
|
|
19434
|
-
|
|
19435
|
-
const
|
|
19436
|
-
|
|
19745
|
+
const boostId = boostCredential?.boostId ?? credential?.boostId;
|
|
19746
|
+
if (boostCredential || credential?.boostId || credential?.type?.includes("BoostCredential")) {
|
|
19747
|
+
const verifyBoostCredential = boostCredential ? await learnCard.invoke.verifyCredential(boostCredential) : verificationCheck;
|
|
19748
|
+
const boostCredentialErrors = boostCredential ? verifyBoostCredential.errors ?? [] : [];
|
|
19749
|
+
if (boostCredential && verifyBoostCredential.status?.length) {
|
|
19437
19750
|
verificationCheck.status = [
|
|
19438
19751
|
...verificationCheck.status ?? [],
|
|
19439
19752
|
...verifyBoostCredential.status
|
|
19440
19753
|
];
|
|
19441
19754
|
}
|
|
19442
|
-
if (!
|
|
19755
|
+
if (!boostId) {
|
|
19443
19756
|
verificationCheck.warnings.push(
|
|
19444
19757
|
"Boost Authenticity could not be verified: Boost ID metadata is missing."
|
|
19445
19758
|
);
|
|
@@ -19457,21 +19770,26 @@ var getVerifyBoostPlugin = /* @__PURE__ */ __name(async (learnCard, trustedBoost
|
|
|
19457
19770
|
...verificationCheck.errors || [],
|
|
19458
19771
|
"Boost Credential could not be verified."
|
|
19459
19772
|
];
|
|
19460
|
-
} else if (
|
|
19773
|
+
} else if (hasOuterVerificationErrors) {
|
|
19774
|
+
verificationCheck.warnings.push(
|
|
19775
|
+
"Boost Authenticity could not be verified: Credential verification failed."
|
|
19776
|
+
);
|
|
19777
|
+
} else if (!boostId) {
|
|
19778
|
+
} else if (boostCredential && boostCredential.boostId !== credential.boostId) {
|
|
19461
19779
|
verificationCheck.errors.push(
|
|
19462
19780
|
"Boost Authenticity could not be verified: Boost ID metadata is mismatched."
|
|
19463
19781
|
);
|
|
19464
19782
|
} else {
|
|
19465
|
-
const trustedBoostIssuer = getTrustedBoostVerifier(credential?.issuer);
|
|
19783
|
+
const trustedBoostIssuer = boostCredential ? getTrustedBoostVerifier(credential?.issuer) : getTrustedBoostNetwork(boostId);
|
|
19466
19784
|
if (trustedBoostIssuer) {
|
|
19467
19785
|
verificationCheck.checks.push(
|
|
19468
19786
|
`Boost is Authentic. Verified by ${trustedBoostIssuer.id}.`
|
|
19469
19787
|
);
|
|
19470
19788
|
} else {
|
|
19471
19789
|
verificationCheck.warnings.push(
|
|
19472
|
-
`Boost Authenticity could not be verified. Issuer is outside of trust network: ${getIssuerDID(
|
|
19790
|
+
boostCredential ? `Boost Authenticity could not be verified. Issuer is outside of trust network: ${getIssuerDID(
|
|
19473
19791
|
credential?.issuer
|
|
19474
|
-
)}`
|
|
19792
|
+
)}` : `Boost Authenticity could not be verified. Boost ID does not identify a trusted network: ${boostId}`
|
|
19475
19793
|
);
|
|
19476
19794
|
}
|
|
19477
19795
|
}
|