@learncard/core 2.1.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/core.cjs.development.js +13 -12
- package/dist/core.cjs.development.js.map +2 -2
- package/dist/core.cjs.production.min.js +2 -2
- package/dist/core.cjs.production.min.js.map +2 -2
- package/dist/core.d.ts +10 -2
- package/dist/core.esm.js +13 -12
- package/dist/core.esm.js.map +2 -2
- package/package.json +1 -1
package/dist/core.d.ts
CHANGED
@@ -4656,9 +4656,10 @@ export declare type DependentMethods = {
|
|
4656
4656
|
export declare type VCPluginMethods = DependentMethods & {
|
4657
4657
|
issueCredential: (credential: UnsignedVC) => Promise<VC>;
|
4658
4658
|
verifyCredential: (credential: VC) => Promise<VerificationCheck>;
|
4659
|
-
issuePresentation: (credential:
|
4659
|
+
issuePresentation: (credential: UnsignedVP) => Promise<VP>;
|
4660
4660
|
verifyPresentation: (presentation: VP) => Promise<VerificationCheck>;
|
4661
4661
|
getTestVc: (subject?: string) => UnsignedVC;
|
4662
|
+
getTestVp: (credential?: VC) => Promise<UnsignedVP>;
|
4662
4663
|
};
|
4663
4664
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
4664
4665
|
export declare type Plugin<Name extends string, PublicMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
|
@@ -4700,7 +4701,7 @@ export declare type LearnCardWallet = {
|
|
4700
4701
|
*/
|
4701
4702
|
verifyCredential: (credential: VC) => Promise<VerificationItem[]>;
|
4702
4703
|
/** Creates a signed Verifiable Presentation from a signed Verifiable Credential */
|
4703
|
-
issuePresentation: (
|
4704
|
+
issuePresentation: (presentation: UnsignedVP) => Promise<VP>;
|
4704
4705
|
/**
|
4705
4706
|
* Verifies a signed Verifiable Presentation
|
4706
4707
|
*
|
@@ -4750,6 +4751,13 @@ export declare type LearnCardWallet = {
|
|
4750
4751
|
* You can use this to test out implementations that use this library!
|
4751
4752
|
*/
|
4752
4753
|
getTestVc: (subject?: string) => UnsignedVC;
|
4754
|
+
/**
|
4755
|
+
* Wraps a crednetial in an exmaple presentaion. If no credential is provided, a new one will be
|
4756
|
+
* generated using getTestVc
|
4757
|
+
*
|
4758
|
+
* You can use this to test out implementations that use this library!
|
4759
|
+
*/
|
4760
|
+
getTestVp: (credential?: VC) => Promise<UnsignedVP>;
|
4753
4761
|
/**
|
4754
4762
|
* Returns your ETH balance
|
4755
4763
|
*/
|
package/dist/core.esm.js
CHANGED
@@ -42436,11 +42436,7 @@ var verifyCredential = /* @__PURE__ */ __name((initWallet) => {
|
|
42436
42436
|
|
42437
42437
|
// src/wallet/plugins/vc/issuePresentation.ts
|
42438
42438
|
var issuePresentation = /* @__PURE__ */ __name((initWallet) => {
|
42439
|
-
return (wallet,
|
42440
|
-
const did = wallet.pluginMethods.getSubjectDid("key");
|
42441
|
-
if (!did)
|
42442
|
-
throw new Error("Cannot create presentation: No holder key found");
|
42443
|
-
const holder = did;
|
42439
|
+
return (wallet, presentation) => __async(void 0, null, function* () {
|
42444
42440
|
const kp = wallet.pluginMethods.getSubjectKeypair();
|
42445
42441
|
if (!kp)
|
42446
42442
|
throw new Error("Cannot issue credential: Could not get subject keypair");
|
@@ -42448,12 +42444,6 @@ var issuePresentation = /* @__PURE__ */ __name((initWallet) => {
|
|
42448
42444
|
verificationMethod: yield initWallet.pluginMethods.keyToVerificationMethod("key", kp),
|
42449
42445
|
proofPurpose: "assertionMethod"
|
42450
42446
|
};
|
42451
|
-
const presentation = {
|
42452
|
-
"@context": ["https://www.w3.org/2018/credentials/v1"],
|
42453
|
-
type: ["VerifiablePresentation"],
|
42454
|
-
holder,
|
42455
|
-
verifiableCredential: credential
|
42456
|
-
};
|
42457
42447
|
return initWallet.pluginMethods.issuePresentation(presentation, options, kp);
|
42458
42448
|
});
|
42459
42449
|
}, "issuePresentation");
|
@@ -42483,7 +42473,17 @@ var getVCPlugin = /* @__PURE__ */ __name((wallet) => __async(void 0, null, funct
|
|
42483
42473
|
issuanceDate: "2020-08-19T21:41:50Z",
|
42484
42474
|
credentialSubject: { id: subject }
|
42485
42475
|
};
|
42486
|
-
}
|
42476
|
+
},
|
42477
|
+
getTestVp: (_wallet, _credential) => __async(void 0, null, function* () {
|
42478
|
+
const credential = _credential || (yield _wallet.pluginMethods.issueCredential(_wallet.pluginMethods.getTestVc()));
|
42479
|
+
const did = _wallet.pluginMethods.getSubjectDid("key");
|
42480
|
+
return {
|
42481
|
+
"@context": ["https://www.w3.org/2018/credentials/v1"],
|
42482
|
+
type: ["VerifiablePresentation"],
|
42483
|
+
holder: did,
|
42484
|
+
verifiableCredential: credential
|
42485
|
+
};
|
42486
|
+
})
|
42487
42487
|
})
|
42488
42488
|
};
|
42489
42489
|
}), "getVCPlugin");
|
@@ -47961,6 +47961,7 @@ var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async(void 0, [_0, .
|
|
47961
47961
|
}),
|
47962
47962
|
readFromCeramic: wallet.pluginMethods.readContentFromCeramic,
|
47963
47963
|
getTestVc: wallet.pluginMethods.getTestVc,
|
47964
|
+
getTestVp: wallet.pluginMethods.getTestVp,
|
47964
47965
|
checkMyEth: wallet.pluginMethods.checkMyEth,
|
47965
47966
|
checkMyDai: wallet.pluginMethods.checkMyDai,
|
47966
47967
|
checkMyUsdc: wallet.pluginMethods.checkMyUsdc
|