@learncard/core 6.0.0 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/core.cjs.development.js +102 -15
- package/dist/core.cjs.development.js.map +3 -3
- package/dist/core.cjs.production.min.js +61 -61
- package/dist/core.cjs.production.min.js.map +3 -3
- package/dist/core.d.ts +267 -165
- package/dist/core.esm.js +102 -15
- package/dist/core.esm.js.map +3 -3
- package/dist/didkit/didkit_wasm.js +1 -1
- package/dist/didkit/didkit_wasm_bg.wasm +0 -0
- package/dist/didkit_wasm.js +1 -1
- package/dist/didkit_wasm_bg.wasm +0 -0
- package/package.json +2 -2
@@ -36024,7 +36024,7 @@ function getImports() {
|
|
36024
36024
|
const ret = wasm.memory;
|
36025
36025
|
return addHeapObject(ret);
|
36026
36026
|
};
|
36027
|
-
imports.wbg.
|
36027
|
+
imports.wbg.__wbindgen_closure_wrapper10021 = function(arg0, arg1, arg2) {
|
36028
36028
|
const ret = makeMutClosure(arg0, arg1, 3552, __wbg_adapter_24);
|
36029
36029
|
return addHeapObject(ret);
|
36030
36030
|
};
|
@@ -36061,7 +36061,7 @@ var didkit_wasm_default = init;
|
|
36061
36061
|
|
36062
36062
|
// src/didkit/index.ts
|
36063
36063
|
var initialized = false;
|
36064
|
-
var init2 = /* @__PURE__ */ __name((arg = "https://cdn.filestackcontent.com/
|
36064
|
+
var init2 = /* @__PURE__ */ __name((arg = "https://cdn.filestackcontent.com/R0BsvnoVRhezGazRDUy5") => __async(void 0, null, function* () {
|
36065
36065
|
if (initialized)
|
36066
36066
|
return;
|
36067
36067
|
initialized = true;
|
@@ -36126,6 +36126,90 @@ var ExpirationPlugin = /* @__PURE__ */ __name((wallet) => ({
|
|
36126
36126
|
}
|
36127
36127
|
}), "ExpirationPlugin");
|
36128
36128
|
|
36129
|
+
// src/wallet/helpers/wallet.helpers.ts
|
36130
|
+
var recycleDependents = /* @__PURE__ */ __name((_methods) => ({}), "recycleDependents");
|
36131
|
+
|
36132
|
+
// src/wallet/plugins/vc-templates/templates.ts
|
36133
|
+
var VC_TEMPLATES = {
|
36134
|
+
basic: ({
|
36135
|
+
did = "did:example:d23dd687a7dc6787646f2eb98d0",
|
36136
|
+
subject = "did:example:d23dd687a7dc6787646f2eb98d0",
|
36137
|
+
issuanceDate = "2020-08-19T21:41:50Z"
|
36138
|
+
} = {}) => ({
|
36139
|
+
"@context": ["https://www.w3.org/2018/credentials/v1"],
|
36140
|
+
id: "http://example.org/credentials/3731",
|
36141
|
+
type: ["VerifiableCredential"],
|
36142
|
+
issuer: did,
|
36143
|
+
issuanceDate,
|
36144
|
+
credentialSubject: { id: subject }
|
36145
|
+
}),
|
36146
|
+
achievement: ({
|
36147
|
+
did = "did:example:d23dd687a7dc6787646f2eb98d0",
|
36148
|
+
subject = "did:example:d23dd687a7dc6787646f2eb98d0",
|
36149
|
+
name: name5 = "Teamwork Badge",
|
36150
|
+
achievementName = "Teamwork",
|
36151
|
+
description = "This badge recognizes the development of the capacity to collaborate within a group environment.",
|
36152
|
+
criteriaNarrative = "Team members are nominated for this badge by their peers and recognized upon review by Example Corp management.",
|
36153
|
+
issuanceDate = "2020-08-19T21:41:50Z"
|
36154
|
+
} = {}) => ({
|
36155
|
+
"@context": [
|
36156
|
+
"https://www.w3.org/2018/credentials/v1",
|
36157
|
+
"https://imsglobal.github.io/openbadges-specification/context.json"
|
36158
|
+
],
|
36159
|
+
id: "http://example.com/credentials/3527",
|
36160
|
+
type: ["VerifiableCredential", "OpenBadgeCredential"],
|
36161
|
+
issuer: did,
|
36162
|
+
issuanceDate,
|
36163
|
+
name: name5,
|
36164
|
+
credentialSubject: {
|
36165
|
+
id: subject,
|
36166
|
+
type: ["AchievementSubject"],
|
36167
|
+
achievement: {
|
36168
|
+
id: "https://example.com/achievements/21st-century-skills/teamwork",
|
36169
|
+
type: ["Achievement"],
|
36170
|
+
criteria: { narrative: criteriaNarrative },
|
36171
|
+
description,
|
36172
|
+
name: achievementName
|
36173
|
+
}
|
36174
|
+
}
|
36175
|
+
})
|
36176
|
+
};
|
36177
|
+
|
36178
|
+
// src/wallet/plugins/vc-templates/vc-templates.ts
|
36179
|
+
var getVCTemplatesPlugin = /* @__PURE__ */ __name((wallet) => {
|
36180
|
+
return {
|
36181
|
+
pluginMethods: __spreadProps(__spreadValues({}, recycleDependents(wallet.pluginMethods)), {
|
36182
|
+
newCredential: (_wallet, args = { type: "basic" }) => {
|
36183
|
+
var _a, _b;
|
36184
|
+
const did = args.did || ((_b = (_a = _wallet.pluginMethods).getSubjectDid) == null ? void 0 : _b.call(_a, "key"));
|
36185
|
+
if (!did)
|
36186
|
+
throw new Error("Could not get issuer did!");
|
36187
|
+
const defaults = {
|
36188
|
+
did,
|
36189
|
+
subject: "did:example:d23dd687a7dc6787646f2eb98d0",
|
36190
|
+
issuanceDate: "2020-08-19T21:41:50Z"
|
36191
|
+
};
|
36192
|
+
const _c = args, { type = "basic" } = _c, functionArgs = __objRest(_c, ["type"]);
|
36193
|
+
if (!(type in VC_TEMPLATES))
|
36194
|
+
throw new Error("Invalid Test VC Type!");
|
36195
|
+
return VC_TEMPLATES[type](__spreadValues(__spreadValues({}, defaults), functionArgs));
|
36196
|
+
},
|
36197
|
+
newPresentation: (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (_wallet, credential, args = {}) {
|
36198
|
+
var _a, _b;
|
36199
|
+
const did = (args == null ? void 0 : args.did) || ((_b = (_a = _wallet.pluginMethods).getSubjectDid) == null ? void 0 : _b.call(_a, "key"));
|
36200
|
+
if (!did)
|
36201
|
+
throw new Error("Could not get issuer did!");
|
36202
|
+
return {
|
36203
|
+
"@context": ["https://www.w3.org/2018/credentials/v1"],
|
36204
|
+
type: ["VerifiablePresentation"],
|
36205
|
+
holder: did,
|
36206
|
+
verifiableCredential: credential
|
36207
|
+
};
|
36208
|
+
})
|
36209
|
+
})
|
36210
|
+
};
|
36211
|
+
}, "getVCTemplatesPlugin");
|
36212
|
+
|
36129
36213
|
// ../../node_modules/.pnpm/zod@3.17.3/node_modules/zod/lib/index.mjs
|
36130
36214
|
var util;
|
36131
36215
|
(function(util2) {
|
@@ -38870,12 +38954,12 @@ var ImageValidator = mod.string().or(mod.object({
|
|
38870
38954
|
caption: mod.string().optional()
|
38871
38955
|
}));
|
38872
38956
|
var GeoCoordinatesValidator = mod.object({
|
38873
|
-
type: mod.string().array().nonempty(),
|
38957
|
+
type: mod.string().min(1).or(mod.string().array().nonempty()),
|
38874
38958
|
latitude: mod.number(),
|
38875
38959
|
longitude: mod.number()
|
38876
38960
|
});
|
38877
38961
|
var AddressValidator = mod.object({
|
38878
|
-
type: mod.string().array().nonempty(),
|
38962
|
+
type: mod.string().min(1).or(mod.string().array().nonempty()),
|
38879
38963
|
addressCountry: mod.string().optional(),
|
38880
38964
|
addressCountryCode: mod.string().optional(),
|
38881
38965
|
addressRegion: mod.string().optional(),
|
@@ -38906,7 +38990,7 @@ var IdentifierTypeValidator = mod.enum([
|
|
38906
38990
|
"identifier"
|
38907
38991
|
]).or(mod.string());
|
38908
38992
|
var IdentifierEntryValidator = mod.object({
|
38909
|
-
type: mod.string().array().nonempty(),
|
38993
|
+
type: mod.string().min(1).or(mod.string().array().nonempty()),
|
38910
38994
|
identifier: mod.string(),
|
38911
38995
|
identifierType: IdentifierTypeValidator
|
38912
38996
|
});
|
@@ -39126,7 +39210,7 @@ var AchievementSubjectValidator = mod.object({
|
|
39126
39210
|
activityStartDate: mod.string().optional(),
|
39127
39211
|
creditsEarned: mod.number().optional(),
|
39128
39212
|
achievement: AchievementValidator.optional(),
|
39129
|
-
identifier: IdentityObjectValidator.optional(),
|
39213
|
+
identifier: IdentityObjectValidator.array().optional(),
|
39130
39214
|
image: ImageValidator.optional(),
|
39131
39215
|
licenseNumber: mod.string().optional(),
|
39132
39216
|
narrative: mod.string().optional(),
|
@@ -39147,7 +39231,7 @@ var EvidenceValidator = mod.object({
|
|
39147
39231
|
var UnsignedAchievementCredentialValidator = UnsignedVCValidator.extend({
|
39148
39232
|
name: mod.string().optional(),
|
39149
39233
|
description: mod.string().optional(),
|
39150
|
-
image:
|
39234
|
+
image: ImageValidator.optional(),
|
39151
39235
|
credentialSubject: AchievementSubjectValidator.or(AchievementSubjectValidator.array()),
|
39152
39236
|
endorsement: UnsignedVCValidator.array().optional(),
|
39153
39237
|
evidence: EvidenceValidator.array().optional()
|
@@ -40794,9 +40878,12 @@ var verifyCredential2 = /* @__PURE__ */ __name((wallet) => {
|
|
40794
40878
|
// src/wallet/initializers/emptyWallet.ts
|
40795
40879
|
var emptyWallet = /* @__PURE__ */ __name((..._0) => __async(void 0, [..._0], function* ({ didkit } = {}) {
|
40796
40880
|
const didkitWallet = yield (yield generateWallet()).addPlugin(yield getDidKitPlugin(didkit));
|
40797
|
-
const
|
40881
|
+
const expirationWallet = yield didkitWallet.addPlugin(ExpirationPlugin(didkitWallet));
|
40882
|
+
const wallet = yield expirationWallet.addPlugin(getVCTemplatesPlugin(expirationWallet));
|
40798
40883
|
return {
|
40799
40884
|
_wallet: wallet,
|
40885
|
+
newCredential: wallet.pluginMethods.newCredential,
|
40886
|
+
newPresentation: wallet.pluginMethods.newPresentation,
|
40800
40887
|
verifyCredential: verifyCredential2(wallet),
|
40801
40888
|
verifyPresentation: wallet.pluginMethods.verifyPresentation,
|
40802
40889
|
resolveDid: wallet.pluginMethods.resolveDid
|
@@ -53669,9 +53756,6 @@ var getDidKeyPlugin = /* @__PURE__ */ __name((wallet, key2) => __async(void 0, n
|
|
53669
53756
|
};
|
53670
53757
|
}), "getDidKeyPlugin");
|
53671
53758
|
|
53672
|
-
// src/wallet/helpers/wallet.helpers.ts
|
53673
|
-
var recycleDependents = /* @__PURE__ */ __name((_methods) => ({}), "recycleDependents");
|
53674
|
-
|
53675
53759
|
// src/wallet/plugins/vc/issueCredential.ts
|
53676
53760
|
var issueCredential2 = /* @__PURE__ */ __name((initWallet) => {
|
53677
53761
|
return (wallet, credential) => __async(void 0, null, function* () {
|
@@ -53715,7 +53799,7 @@ var verifyPresentation2 = /* @__PURE__ */ __name((initWallet) => {
|
|
53715
53799
|
}, "verifyPresentation");
|
53716
53800
|
|
53717
53801
|
// src/wallet/plugins/vc/vc.ts
|
53718
|
-
var getVCPlugin = /* @__PURE__ */ __name((wallet) =>
|
53802
|
+
var getVCPlugin = /* @__PURE__ */ __name((wallet) => {
|
53719
53803
|
return {
|
53720
53804
|
pluginMethods: __spreadProps(__spreadValues({}, recycleDependents(wallet.pluginMethods)), {
|
53721
53805
|
issueCredential: issueCredential2(wallet),
|
@@ -53745,7 +53829,7 @@ var getVCPlugin = /* @__PURE__ */ __name((wallet) => __async(void 0, null, funct
|
|
53745
53829
|
})
|
53746
53830
|
})
|
53747
53831
|
};
|
53748
|
-
}
|
53832
|
+
}, "getVCPlugin");
|
53749
53833
|
|
53750
53834
|
// src/wallet/plugins/EthereumPlugin/index.ts
|
53751
53835
|
var import_ethers2 = require("ethers");
|
@@ -57096,8 +57180,9 @@ var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async(void 0, [_0, .
|
|
57096
57180
|
} = {}) {
|
57097
57181
|
const didkitWallet = yield (yield generateWallet(defaultContents)).addPlugin(yield getDidKitPlugin(didkit));
|
57098
57182
|
const didkeyWallet = yield didkitWallet.addPlugin(yield getDidKeyPlugin(didkitWallet, key2));
|
57099
|
-
const didkeyAndVCWallet = yield didkeyWallet.addPlugin(
|
57100
|
-
const
|
57183
|
+
const didkeyAndVCWallet = yield didkeyWallet.addPlugin(getVCPlugin(didkeyWallet));
|
57184
|
+
const templateWallet = yield didkeyAndVCWallet.addPlugin(getVCTemplatesPlugin(didkeyAndVCWallet));
|
57185
|
+
const idxWallet = yield templateWallet.addPlugin(yield getIDXPlugin(templateWallet, ceramicIdx));
|
57101
57186
|
const expirationWallet = yield idxWallet.addPlugin(ExpirationPlugin(idxWallet));
|
57102
57187
|
const ethWallet = yield expirationWallet.addPlugin(getEthereumPlugin(expirationWallet, ethereumConfig));
|
57103
57188
|
const wallet = yield ethWallet.addPlugin(getVpqrPlugin(ethWallet));
|
@@ -57105,6 +57190,8 @@ var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async(void 0, [_0, .
|
|
57105
57190
|
_wallet: wallet,
|
57106
57191
|
did: (type = "key") => wallet.pluginMethods.getSubjectDid(type),
|
57107
57192
|
keypair: (type = "ed25519") => wallet.pluginMethods.getSubjectKeypair(type),
|
57193
|
+
newCredential: wallet.pluginMethods.newCredential,
|
57194
|
+
newPresentation: wallet.pluginMethods.newPresentation,
|
57108
57195
|
issueCredential: wallet.pluginMethods.issueCredential,
|
57109
57196
|
verifyCredential: verifyCredential2(wallet),
|
57110
57197
|
issuePresentation: wallet.pluginMethods.issuePresentation,
|