@learncard/network-plugin 2.13.1 → 2.13.3
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 +51 -18
- package/dist/lcn-plugin.cjs.development.cjs.map +3 -3
- 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 +56 -19
- 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 +8 -8
|
@@ -13558,6 +13558,17 @@ var CredentialFormatValidator = external_exports.enum([
|
|
|
13558
13558
|
"vc+sd-jwt",
|
|
13559
13559
|
"mso_mdoc"
|
|
13560
13560
|
]);
|
|
13561
|
+
var StoredCredentialEnvelopeValidator = external_exports.object({
|
|
13562
|
+
format: CredentialFormatValidator,
|
|
13563
|
+
data: external_exports.string()
|
|
13564
|
+
}).passthrough();
|
|
13565
|
+
var isStoredCredentialEnvelope = /* @__PURE__ */ __name2((value) => {
|
|
13566
|
+
if (!value || typeof value !== "object") return false;
|
|
13567
|
+
const candidate = value;
|
|
13568
|
+
if (typeof candidate.format !== "string") return false;
|
|
13569
|
+
if (!CredentialFormatValidator.safeParse(candidate.format).success) return false;
|
|
13570
|
+
return typeof candidate.data === "string" || candidate.data instanceof Uint8Array;
|
|
13571
|
+
}, "isStoredCredentialEnvelope");
|
|
13561
13572
|
var StatusCheckEntryValidator = external_exports.object({
|
|
13562
13573
|
/**
|
|
13563
13574
|
* The `credentialStatus.type` as it appeared on the credential.
|
|
@@ -13889,7 +13900,8 @@ var BoostRecipientValidator = external_exports.object({
|
|
|
13889
13900
|
to: LCNVisibleProfileValidator,
|
|
13890
13901
|
from: external_exports.string(),
|
|
13891
13902
|
received: external_exports.string().optional(),
|
|
13892
|
-
uri: external_exports.string().optional()
|
|
13903
|
+
uri: external_exports.string().optional(),
|
|
13904
|
+
status: external_exports.enum(["active", "revoked", "suspended"]).optional()
|
|
13893
13905
|
});
|
|
13894
13906
|
var PaginatedBoostRecipientsValidator = PaginationResponseValidator.extend({
|
|
13895
13907
|
records: BoostRecipientValidator.array()
|
|
@@ -13899,7 +13911,8 @@ var BoostRecipientWithChildrenValidator = external_exports.object({
|
|
|
13899
13911
|
from: external_exports.string(),
|
|
13900
13912
|
received: external_exports.string().optional(),
|
|
13901
13913
|
boostUris: external_exports.array(external_exports.string()),
|
|
13902
|
-
credentialUris: external_exports.array(external_exports.string()).optional()
|
|
13914
|
+
credentialUris: external_exports.array(external_exports.string()).optional(),
|
|
13915
|
+
status: external_exports.enum(["active", "revoked", "suspended"]).optional()
|
|
13903
13916
|
});
|
|
13904
13917
|
var PaginatedBoostRecipientsWithChildrenValidator = PaginationResponseValidator.extend({
|
|
13905
13918
|
records: BoostRecipientWithChildrenValidator.array()
|
|
@@ -14985,7 +14998,8 @@ var CredentialActivityValidator = external_exports.object({
|
|
|
14985
14998
|
inboxCredentialId: external_exports.string().optional(),
|
|
14986
14999
|
integrationId: external_exports.string().optional(),
|
|
14987
15000
|
source: CredentialActivitySourceTypeValidator,
|
|
14988
|
-
metadata: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
15001
|
+
metadata: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
15002
|
+
status: external_exports.enum(["active", "revoked", "suspended"]).optional()
|
|
14989
15003
|
});
|
|
14990
15004
|
var CredentialActivityWithDetailsValidator = CredentialActivityValidator.extend({
|
|
14991
15005
|
boost: external_exports.object({
|
|
@@ -15516,6 +15530,19 @@ mustache.Writer = Writer;
|
|
|
15516
15530
|
var mustache_default = mustache;
|
|
15517
15531
|
|
|
15518
15532
|
// src/plugin.ts
|
|
15533
|
+
var uint8ArrayToBase64Url = /* @__PURE__ */ __name((bytes) => {
|
|
15534
|
+
let binary = "";
|
|
15535
|
+
for (let i = 0; i < bytes.length; i += 1) binary += String.fromCharCode(bytes[i]);
|
|
15536
|
+
const base643 = typeof btoa === "function" ? btoa(binary) : Buffer.from(binary, "binary").toString("base64");
|
|
15537
|
+
return base643.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
15538
|
+
}, "uint8ArrayToBase64Url");
|
|
15539
|
+
var normalizeEnvelopeForTransport = /* @__PURE__ */ __name((value) => {
|
|
15540
|
+
if (!isStoredCredentialEnvelope(value)) {
|
|
15541
|
+
return value;
|
|
15542
|
+
}
|
|
15543
|
+
if (typeof value.data === "string") return value;
|
|
15544
|
+
return { ...value, data: uint8ArrayToBase64Url(value.data) };
|
|
15545
|
+
}, "normalizeEnvelopeForTransport");
|
|
15519
15546
|
var escapeJsonStringValue = /* @__PURE__ */ __name((value) => {
|
|
15520
15547
|
if (value === null || value === void 0) return "";
|
|
15521
15548
|
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");
|
|
@@ -15733,7 +15760,8 @@ async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, opt
|
|
|
15733
15760
|
return void 0;
|
|
15734
15761
|
}
|
|
15735
15762
|
}
|
|
15736
|
-
|
|
15763
|
+
const parsed = await VCValidator.or(VPValidator).or(StoredCredentialEnvelopeValidator).parseAsync(result);
|
|
15764
|
+
return (0, import_helpers.resolveStorageReadResult)(parsed);
|
|
15737
15765
|
} catch (error46) {
|
|
15738
15766
|
_learnCard.debug?.(error46);
|
|
15739
15767
|
return void 0;
|
|
@@ -15743,7 +15771,9 @@ async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, opt
|
|
|
15743
15771
|
store: {
|
|
15744
15772
|
upload: /* @__PURE__ */ __name(async (_learnCard, credential) => {
|
|
15745
15773
|
_learnCard.debug?.("learnCard.store['LearnCard Network'].upload");
|
|
15746
|
-
return client.storage.store.mutate({
|
|
15774
|
+
return client.storage.store.mutate({
|
|
15775
|
+
item: normalizeEnvelopeForTransport(credential)
|
|
15776
|
+
});
|
|
15747
15777
|
}, "upload"),
|
|
15748
15778
|
uploadEncrypted: /* @__PURE__ */ __name(async (_learnCard, credential, { recipients = [] } = { recipients: [] }) => {
|
|
15749
15779
|
_learnCard.debug?.("learnCard.store['LearnCard Network'].upload");
|
|
@@ -15755,7 +15785,10 @@ async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, opt
|
|
|
15755
15785
|
"No recipients specified for encrypted upload; provide at least one DID"
|
|
15756
15786
|
);
|
|
15757
15787
|
}
|
|
15758
|
-
const jwe = await _learnCard.invoke.createDagJwe(
|
|
15788
|
+
const jwe = await _learnCard.invoke.createDagJwe(
|
|
15789
|
+
normalizeEnvelopeForTransport(credential),
|
|
15790
|
+
recipientsList
|
|
15791
|
+
);
|
|
15759
15792
|
return client.storage.store.mutate({ item: jwe });
|
|
15760
15793
|
}, "uploadEncrypted"),
|
|
15761
15794
|
delete: /* @__PURE__ */ __name(async (_learnCard, uri) => {
|
|
@@ -16319,23 +16352,23 @@ async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, opt
|
|
|
16319
16352
|
await ensureUser();
|
|
16320
16353
|
return client.boost.allocateCredentialStatus.mutate(options2);
|
|
16321
16354
|
}, "allocateCredentialStatus"),
|
|
16322
|
-
revokeBoostRecipient: /* @__PURE__ */ __name(async (_learnCard, boostUri, recipientProfileId) => {
|
|
16355
|
+
revokeBoostRecipient: /* @__PURE__ */ __name(async (_learnCard, boostUri, recipientProfileId, credentialUri) => {
|
|
16323
16356
|
await ensureUser();
|
|
16324
|
-
|
|
16357
|
+
const input = { boostUri, recipientProfileId };
|
|
16358
|
+
if (credentialUri !== void 0) Object.assign(input, { credentialUri });
|
|
16359
|
+
return client.boost.revokeBoostRecipient.mutate(input);
|
|
16325
16360
|
}, "revokeBoostRecipient"),
|
|
16326
|
-
suspendBoostRecipient: /* @__PURE__ */ __name(async (_learnCard, boostUri, recipientProfileId) => {
|
|
16361
|
+
suspendBoostRecipient: /* @__PURE__ */ __name(async (_learnCard, boostUri, recipientProfileId, credentialUri) => {
|
|
16327
16362
|
await ensureUser();
|
|
16328
|
-
|
|
16329
|
-
|
|
16330
|
-
|
|
16331
|
-
});
|
|
16363
|
+
const input = { boostUri, recipientProfileId };
|
|
16364
|
+
if (credentialUri !== void 0) Object.assign(input, { credentialUri });
|
|
16365
|
+
return client.boost.suspendBoostRecipient.mutate(input);
|
|
16332
16366
|
}, "suspendBoostRecipient"),
|
|
16333
|
-
unsuspendBoostRecipient: /* @__PURE__ */ __name(async (_learnCard, boostUri, recipientProfileId) => {
|
|
16367
|
+
unsuspendBoostRecipient: /* @__PURE__ */ __name(async (_learnCard, boostUri, recipientProfileId, credentialUri) => {
|
|
16334
16368
|
await ensureUser();
|
|
16335
|
-
|
|
16336
|
-
|
|
16337
|
-
|
|
16338
|
-
});
|
|
16369
|
+
const input = { boostUri, recipientProfileId };
|
|
16370
|
+
if (credentialUri !== void 0) Object.assign(input, { credentialUri });
|
|
16371
|
+
return client.boost.unsuspendBoostRecipient.mutate(input);
|
|
16339
16372
|
}, "unsuspendBoostRecipient"),
|
|
16340
16373
|
deleteBoost: /* @__PURE__ */ __name(async (_learnCard, uri) => {
|
|
16341
16374
|
await ensureUser();
|