@learncard/network-brain-client 2.5.36 → 2.5.37
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/CHANGELOG.md +7 -0
- package/dist/brain-client.cjs.development.js +106 -5
- package/dist/brain-client.cjs.development.js.map +2 -2
- package/dist/brain-client.cjs.production.min.js +5 -5
- package/dist/brain-client.cjs.production.min.js.map +3 -3
- package/dist/brain-client.esm.js +35 -5
- package/dist/brain-client.esm.js.map +2 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @learncard/network-brain-client
|
|
2
2
|
|
|
3
|
+
## 2.5.37
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`406f5f64ff49aaecbf8cb499a7f6b294c7105cc3`](https://github.com/learningeconomy/LearnCard/commit/406f5f64ff49aaecbf8cb499a7f6b294c7105cc3)]:
|
|
8
|
+
- @learncard/network-brain-service@3.16.0
|
|
9
|
+
|
|
3
10
|
## 2.5.36
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -177,6 +177,7 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
177
177
|
CredentialActivityStatsValidator: /* @__PURE__ */ __name2(() => CredentialActivityStatsValidator, "CredentialActivityStatsValidator"),
|
|
178
178
|
CredentialActivityValidator: /* @__PURE__ */ __name2(() => CredentialActivityValidator, "CredentialActivityValidator"),
|
|
179
179
|
CredentialActivityWithDetailsValidator: /* @__PURE__ */ __name2(() => CredentialActivityWithDetailsValidator, "CredentialActivityWithDetailsValidator"),
|
|
180
|
+
CredentialFormatValidator: /* @__PURE__ */ __name2(() => CredentialFormatValidator, "CredentialFormatValidator"),
|
|
180
181
|
CredentialInfoValidator: /* @__PURE__ */ __name2(() => CredentialInfoValidator, "CredentialInfoValidator"),
|
|
181
182
|
CredentialNameRefValidator: /* @__PURE__ */ __name2(() => CredentialNameRefValidator, "CredentialNameRefValidator"),
|
|
182
183
|
CredentialRecordValidator: /* @__PURE__ */ __name2(() => CredentialRecordValidator, "CredentialRecordValidator"),
|
|
@@ -205,6 +206,8 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
205
206
|
GetSkillPathResultValidator: /* @__PURE__ */ __name2(() => GetSkillPathResultValidator, "GetSkillPathResultValidator"),
|
|
206
207
|
GetTemplateRecipientsEventValidator: /* @__PURE__ */ __name2(() => GetTemplateRecipientsEventValidator, "GetTemplateRecipientsEventValidator"),
|
|
207
208
|
GuardianStatusValidator: /* @__PURE__ */ __name2(() => GuardianStatusValidator, "GuardianStatusValidator"),
|
|
209
|
+
HolderExportConsentRecordValidator: /* @__PURE__ */ __name2(() => HolderExportConsentRecordValidator, "HolderExportConsentRecordValidator"),
|
|
210
|
+
HolderExportMetadataValidator: /* @__PURE__ */ __name2(() => HolderExportMetadataValidator, "HolderExportMetadataValidator"),
|
|
208
211
|
IdentifierEntryValidator: /* @__PURE__ */ __name2(() => IdentifierEntryValidator, "IdentifierEntryValidator"),
|
|
209
212
|
IdentifierTypeValidator: /* @__PURE__ */ __name2(() => IdentifierTypeValidator, "IdentifierTypeValidator"),
|
|
210
213
|
IdentityObjectValidator: /* @__PURE__ */ __name2(() => IdentityObjectValidator, "IdentityObjectValidator"),
|
|
@@ -14574,6 +14577,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14574
14577
|
var ClrCredentialValidator = UnsignedClrCredentialValidator.extend({
|
|
14575
14578
|
proof: ProofValidator.or(ProofValidator.array())
|
|
14576
14579
|
});
|
|
14580
|
+
var CredentialFormatValidator = external_exports.enum([
|
|
14581
|
+
"w3c-vc-2.0",
|
|
14582
|
+
"w3c-vc-1.1",
|
|
14583
|
+
"jwt-vc-json",
|
|
14584
|
+
"dc+sd-jwt",
|
|
14585
|
+
"vc+sd-jwt",
|
|
14586
|
+
"mso_mdoc"
|
|
14587
|
+
]);
|
|
14577
14588
|
var StatusCheckEntryValidator = external_exports.object({
|
|
14578
14589
|
/**
|
|
14579
14590
|
* The `credentialStatus.type` as it appeared on the credential.
|
|
@@ -14629,7 +14640,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14629
14640
|
issuee: ProfileValidator.optional(),
|
|
14630
14641
|
credentialSubject: CredentialSubjectValidator.optional()
|
|
14631
14642
|
});
|
|
14632
|
-
var CredentialRecordValidator = external_exports.object({
|
|
14643
|
+
var CredentialRecordValidator = external_exports.object({
|
|
14644
|
+
id: external_exports.string(),
|
|
14645
|
+
uri: external_exports.string(),
|
|
14646
|
+
format: CredentialFormatValidator.optional(),
|
|
14647
|
+
semanticType: external_exports.string().optional(),
|
|
14648
|
+
rawWireForm: external_exports.string().optional()
|
|
14649
|
+
}).catchall(external_exports.any());
|
|
14633
14650
|
var PaginationOptionsValidator = external_exports.object({
|
|
14634
14651
|
limit: external_exports.number(),
|
|
14635
14652
|
cursor: external_exports.string().optional(),
|
|
@@ -15197,6 +15214,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15197
15214
|
date: external_exports.string(),
|
|
15198
15215
|
uris: external_exports.string().array().optional()
|
|
15199
15216
|
});
|
|
15217
|
+
var HolderExportConsentRecordValidator = external_exports.object({
|
|
15218
|
+
termsUri: external_exports.string(),
|
|
15219
|
+
status: ConsentFlowTermsStatusValidator,
|
|
15220
|
+
contract: ConsentFlowContractDetailsValidator,
|
|
15221
|
+
terms: ConsentFlowTermsValidator,
|
|
15222
|
+
transactions: ConsentFlowTransactionValidator.array()
|
|
15223
|
+
});
|
|
15224
|
+
var HolderExportMetadataValidator = external_exports.object({
|
|
15225
|
+
consentRecords: HolderExportConsentRecordValidator.array(),
|
|
15226
|
+
truncated: external_exports.boolean().optional(),
|
|
15227
|
+
warnings: external_exports.string().array().optional(),
|
|
15228
|
+
limits: external_exports.object({
|
|
15229
|
+
maxConsentRecords: external_exports.number(),
|
|
15230
|
+
maxTransactionsPerConsentRecord: external_exports.number()
|
|
15231
|
+
}).optional()
|
|
15232
|
+
});
|
|
15200
15233
|
var PaginatedConsentFlowTransactionsValidator = PaginationResponseValidator.extend({
|
|
15201
15234
|
records: ConsentFlowTransactionValidator.array()
|
|
15202
15235
|
});
|
|
@@ -15283,10 +15316,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15283
15316
|
var LCNNotificationValidator = external_exports.object({
|
|
15284
15317
|
type: LCNNotificationTypeEnumValidator,
|
|
15285
15318
|
to: LCNProfileValidator.partial().and(external_exports.object({ did: external_exports.string() })),
|
|
15286
|
-
from: external_exports.union([
|
|
15287
|
-
external_exports.string(),
|
|
15288
|
-
LCNProfileValidator.partial().and(external_exports.object({ did: external_exports.string() }))
|
|
15289
|
-
]),
|
|
15319
|
+
from: external_exports.union([external_exports.string(), LCNProfileValidator.partial().and(external_exports.object({ did: external_exports.string() }))]),
|
|
15290
15320
|
message: LCNNotificationMessageValidator.optional(),
|
|
15291
15321
|
data: LCNNotificationDataValidator.optional(),
|
|
15292
15322
|
sent: external_exports.iso.datetime().optional(),
|
|
@@ -16102,6 +16132,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16102
16132
|
quantizeValue: /* @__PURE__ */ __name(() => quantizeValue, "quantizeValue"),
|
|
16103
16133
|
resizeAndChangeQuality: /* @__PURE__ */ __name(() => resizeAndChangeQuality4, "resizeAndChangeQuality"),
|
|
16104
16134
|
setBitstringStatusListBit: /* @__PURE__ */ __name(() => setBitstringStatusListBit, "setBitstringStatusListBit"),
|
|
16135
|
+
toStoredCredential: /* @__PURE__ */ __name(() => toStoredCredential, "toStoredCredential"),
|
|
16105
16136
|
unwrapBoostCredential: /* @__PURE__ */ __name(() => unwrapBoostCredential, "unwrapBoostCredential")
|
|
16106
16137
|
});
|
|
16107
16138
|
module2.exports = __toCommonJS2(index_exports2);
|
|
@@ -17030,6 +17061,76 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17030
17061
|
}
|
|
17031
17062
|
return age;
|
|
17032
17063
|
}, "calculateAgeFromDob");
|
|
17064
|
+
var toStoredCredential = /* @__PURE__ */ __name2((record) => {
|
|
17065
|
+
if (record.format) {
|
|
17066
|
+
if (record.format === "dc+sd-jwt" || record.format === "vc+sd-jwt" || record.format === "jwt-vc-json" || record.format === "mso_mdoc") {
|
|
17067
|
+
const wireForm = record.rawWireForm ?? extractWireFormFromVc(record.vc);
|
|
17068
|
+
if (typeof wireForm === "string" && wireForm.length > 0) {
|
|
17069
|
+
return { format: record.format, data: wireForm };
|
|
17070
|
+
}
|
|
17071
|
+
}
|
|
17072
|
+
if (record.format === "w3c-vc-2.0" || record.format === "w3c-vc-1.1") {
|
|
17073
|
+
return { format: record.format, data: record.vc };
|
|
17074
|
+
}
|
|
17075
|
+
}
|
|
17076
|
+
const vc = record.vc;
|
|
17077
|
+
if (typeof vc === "string") {
|
|
17078
|
+
if (looksLikeSdJwtCompact(vc)) {
|
|
17079
|
+
return { format: "dc+sd-jwt", data: vc };
|
|
17080
|
+
}
|
|
17081
|
+
if (looksLikeJwsCompact(vc)) {
|
|
17082
|
+
return { format: "jwt-vc-json", data: vc };
|
|
17083
|
+
}
|
|
17084
|
+
}
|
|
17085
|
+
if (vc && typeof vc === "object") {
|
|
17086
|
+
const proof = getWireFormProof(vc, true);
|
|
17087
|
+
const wireFromProof = getWireFormFromProof(proof);
|
|
17088
|
+
if (wireFromProof) {
|
|
17089
|
+
const proofType = proof?.type;
|
|
17090
|
+
if (proofType === "SdJwtCompactProof") {
|
|
17091
|
+
return { format: "dc+sd-jwt", data: wireFromProof };
|
|
17092
|
+
}
|
|
17093
|
+
if (proofType === "JwtProof2020") {
|
|
17094
|
+
return { format: "jwt-vc-json", data: wireFromProof };
|
|
17095
|
+
}
|
|
17096
|
+
}
|
|
17097
|
+
const inferred = inferW3cVersionFromContext(vc);
|
|
17098
|
+
return { format: inferred, data: vc };
|
|
17099
|
+
}
|
|
17100
|
+
return { format: "w3c-vc-1.1", data: vc };
|
|
17101
|
+
}, "toStoredCredential");
|
|
17102
|
+
var SD_JWT_COMPACT_RE = /^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+~/;
|
|
17103
|
+
var JWS_COMPACT_RE = /^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/;
|
|
17104
|
+
var looksLikeSdJwtCompact = /* @__PURE__ */ __name2((value) => SD_JWT_COMPACT_RE.test(value), "looksLikeSdJwtCompact");
|
|
17105
|
+
var looksLikeJwsCompact = /* @__PURE__ */ __name2((value) => JWS_COMPACT_RE.test(value), "looksLikeJwsCompact");
|
|
17106
|
+
var getWireFormProof = /* @__PURE__ */ __name2((vc, requireSupportedType = false) => {
|
|
17107
|
+
if (!vc || typeof vc !== "object") return void 0;
|
|
17108
|
+
const proof = vc.proof;
|
|
17109
|
+
if (Array.isArray(proof)) {
|
|
17110
|
+
for (const entry of proof) {
|
|
17111
|
+
const proofObject2 = asWireFormProof(entry);
|
|
17112
|
+
if (proofObject2 && isUsableWireFormProof(proofObject2, requireSupportedType)) {
|
|
17113
|
+
return proofObject2;
|
|
17114
|
+
}
|
|
17115
|
+
}
|
|
17116
|
+
return void 0;
|
|
17117
|
+
}
|
|
17118
|
+
const proofObject = asWireFormProof(proof);
|
|
17119
|
+
return proofObject && isUsableWireFormProof(proofObject, requireSupportedType) ? proofObject : void 0;
|
|
17120
|
+
}, "getWireFormProof");
|
|
17121
|
+
var asWireFormProof = /* @__PURE__ */ __name2((proof) => proof && typeof proof === "object" ? proof : void 0, "asWireFormProof");
|
|
17122
|
+
var isUsableWireFormProof = /* @__PURE__ */ __name2((proof, requireSupportedType) => typeof proof.jwt === "string" && proof.jwt.length > 0 && (!requireSupportedType || proof.type === "SdJwtCompactProof" || proof.type === "JwtProof2020"), "isUsableWireFormProof");
|
|
17123
|
+
var getWireFormFromProof = /* @__PURE__ */ __name2((proof) => typeof proof?.jwt === "string" && proof.jwt.length > 0 ? proof.jwt : void 0, "getWireFormFromProof");
|
|
17124
|
+
var extractWireFormFromVc = /* @__PURE__ */ __name2((vc) => getWireFormFromProof(getWireFormProof(vc)), "extractWireFormFromVc");
|
|
17125
|
+
var inferW3cVersionFromContext = /* @__PURE__ */ __name2((vc) => {
|
|
17126
|
+
if (!vc || typeof vc !== "object") return "w3c-vc-1.1";
|
|
17127
|
+
const contextRaw = vc["@context"];
|
|
17128
|
+
const contexts = Array.isArray(contextRaw) ? contextRaw : contextRaw !== void 0 ? [contextRaw] : [];
|
|
17129
|
+
const isV2 = contexts.some(
|
|
17130
|
+
(c) => typeof c === "string" && c.includes("w3.org/ns/credentials/v2")
|
|
17131
|
+
);
|
|
17132
|
+
return isV2 ? "w3c-vc-2.0" : "w3c-vc-1.1";
|
|
17133
|
+
}, "inferW3cVersionFromContext");
|
|
17033
17134
|
var isHex = /* @__PURE__ */ __name2((str) => /^[0-9a-f]+$/i.test(str), "isHex");
|
|
17034
17135
|
var isEncrypted = /* @__PURE__ */ __name2((item) => {
|
|
17035
17136
|
return import_types.JWEValidator.safeParse(item).success;
|