@learncard/network-plugin 2.13.0 → 2.13.2
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/index.cjs +7 -0
- package/dist/index.d.cts +3 -0
- package/dist/{lcn-plugin.cjs.development.js → lcn-plugin.cjs.development.cjs} +52 -13
- package/dist/lcn-plugin.cjs.development.cjs.map +7 -0
- package/dist/{lcn-plugin.cjs.production.min.js → lcn-plugin.cjs.production.min.cjs} +8 -8
- package/dist/lcn-plugin.cjs.production.min.cjs.map +7 -0
- package/dist/lcn-plugin.esm.js +56 -13
- package/dist/lcn-plugin.esm.js.map +3 -3
- package/dist/plugin.d.ts.map +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +23 -10
- package/dist/index.js +0 -7
- package/dist/lcn-plugin.cjs.development.js.map +0 -7
- package/dist/lcn-plugin.cjs.production.min.js.map +0 -7
package/dist/lcn-plugin.esm.js
CHANGED
|
@@ -13537,6 +13537,17 @@ var CredentialFormatValidator = external_exports.enum([
|
|
|
13537
13537
|
"vc+sd-jwt",
|
|
13538
13538
|
"mso_mdoc"
|
|
13539
13539
|
]);
|
|
13540
|
+
var StoredCredentialEnvelopeValidator = external_exports.object({
|
|
13541
|
+
format: CredentialFormatValidator,
|
|
13542
|
+
data: external_exports.string()
|
|
13543
|
+
}).passthrough();
|
|
13544
|
+
var isStoredCredentialEnvelope = /* @__PURE__ */ __name2((value) => {
|
|
13545
|
+
if (!value || typeof value !== "object") return false;
|
|
13546
|
+
const candidate = value;
|
|
13547
|
+
if (typeof candidate.format !== "string") return false;
|
|
13548
|
+
if (!CredentialFormatValidator.safeParse(candidate.format).success) return false;
|
|
13549
|
+
return typeof candidate.data === "string" || candidate.data instanceof Uint8Array;
|
|
13550
|
+
}, "isStoredCredentialEnvelope");
|
|
13540
13551
|
var StatusCheckEntryValidator = external_exports.object({
|
|
13541
13552
|
/**
|
|
13542
13553
|
* The `credentialStatus.type` as it appeared on the credential.
|
|
@@ -13868,7 +13879,8 @@ var BoostRecipientValidator = external_exports.object({
|
|
|
13868
13879
|
to: LCNVisibleProfileValidator,
|
|
13869
13880
|
from: external_exports.string(),
|
|
13870
13881
|
received: external_exports.string().optional(),
|
|
13871
|
-
uri: external_exports.string().optional()
|
|
13882
|
+
uri: external_exports.string().optional(),
|
|
13883
|
+
status: external_exports.enum(["active", "revoked", "suspended"]).optional()
|
|
13872
13884
|
});
|
|
13873
13885
|
var PaginatedBoostRecipientsValidator = PaginationResponseValidator.extend({
|
|
13874
13886
|
records: BoostRecipientValidator.array()
|
|
@@ -13878,7 +13890,8 @@ var BoostRecipientWithChildrenValidator = external_exports.object({
|
|
|
13878
13890
|
from: external_exports.string(),
|
|
13879
13891
|
received: external_exports.string().optional(),
|
|
13880
13892
|
boostUris: external_exports.array(external_exports.string()),
|
|
13881
|
-
credentialUris: external_exports.array(external_exports.string()).optional()
|
|
13893
|
+
credentialUris: external_exports.array(external_exports.string()).optional(),
|
|
13894
|
+
status: external_exports.enum(["active", "revoked", "suspended"]).optional()
|
|
13882
13895
|
});
|
|
13883
13896
|
var PaginatedBoostRecipientsWithChildrenValidator = PaginationResponseValidator.extend({
|
|
13884
13897
|
records: BoostRecipientWithChildrenValidator.array()
|
|
@@ -14964,7 +14977,8 @@ var CredentialActivityValidator = external_exports.object({
|
|
|
14964
14977
|
inboxCredentialId: external_exports.string().optional(),
|
|
14965
14978
|
integrationId: external_exports.string().optional(),
|
|
14966
14979
|
source: CredentialActivitySourceTypeValidator,
|
|
14967
|
-
metadata: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
14980
|
+
metadata: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
14981
|
+
status: external_exports.enum(["active", "revoked", "suspended"]).optional()
|
|
14968
14982
|
});
|
|
14969
14983
|
var CredentialActivityWithDetailsValidator = CredentialActivityValidator.extend({
|
|
14970
14984
|
boost: external_exports.object({
|
|
@@ -15021,7 +15035,11 @@ var AllocateCredentialStatusInputValidator = external_exports.object({
|
|
|
15021
15035
|
}).default({});
|
|
15022
15036
|
|
|
15023
15037
|
// src/plugin.ts
|
|
15024
|
-
import {
|
|
15038
|
+
import {
|
|
15039
|
+
getCredentialStatusArray,
|
|
15040
|
+
isVC2Format,
|
|
15041
|
+
resolveStorageReadResult
|
|
15042
|
+
} from "@learncard/helpers";
|
|
15025
15043
|
|
|
15026
15044
|
// ../../../node_modules/.pnpm/mustache@4.2.0/node_modules/mustache/mustache.mjs
|
|
15027
15045
|
var objectToString = Object.prototype.toString;
|
|
@@ -15495,6 +15513,19 @@ mustache.Writer = Writer;
|
|
|
15495
15513
|
var mustache_default = mustache;
|
|
15496
15514
|
|
|
15497
15515
|
// src/plugin.ts
|
|
15516
|
+
var uint8ArrayToBase64Url = /* @__PURE__ */ __name((bytes) => {
|
|
15517
|
+
let binary = "";
|
|
15518
|
+
for (let i = 0; i < bytes.length; i += 1) binary += String.fromCharCode(bytes[i]);
|
|
15519
|
+
const base643 = typeof btoa === "function" ? btoa(binary) : Buffer.from(binary, "binary").toString("base64");
|
|
15520
|
+
return base643.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
15521
|
+
}, "uint8ArrayToBase64Url");
|
|
15522
|
+
var normalizeEnvelopeForTransport = /* @__PURE__ */ __name((value) => {
|
|
15523
|
+
if (!isStoredCredentialEnvelope(value)) {
|
|
15524
|
+
return value;
|
|
15525
|
+
}
|
|
15526
|
+
if (typeof value.data === "string") return value;
|
|
15527
|
+
return { ...value, data: uint8ArrayToBase64Url(value.data) };
|
|
15528
|
+
}, "normalizeEnvelopeForTransport");
|
|
15498
15529
|
var escapeJsonStringValue = /* @__PURE__ */ __name((value) => {
|
|
15499
15530
|
if (value === null || value === void 0) return "";
|
|
15500
15531
|
return String(value).replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t").replace(/\f/g, "\\f").replace(/[\b]/g, "\\b");
|
|
@@ -15712,7 +15743,8 @@ async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, opt
|
|
|
15712
15743
|
return void 0;
|
|
15713
15744
|
}
|
|
15714
15745
|
}
|
|
15715
|
-
|
|
15746
|
+
const parsed = await VCValidator.or(VPValidator).or(StoredCredentialEnvelopeValidator).parseAsync(result);
|
|
15747
|
+
return resolveStorageReadResult(parsed);
|
|
15716
15748
|
} catch (error46) {
|
|
15717
15749
|
_learnCard.debug?.(error46);
|
|
15718
15750
|
return void 0;
|
|
@@ -15722,7 +15754,9 @@ async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, opt
|
|
|
15722
15754
|
store: {
|
|
15723
15755
|
upload: /* @__PURE__ */ __name(async (_learnCard, credential) => {
|
|
15724
15756
|
_learnCard.debug?.("learnCard.store['LearnCard Network'].upload");
|
|
15725
|
-
return client.storage.store.mutate({
|
|
15757
|
+
return client.storage.store.mutate({
|
|
15758
|
+
item: normalizeEnvelopeForTransport(credential)
|
|
15759
|
+
});
|
|
15726
15760
|
}, "upload"),
|
|
15727
15761
|
uploadEncrypted: /* @__PURE__ */ __name(async (_learnCard, credential, { recipients = [] } = { recipients: [] }) => {
|
|
15728
15762
|
_learnCard.debug?.("learnCard.store['LearnCard Network'].upload");
|
|
@@ -15734,7 +15768,10 @@ async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, opt
|
|
|
15734
15768
|
"No recipients specified for encrypted upload; provide at least one DID"
|
|
15735
15769
|
);
|
|
15736
15770
|
}
|
|
15737
|
-
const jwe = await _learnCard.invoke.createDagJwe(
|
|
15771
|
+
const jwe = await _learnCard.invoke.createDagJwe(
|
|
15772
|
+
normalizeEnvelopeForTransport(credential),
|
|
15773
|
+
recipientsList
|
|
15774
|
+
);
|
|
15738
15775
|
return client.storage.store.mutate({ item: jwe });
|
|
15739
15776
|
}, "uploadEncrypted"),
|
|
15740
15777
|
delete: /* @__PURE__ */ __name(async (_learnCard, uri) => {
|
|
@@ -16298,22 +16335,28 @@ async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, opt
|
|
|
16298
16335
|
await ensureUser();
|
|
16299
16336
|
return client.boost.allocateCredentialStatus.mutate(options2);
|
|
16300
16337
|
}, "allocateCredentialStatus"),
|
|
16301
|
-
revokeBoostRecipient: /* @__PURE__ */ __name(async (_learnCard, boostUri, recipientProfileId) => {
|
|
16338
|
+
revokeBoostRecipient: /* @__PURE__ */ __name(async (_learnCard, boostUri, recipientProfileId, credentialUri) => {
|
|
16302
16339
|
await ensureUser();
|
|
16303
|
-
return client.boost.revokeBoostRecipient.mutate({
|
|
16340
|
+
return client.boost.revokeBoostRecipient.mutate({
|
|
16341
|
+
boostUri,
|
|
16342
|
+
recipientProfileId,
|
|
16343
|
+
credentialUri
|
|
16344
|
+
});
|
|
16304
16345
|
}, "revokeBoostRecipient"),
|
|
16305
|
-
suspendBoostRecipient: /* @__PURE__ */ __name(async (_learnCard, boostUri, recipientProfileId) => {
|
|
16346
|
+
suspendBoostRecipient: /* @__PURE__ */ __name(async (_learnCard, boostUri, recipientProfileId, credentialUri) => {
|
|
16306
16347
|
await ensureUser();
|
|
16307
16348
|
return client.boost.suspendBoostRecipient.mutate({
|
|
16308
16349
|
boostUri,
|
|
16309
|
-
recipientProfileId
|
|
16350
|
+
recipientProfileId,
|
|
16351
|
+
credentialUri
|
|
16310
16352
|
});
|
|
16311
16353
|
}, "suspendBoostRecipient"),
|
|
16312
|
-
unsuspendBoostRecipient: /* @__PURE__ */ __name(async (_learnCard, boostUri, recipientProfileId) => {
|
|
16354
|
+
unsuspendBoostRecipient: /* @__PURE__ */ __name(async (_learnCard, boostUri, recipientProfileId, credentialUri) => {
|
|
16313
16355
|
await ensureUser();
|
|
16314
16356
|
return client.boost.unsuspendBoostRecipient.mutate({
|
|
16315
16357
|
boostUri,
|
|
16316
|
-
recipientProfileId
|
|
16358
|
+
recipientProfileId,
|
|
16359
|
+
credentialUri
|
|
16317
16360
|
});
|
|
16318
16361
|
}, "unsuspendBoostRecipient"),
|
|
16319
16362
|
deleteBoost: /* @__PURE__ */ __name(async (_learnCard, uri) => {
|