@learncard/learn-cloud-plugin 2.3.25 → 2.3.27
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.js → index.cjs} +2 -2
- package/dist/index.d.cts +3 -0
- package/dist/{learn-cloud-plugin.cjs.development.js → learn-cloud-plugin.cjs.development.cjs} +47 -14
- package/dist/{learn-cloud-plugin.cjs.development.js.map → learn-cloud-plugin.cjs.development.cjs.map} +3 -3
- package/dist/learn-cloud-plugin.cjs.production.min.cjs +56 -0
- package/dist/{learn-cloud-plugin.cjs.production.min.js.map → learn-cloud-plugin.cjs.production.min.cjs.map} +3 -3
- package/dist/learn-cloud-plugin.esm.js +47 -14
- package/dist/learn-cloud-plugin.esm.js.map +3 -3
- package/dist/plugin.d.ts.map +1 -1
- package/package.json +22 -9
- package/dist/learn-cloud-plugin.cjs.production.min.js +0 -56
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
if (process.env.NODE_ENV === 'production') {
|
|
4
|
-
module.exports = require('./learn-cloud-plugin.cjs.production.min.
|
|
4
|
+
module.exports = require('./learn-cloud-plugin.cjs.production.min.cjs');
|
|
5
5
|
} else {
|
|
6
|
-
module.exports = require('./learn-cloud-plugin.cjs.development.
|
|
6
|
+
module.exports = require('./learn-cloud-plugin.cjs.development.cjs');
|
|
7
7
|
}
|
package/dist/index.d.cts
ADDED
package/dist/{learn-cloud-plugin.cjs.development.js → learn-cloud-plugin.cjs.development.cjs}
RENAMED
|
@@ -6116,7 +6116,7 @@ __export(index_exports, {
|
|
|
6116
6116
|
module.exports = __toCommonJS(index_exports);
|
|
6117
6117
|
|
|
6118
6118
|
// src/plugin.ts
|
|
6119
|
-
var import_lodash = __toESM(require_lodash());
|
|
6119
|
+
var import_lodash = __toESM(require_lodash(), 1);
|
|
6120
6120
|
var import_learn_cloud_client = require("@learncard/learn-cloud-client");
|
|
6121
6121
|
var import_helpers = require("@learncard/helpers");
|
|
6122
6122
|
|
|
@@ -19649,6 +19649,17 @@ var CredentialFormatValidator = external_exports.enum([
|
|
|
19649
19649
|
"vc+sd-jwt",
|
|
19650
19650
|
"mso_mdoc"
|
|
19651
19651
|
]);
|
|
19652
|
+
var StoredCredentialEnvelopeValidator = external_exports.object({
|
|
19653
|
+
format: CredentialFormatValidator,
|
|
19654
|
+
data: external_exports.string()
|
|
19655
|
+
}).passthrough();
|
|
19656
|
+
var isStoredCredentialEnvelope = /* @__PURE__ */ __name2((value) => {
|
|
19657
|
+
if (!value || typeof value !== "object") return false;
|
|
19658
|
+
const candidate = value;
|
|
19659
|
+
if (typeof candidate.format !== "string") return false;
|
|
19660
|
+
if (!CredentialFormatValidator.safeParse(candidate.format).success) return false;
|
|
19661
|
+
return typeof candidate.data === "string" || candidate.data instanceof Uint8Array;
|
|
19662
|
+
}, "isStoredCredentialEnvelope");
|
|
19652
19663
|
var StatusCheckEntryValidator = external_exports.object({
|
|
19653
19664
|
/**
|
|
19654
19665
|
* The `credentialStatus.type` as it appeared on the credential.
|
|
@@ -19980,7 +19991,8 @@ var BoostRecipientValidator = external_exports.object({
|
|
|
19980
19991
|
to: LCNVisibleProfileValidator,
|
|
19981
19992
|
from: external_exports.string(),
|
|
19982
19993
|
received: external_exports.string().optional(),
|
|
19983
|
-
uri: external_exports.string().optional()
|
|
19994
|
+
uri: external_exports.string().optional(),
|
|
19995
|
+
status: external_exports.enum(["active", "revoked", "suspended"]).optional()
|
|
19984
19996
|
});
|
|
19985
19997
|
var PaginatedBoostRecipientsValidator = PaginationResponseValidator.extend({
|
|
19986
19998
|
records: BoostRecipientValidator.array()
|
|
@@ -19990,7 +20002,8 @@ var BoostRecipientWithChildrenValidator = external_exports.object({
|
|
|
19990
20002
|
from: external_exports.string(),
|
|
19991
20003
|
received: external_exports.string().optional(),
|
|
19992
20004
|
boostUris: external_exports.array(external_exports.string()),
|
|
19993
|
-
credentialUris: external_exports.array(external_exports.string()).optional()
|
|
20005
|
+
credentialUris: external_exports.array(external_exports.string()).optional(),
|
|
20006
|
+
status: external_exports.enum(["active", "revoked", "suspended"]).optional()
|
|
19994
20007
|
});
|
|
19995
20008
|
var PaginatedBoostRecipientsWithChildrenValidator = PaginationResponseValidator.extend({
|
|
19996
20009
|
records: BoostRecipientWithChildrenValidator.array()
|
|
@@ -21076,7 +21089,8 @@ var CredentialActivityValidator = external_exports.object({
|
|
|
21076
21089
|
inboxCredentialId: external_exports.string().optional(),
|
|
21077
21090
|
integrationId: external_exports.string().optional(),
|
|
21078
21091
|
source: CredentialActivitySourceTypeValidator,
|
|
21079
|
-
metadata: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
21092
|
+
metadata: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
21093
|
+
status: external_exports.enum(["active", "revoked", "suspended"]).optional()
|
|
21080
21094
|
});
|
|
21081
21095
|
var CredentialActivityWithDetailsValidator = CredentialActivityValidator.extend({
|
|
21082
21096
|
boost: external_exports.object({
|
|
@@ -21133,7 +21147,7 @@ var AllocateCredentialStatusInputValidator = external_exports.object({
|
|
|
21133
21147
|
}).default({});
|
|
21134
21148
|
|
|
21135
21149
|
// src/helpers.ts
|
|
21136
|
-
var import_json_stringify_deterministic = __toESM(require_lib());
|
|
21150
|
+
var import_json_stringify_deterministic = __toESM(require_lib(), 1);
|
|
21137
21151
|
|
|
21138
21152
|
// ../../../node_modules/.pnpm/pbkdf2-hmac@1.2.1/node_modules/pbkdf2-hmac/dist/index.browser.esm.js
|
|
21139
21153
|
var e = { "SHA-1": { outputLength: 20, blockSize: 64 }, "SHA-256": { outputLength: 32, blockSize: 64 }, "SHA-384": { outputLength: 48, blockSize: 128 }, "SHA-512": { outputLength: 64, blockSize: 128 } };
|
|
@@ -21234,6 +21248,19 @@ var generateEncryptedRecord = /* @__PURE__ */ __name(async (learnCard, record2,
|
|
|
21234
21248
|
}, "generateEncryptedRecord");
|
|
21235
21249
|
|
|
21236
21250
|
// src/plugin.ts
|
|
21251
|
+
var uint8ArrayToBase64Url = /* @__PURE__ */ __name((bytes) => {
|
|
21252
|
+
let binary = "";
|
|
21253
|
+
for (let i = 0; i < bytes.length; i += 1) binary += String.fromCharCode(bytes[i]);
|
|
21254
|
+
const base643 = typeof btoa === "function" ? btoa(binary) : Buffer.from(binary, "binary").toString("base64");
|
|
21255
|
+
return base643.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
21256
|
+
}, "uint8ArrayToBase64Url");
|
|
21257
|
+
var normalizeEnvelopeForTransport = /* @__PURE__ */ __name((value) => {
|
|
21258
|
+
if (!isStoredCredentialEnvelope(value)) {
|
|
21259
|
+
return value;
|
|
21260
|
+
}
|
|
21261
|
+
if (typeof value.data === "string") return value;
|
|
21262
|
+
return { ...value, data: uint8ArrayToBase64Url(value.data) };
|
|
21263
|
+
}, "normalizeEnvelopeForTransport");
|
|
21237
21264
|
var getLearnCloudClient = /* @__PURE__ */ __name(async (url2, learnCard) => {
|
|
21238
21265
|
return (0, import_learn_cloud_client.getClient)(url2, async (challenge) => {
|
|
21239
21266
|
const jwt2 = await learnCard.invoke.getDidAuthVp({ proofFormat: "jwt", challenge });
|
|
@@ -21437,7 +21464,9 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url2,
|
|
|
21437
21464
|
if (!result) return null;
|
|
21438
21465
|
try {
|
|
21439
21466
|
const decryptedResult = await _learnCard.invoke.decryptDagJwe(result);
|
|
21440
|
-
|
|
21467
|
+
const parsed = await VCValidator.or(VPValidator).or(StoredCredentialEnvelopeValidator).parseAsync(decryptedResult);
|
|
21468
|
+
const resolved = (0, import_helpers.resolveStorageReadResult)(parsed);
|
|
21469
|
+
return resolved === void 0 || isStoredCredentialEnvelope(resolved) ? null : resolved;
|
|
21441
21470
|
} catch (error46) {
|
|
21442
21471
|
_learnCard.debug?.(error46);
|
|
21443
21472
|
return null;
|
|
@@ -21475,7 +21504,8 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url2,
|
|
|
21475
21504
|
learnCard.debug?.("LearnCloud read.get result", result);
|
|
21476
21505
|
const decryptedResult = await _learnCard.invoke.decryptDagJwe(result);
|
|
21477
21506
|
learnCard.debug?.("LearnCloud read.get decryptedResult", decryptedResult);
|
|
21478
|
-
|
|
21507
|
+
const parsed = await VCValidator.or(VPValidator).or(StoredCredentialEnvelopeValidator).parseAsync(decryptedResult);
|
|
21508
|
+
return (0, import_helpers.resolveStorageReadResult)(parsed);
|
|
21479
21509
|
} catch (error46) {
|
|
21480
21510
|
_learnCard.debug?.(error46);
|
|
21481
21511
|
return void 0;
|
|
@@ -21486,7 +21516,8 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url2,
|
|
|
21486
21516
|
learnCard.debug?.("LearnCloud read.get result", result);
|
|
21487
21517
|
const decryptedResult = await _learnCard.invoke.decryptDagJwe(result);
|
|
21488
21518
|
learnCard.debug?.("LearnCloud read.get decryptedResult", decryptedResult);
|
|
21489
|
-
|
|
21519
|
+
const parsed = await VCValidator.or(VPValidator).or(StoredCredentialEnvelopeValidator).parseAsync(decryptedResult);
|
|
21520
|
+
return (0, import_helpers.resolveStorageReadResult)(parsed);
|
|
21490
21521
|
} catch (error46) {
|
|
21491
21522
|
_learnCard.debug?.(error46);
|
|
21492
21523
|
return void 0;
|
|
@@ -21496,14 +21527,16 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url2,
|
|
|
21496
21527
|
store: {
|
|
21497
21528
|
upload: /* @__PURE__ */ __name(async (_learnCard, credential) => {
|
|
21498
21529
|
_learnCard.debug?.("learnCard.store['LearnCard Network'].upload");
|
|
21499
|
-
return client.storage.store.mutate({
|
|
21530
|
+
return client.storage.store.mutate({
|
|
21531
|
+
item: normalizeEnvelopeForTransport(credential)
|
|
21532
|
+
});
|
|
21500
21533
|
}, "upload"),
|
|
21501
21534
|
uploadEncrypted: /* @__PURE__ */ __name(async (_learnCard, credential, { recipients = [] } = { recipients: [] }) => {
|
|
21502
21535
|
_learnCard.debug?.("learnCard.store['LearnCard Network'].upload");
|
|
21503
|
-
const jwe = await _learnCard.invoke.createDagJwe(
|
|
21504
|
-
|
|
21505
|
-
...recipients
|
|
21506
|
-
|
|
21536
|
+
const jwe = await _learnCard.invoke.createDagJwe(
|
|
21537
|
+
normalizeEnvelopeForTransport(credential),
|
|
21538
|
+
[_learnCard.id.did(), ...recipients]
|
|
21539
|
+
);
|
|
21507
21540
|
return client.storage.store.mutate({ item: jwe });
|
|
21508
21541
|
}, "uploadEncrypted"),
|
|
21509
21542
|
delete: /* @__PURE__ */ __name(async (_learnCard, uri) => {
|
|
@@ -21714,4 +21747,4 @@ lodash/lodash.js:
|
|
|
21714
21747
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
21715
21748
|
*)
|
|
21716
21749
|
*/
|
|
21717
|
-
//# sourceMappingURL=learn-cloud-plugin.cjs.development.
|
|
21750
|
+
//# sourceMappingURL=learn-cloud-plugin.cjs.development.cjs.map
|