@learncard/network-plugin 2.14.0 → 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 +62 -20
- package/dist/lcn-plugin.cjs.development.cjs.map +2 -2
- package/dist/lcn-plugin.cjs.production.min.cjs +7 -7
- package/dist/lcn-plugin.cjs.production.min.cjs.map +3 -3
- package/dist/lcn-plugin.esm.js +62 -20
- package/dist/lcn-plugin.esm.js.map +2 -2
- 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/package.json +8 -8
- package/src/plugin.ts +45 -11
- package/src/test/verify-boost-regression.test.ts +167 -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
|
});
|
|
@@ -15997,15 +16005,6 @@ var ConsentFlowContractDataValidator = external_exports.object({
|
|
|
15997
16005
|
var PaginatedConsentFlowDataValidator = PaginationResponseValidator.extend({
|
|
15998
16006
|
records: ConsentFlowContractDataValidator.array()
|
|
15999
16007
|
});
|
|
16000
|
-
var ConsentFlowContractDataForDidValidator = external_exports.object({
|
|
16001
|
-
credentials: external_exports.object({ category: external_exports.string(), uri: external_exports.string() }).array(),
|
|
16002
|
-
personal: external_exports.record(external_exports.string(), external_exports.string()).default({}),
|
|
16003
|
-
date: external_exports.string(),
|
|
16004
|
-
contractUri: external_exports.string()
|
|
16005
|
-
});
|
|
16006
|
-
var PaginatedConsentFlowDataForDidValidator = PaginationResponseValidator.extend({
|
|
16007
|
-
records: ConsentFlowContractDataForDidValidator.array()
|
|
16008
|
-
});
|
|
16009
16008
|
var ConsentFlowTermValidator = external_exports.object({
|
|
16010
16009
|
sharing: external_exports.boolean().optional(),
|
|
16011
16010
|
shared: external_exports.string().array().optional(),
|
|
@@ -16039,6 +16038,34 @@ var PaginatedConsentFlowTermsValidator = PaginationResponseValidator.extend({
|
|
|
16039
16038
|
status: ConsentFlowTermsStatusValidator
|
|
16040
16039
|
}).array()
|
|
16041
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
|
+
});
|
|
16042
16069
|
var ConsentFlowContractQueryValidator = external_exports.object({
|
|
16043
16070
|
read: external_exports.object({
|
|
16044
16071
|
anonymize: external_exports.boolean().optional(),
|
|
@@ -16099,6 +16126,7 @@ var ConsentFlowTransactionValidator = external_exports.object({
|
|
|
16099
16126
|
expiresAt: external_exports.string().optional(),
|
|
16100
16127
|
oneTime: external_exports.boolean().optional(),
|
|
16101
16128
|
terms: ConsentFlowTermsValidator.optional(),
|
|
16129
|
+
guardianApproval: ConsentFlowGuardianApprovalValidator.optional(),
|
|
16102
16130
|
id: external_exports.string(),
|
|
16103
16131
|
action: ConsentFlowTransactionActionValidator,
|
|
16104
16132
|
date: external_exports.string(),
|
|
@@ -19694,6 +19722,13 @@ var getVerifyBoostPlugin = /* @__PURE__ */ __name(async (learnCard, trustedBoost
|
|
|
19694
19722
|
if (!issuerDID) return;
|
|
19695
19723
|
return boostRegistry.find((o) => o.did === issuerDID);
|
|
19696
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");
|
|
19697
19732
|
return {
|
|
19698
19733
|
name: "VerifyBoost",
|
|
19699
19734
|
displayName: "Verify Boost Extension",
|
|
@@ -19704,18 +19739,20 @@ var getVerifyBoostPlugin = /* @__PURE__ */ __name(async (learnCard, trustedBoost
|
|
|
19704
19739
|
credential,
|
|
19705
19740
|
options
|
|
19706
19741
|
);
|
|
19742
|
+
const hasOuterVerificationErrors = Boolean(verificationCheck.errors?.length);
|
|
19707
19743
|
const boostCredential = credential?.boostCredential;
|
|
19708
19744
|
try {
|
|
19709
|
-
|
|
19710
|
-
|
|
19711
|
-
const
|
|
19712
|
-
|
|
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) {
|
|
19713
19750
|
verificationCheck.status = [
|
|
19714
19751
|
...verificationCheck.status ?? [],
|
|
19715
19752
|
...verifyBoostCredential.status
|
|
19716
19753
|
];
|
|
19717
19754
|
}
|
|
19718
|
-
if (!
|
|
19755
|
+
if (!boostId) {
|
|
19719
19756
|
verificationCheck.warnings.push(
|
|
19720
19757
|
"Boost Authenticity could not be verified: Boost ID metadata is missing."
|
|
19721
19758
|
);
|
|
@@ -19733,21 +19770,26 @@ var getVerifyBoostPlugin = /* @__PURE__ */ __name(async (learnCard, trustedBoost
|
|
|
19733
19770
|
...verificationCheck.errors || [],
|
|
19734
19771
|
"Boost Credential could not be verified."
|
|
19735
19772
|
];
|
|
19736
|
-
} 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) {
|
|
19737
19779
|
verificationCheck.errors.push(
|
|
19738
19780
|
"Boost Authenticity could not be verified: Boost ID metadata is mismatched."
|
|
19739
19781
|
);
|
|
19740
19782
|
} else {
|
|
19741
|
-
const trustedBoostIssuer = getTrustedBoostVerifier(credential?.issuer);
|
|
19783
|
+
const trustedBoostIssuer = boostCredential ? getTrustedBoostVerifier(credential?.issuer) : getTrustedBoostNetwork(boostId);
|
|
19742
19784
|
if (trustedBoostIssuer) {
|
|
19743
19785
|
verificationCheck.checks.push(
|
|
19744
19786
|
`Boost is Authentic. Verified by ${trustedBoostIssuer.id}.`
|
|
19745
19787
|
);
|
|
19746
19788
|
} else {
|
|
19747
19789
|
verificationCheck.warnings.push(
|
|
19748
|
-
`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(
|
|
19749
19791
|
credential?.issuer
|
|
19750
|
-
)}`
|
|
19792
|
+
)}` : `Boost Authenticity could not be verified. Boost ID does not identify a trusted network: ${boostId}`
|
|
19751
19793
|
);
|
|
19752
19794
|
}
|
|
19753
19795
|
}
|