@learncard/network-plugin 2.5.23 → 2.6.0
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.js +212 -250
- package/dist/lcn-plugin.cjs.development.js.map +3 -3
- package/dist/lcn-plugin.cjs.production.min.js +2 -2
- package/dist/lcn-plugin.cjs.production.min.js.map +3 -3
- package/dist/lcn-plugin.esm.js +212 -250
- package/dist/lcn-plugin.esm.js.map +3 -3
- package/dist/plugin.d.ts +2 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/lcn-plugin.esm.js
CHANGED
|
@@ -7375,6 +7375,23 @@ var getClient = /* @__PURE__ */ __name2(async (url, didAuthFunction) => {
|
|
|
7375
7375
|
});
|
|
7376
7376
|
return trpc;
|
|
7377
7377
|
}, "getClient");
|
|
7378
|
+
var getApiTokenClient = /* @__PURE__ */ __name2(async (url, apiToken) => {
|
|
7379
|
+
const trpc = createTRPCClient({
|
|
7380
|
+
links: [
|
|
7381
|
+
httpBatchLink({
|
|
7382
|
+
methodOverride: "POST",
|
|
7383
|
+
url,
|
|
7384
|
+
maxURLLength: 3072,
|
|
7385
|
+
headers: { Authorization: `Bearer ${apiToken}` },
|
|
7386
|
+
transformer: {
|
|
7387
|
+
input: import_helpers.RegExpTransformer,
|
|
7388
|
+
output: { serialize: (o) => o, deserialize: (o) => o }
|
|
7389
|
+
}
|
|
7390
|
+
})
|
|
7391
|
+
]
|
|
7392
|
+
});
|
|
7393
|
+
return trpc;
|
|
7394
|
+
}, "getApiTokenClient");
|
|
7378
7395
|
|
|
7379
7396
|
// ../../../node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.mjs
|
|
7380
7397
|
var util;
|
|
@@ -17633,21 +17650,56 @@ var isVC2Format = /* @__PURE__ */ __name4((credential) => {
|
|
|
17633
17650
|
}, "isVC2Format");
|
|
17634
17651
|
|
|
17635
17652
|
// src/plugin.ts
|
|
17636
|
-
|
|
17637
|
-
let did =
|
|
17653
|
+
async function getLearnCardNetworkPlugin(learnCard, url, apiToken) {
|
|
17654
|
+
let did = "";
|
|
17655
|
+
try {
|
|
17656
|
+
const idPlane = learnCard?.id;
|
|
17657
|
+
if (idPlane && typeof idPlane.did === "function") {
|
|
17658
|
+
did = idPlane.did();
|
|
17659
|
+
}
|
|
17660
|
+
} catch {
|
|
17661
|
+
learnCard?.debug?.("LCN: no local DID available at init; will fetch from profile");
|
|
17662
|
+
}
|
|
17638
17663
|
learnCard?.debug?.("Adding LearnCardNetwork Plugin");
|
|
17639
|
-
const client = await getClient(url, async (challenge) => {
|
|
17664
|
+
const client = apiToken ? await getApiTokenClient(url, apiToken) : await getClient(url, async (challenge) => {
|
|
17640
17665
|
const jwt = await learnCard.invoke.getDidAuthVp({ proofFormat: "jwt", challenge });
|
|
17641
17666
|
if (typeof jwt !== "string")
|
|
17642
17667
|
throw new Error("Error getting DID-Auth-JWT!");
|
|
17643
17668
|
return jwt;
|
|
17644
17669
|
});
|
|
17645
17670
|
let userData;
|
|
17671
|
+
learnCard?.debug?.("LCN: initial getProfile query starting", { apiToken: !!apiToken });
|
|
17646
17672
|
const initialQuery = client.profile.getProfile.query().then((result) => {
|
|
17647
17673
|
userData = result;
|
|
17648
17674
|
if (userData?.did)
|
|
17649
17675
|
did = userData.did;
|
|
17676
|
+
learnCard?.debug?.("LCN: initial getProfile success", { did });
|
|
17677
|
+
return result;
|
|
17678
|
+
}).catch((error) => {
|
|
17679
|
+
learnCard?.debug?.("LCN: getProfile failed (non-fatal)", error);
|
|
17680
|
+
return void 0;
|
|
17650
17681
|
});
|
|
17682
|
+
const ensureUser = /* @__PURE__ */ __name(async () => {
|
|
17683
|
+
try {
|
|
17684
|
+
await initialQuery;
|
|
17685
|
+
} catch {
|
|
17686
|
+
}
|
|
17687
|
+
if (!userData && apiToken) {
|
|
17688
|
+
try {
|
|
17689
|
+
learnCard?.debug?.("LCN ensureUser: retrying getProfile with apiToken");
|
|
17690
|
+
const res = await client.profile.getProfile.query();
|
|
17691
|
+
userData = res;
|
|
17692
|
+
if (userData?.did)
|
|
17693
|
+
did = userData.did;
|
|
17694
|
+
learnCard?.debug?.("LCN ensureUser: retry success", { did });
|
|
17695
|
+
} catch (e) {
|
|
17696
|
+
learnCard?.debug?.("LCN ensureUser: retry failed", e);
|
|
17697
|
+
}
|
|
17698
|
+
}
|
|
17699
|
+
if (!userData)
|
|
17700
|
+
throw new Error("Please make an account first!");
|
|
17701
|
+
return userData;
|
|
17702
|
+
}, "ensureUser");
|
|
17651
17703
|
return {
|
|
17652
17704
|
name: "LearnCard Network",
|
|
17653
17705
|
displayName: "LearnCard Network",
|
|
@@ -17656,9 +17708,9 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
17656
17708
|
did: (_learnCard, method) => {
|
|
17657
17709
|
if (!method || method === "web")
|
|
17658
17710
|
return did;
|
|
17659
|
-
return learnCard.id
|
|
17711
|
+
return learnCard.id?.did?.(method);
|
|
17660
17712
|
},
|
|
17661
|
-
keypair: (_learnCard, algorithm) => learnCard.id
|
|
17713
|
+
keypair: (_learnCard, algorithm) => learnCard.id?.keypair?.(algorithm)
|
|
17662
17714
|
},
|
|
17663
17715
|
read: {
|
|
17664
17716
|
get: async (_learnCard, vcUri) => {
|
|
@@ -17674,9 +17726,16 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
17674
17726
|
try {
|
|
17675
17727
|
let result = await client.storage.resolve.query({ uri: vcUri });
|
|
17676
17728
|
if ("ciphertext" in result) {
|
|
17677
|
-
|
|
17678
|
-
_learnCard.id.keypair()
|
|
17679
|
-
|
|
17729
|
+
try {
|
|
17730
|
+
const kp = _learnCard.id.keypair();
|
|
17731
|
+
result = await _learnCard.invoke.decryptDagJwe(result, [kp]);
|
|
17732
|
+
} catch (e) {
|
|
17733
|
+
_learnCard.debug?.(
|
|
17734
|
+
"LCN read.get: skipping decryption (no keypair?)",
|
|
17735
|
+
e
|
|
17736
|
+
);
|
|
17737
|
+
return void 0;
|
|
17738
|
+
}
|
|
17680
17739
|
}
|
|
17681
17740
|
return await VCValidator.or(VPValidator).parseAsync(result);
|
|
17682
17741
|
} catch (error) {
|
|
@@ -17692,15 +17751,24 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
17692
17751
|
},
|
|
17693
17752
|
uploadEncrypted: async (_learnCard, credential, { recipients = [] } = { recipients: [] }) => {
|
|
17694
17753
|
_learnCard.debug?.("learnCard.store['LearnCard Network'].upload");
|
|
17695
|
-
|
|
17696
|
-
|
|
17697
|
-
|
|
17698
|
-
|
|
17754
|
+
await ensureUser();
|
|
17755
|
+
const selfDid = did || userData?.did || "";
|
|
17756
|
+
const recipientsList = [selfDid, ...recipients].filter(Boolean);
|
|
17757
|
+
if (recipientsList.length === 0) {
|
|
17758
|
+
throw new Error(
|
|
17759
|
+
"No recipients specified for encrypted upload; provide at least one DID"
|
|
17760
|
+
);
|
|
17761
|
+
}
|
|
17762
|
+
const jwe = await _learnCard.invoke.createDagJwe(credential, recipientsList);
|
|
17699
17763
|
return client.storage.store.mutate({ item: jwe });
|
|
17700
17764
|
}
|
|
17701
17765
|
},
|
|
17702
17766
|
methods: {
|
|
17703
17767
|
createProfile: async (_learnCard, profile) => {
|
|
17768
|
+
try {
|
|
17769
|
+
await ensureUser();
|
|
17770
|
+
} catch {
|
|
17771
|
+
}
|
|
17704
17772
|
if (userData)
|
|
17705
17773
|
throw new Error("Account already exists!");
|
|
17706
17774
|
const newDid = await client.profile.createProfile.mutate(profile);
|
|
@@ -17709,8 +17777,10 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
17709
17777
|
return newDid;
|
|
17710
17778
|
},
|
|
17711
17779
|
createServiceProfile: async (_learnCard, profile) => {
|
|
17712
|
-
|
|
17713
|
-
|
|
17780
|
+
try {
|
|
17781
|
+
await ensureUser();
|
|
17782
|
+
} catch {
|
|
17783
|
+
}
|
|
17714
17784
|
const newDid = await client.profile.createServiceProfile.mutate(profile);
|
|
17715
17785
|
userData = await client.profile.getProfile.query();
|
|
17716
17786
|
did = newDid;
|
|
@@ -17721,14 +17791,12 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
17721
17791
|
return newDid;
|
|
17722
17792
|
},
|
|
17723
17793
|
createProfileManager: async (_learnCard, profile) => {
|
|
17724
|
-
|
|
17725
|
-
throw new Error("Please make an account first!");
|
|
17794
|
+
await ensureUser();
|
|
17726
17795
|
const newDid = await client.profileManager.createProfileManager.mutate(profile);
|
|
17727
17796
|
return newDid;
|
|
17728
17797
|
},
|
|
17729
17798
|
createChildProfileManager: async (_learnCard, parentUri, profile) => {
|
|
17730
|
-
|
|
17731
|
-
throw new Error("Please make an account first!");
|
|
17799
|
+
await ensureUser();
|
|
17732
17800
|
const newDid = await client.profileManager.createChildProfileManager.mutate({
|
|
17733
17801
|
parentUri,
|
|
17734
17802
|
profile
|
|
@@ -17736,27 +17804,23 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
17736
17804
|
return newDid;
|
|
17737
17805
|
},
|
|
17738
17806
|
createManagedServiceProfile: async (_learnCard, profile) => {
|
|
17739
|
-
|
|
17740
|
-
throw new Error("Please make an account first!");
|
|
17807
|
+
await ensureUser();
|
|
17741
17808
|
const newDid = await client.profile.createManagedServiceProfile.mutate(profile);
|
|
17742
17809
|
return newDid;
|
|
17743
17810
|
},
|
|
17744
17811
|
getAvailableProfiles: async (_learnCard, options = {}) => {
|
|
17745
|
-
|
|
17746
|
-
throw new Error("Please make an account first!");
|
|
17812
|
+
await ensureUser();
|
|
17747
17813
|
return client.profile.getAvailableProfiles.query(options);
|
|
17748
17814
|
},
|
|
17749
17815
|
getManagedProfiles: async (_learnCard, options = {}) => {
|
|
17750
17816
|
return client.profileManager.getManagedProfiles.query(options);
|
|
17751
17817
|
},
|
|
17752
17818
|
getManagedServiceProfiles: async (_learnCard, options = {}) => {
|
|
17753
|
-
|
|
17754
|
-
throw new Error("Please make an account first!");
|
|
17819
|
+
await ensureUser();
|
|
17755
17820
|
return client.profile.getManagedServiceProfiles.query(options);
|
|
17756
17821
|
},
|
|
17757
17822
|
updateProfile: async (_learnCard, profile) => {
|
|
17758
|
-
|
|
17759
|
-
throw new Error("Please make an account first!");
|
|
17823
|
+
await ensureUser();
|
|
17760
17824
|
const result = await client.profile.updateProfile.mutate(profile);
|
|
17761
17825
|
if (result) {
|
|
17762
17826
|
userData = await client.profile.getProfile.query();
|
|
@@ -17778,9 +17842,12 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
17778
17842
|
return false;
|
|
17779
17843
|
},
|
|
17780
17844
|
getProfile: async (_learnCard, profileId) => {
|
|
17781
|
-
|
|
17845
|
+
try {
|
|
17846
|
+
await ensureUser();
|
|
17847
|
+
} catch {
|
|
17848
|
+
}
|
|
17782
17849
|
if (!profileId)
|
|
17783
|
-
return
|
|
17850
|
+
return userData;
|
|
17784
17851
|
return client.profile.getOtherProfile.query({ profileId });
|
|
17785
17852
|
},
|
|
17786
17853
|
getProfileManagerProfile: async (_learnCard, id) => {
|
|
@@ -17803,102 +17870,84 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
17803
17870
|
});
|
|
17804
17871
|
},
|
|
17805
17872
|
connectWith: async (_learnCard, profileId) => {
|
|
17806
|
-
|
|
17807
|
-
throw new Error("Please make an account first!");
|
|
17873
|
+
await ensureUser();
|
|
17808
17874
|
return client.profile.connectWith.mutate({ profileId });
|
|
17809
17875
|
},
|
|
17810
17876
|
cancelConnectionRequest: async (_learnCard, profileId) => {
|
|
17811
|
-
|
|
17812
|
-
throw new Error("Please make an account first!");
|
|
17877
|
+
await ensureUser();
|
|
17813
17878
|
return client.profile.cancelConnectionRequest.mutate({ profileId });
|
|
17814
17879
|
},
|
|
17815
17880
|
connectWithInvite: async (_learnCard, profileId, challenge) => {
|
|
17816
|
-
|
|
17817
|
-
throw new Error("Please make an account first!");
|
|
17881
|
+
await ensureUser();
|
|
17818
17882
|
return client.profile.connectWithInvite.mutate({ profileId, challenge });
|
|
17819
17883
|
},
|
|
17820
17884
|
disconnectWith: async (_learnCard, profileId) => {
|
|
17821
|
-
|
|
17822
|
-
throw new Error("Please make an account first!");
|
|
17885
|
+
await ensureUser();
|
|
17823
17886
|
return client.profile.disconnectWith.mutate({ profileId });
|
|
17824
17887
|
},
|
|
17825
17888
|
acceptConnectionRequest: async (_learnCard, profileId) => {
|
|
17826
|
-
|
|
17827
|
-
throw new Error("Please make an account first!");
|
|
17889
|
+
await ensureUser();
|
|
17828
17890
|
return client.profile.acceptConnectionRequest.mutate({ profileId });
|
|
17829
17891
|
},
|
|
17830
17892
|
getConnections: async (_learnCard) => {
|
|
17831
17893
|
console.warn(
|
|
17832
17894
|
"The getConnections method is deprecated! Please use getPaginatedConnections instead!"
|
|
17833
17895
|
);
|
|
17834
|
-
|
|
17835
|
-
throw new Error("Please make an account first!");
|
|
17896
|
+
await ensureUser();
|
|
17836
17897
|
return client.profile.connections.query();
|
|
17837
17898
|
},
|
|
17838
17899
|
getPaginatedConnections: async (_learnCard, options) => {
|
|
17839
|
-
|
|
17840
|
-
throw new Error("Please make an account first!");
|
|
17900
|
+
await ensureUser();
|
|
17841
17901
|
return client.profile.paginatedConnections.query(options);
|
|
17842
17902
|
},
|
|
17843
17903
|
getPendingConnections: async (_learnCard) => {
|
|
17844
17904
|
console.warn(
|
|
17845
17905
|
"The getPendingConnections method is deprecated! Please use getPaginatedPendingConnections instead!"
|
|
17846
17906
|
);
|
|
17847
|
-
|
|
17848
|
-
throw new Error("Please make an account first!");
|
|
17907
|
+
await ensureUser();
|
|
17849
17908
|
return client.profile.pendingConnections.query();
|
|
17850
17909
|
},
|
|
17851
17910
|
getPaginatedPendingConnections: async (_learnCard, options) => {
|
|
17852
|
-
|
|
17853
|
-
throw new Error("Please make an account first!");
|
|
17911
|
+
await ensureUser();
|
|
17854
17912
|
return client.profile.paginatedPendingConnections.query(options);
|
|
17855
17913
|
},
|
|
17856
17914
|
getConnectionRequests: async (_learnCard) => {
|
|
17857
17915
|
console.warn(
|
|
17858
17916
|
"The getConnectionRequests method is deprecated! Please use getPaginatedConnectionRequests instead!"
|
|
17859
17917
|
);
|
|
17860
|
-
|
|
17861
|
-
throw new Error("Please make an account first!");
|
|
17918
|
+
await ensureUser();
|
|
17862
17919
|
return client.profile.connectionRequests.query();
|
|
17863
17920
|
},
|
|
17864
17921
|
getPaginatedConnectionRequests: async (_learnCard, options) => {
|
|
17865
|
-
|
|
17866
|
-
throw new Error("Please make an account first!");
|
|
17922
|
+
await ensureUser();
|
|
17867
17923
|
return client.profile.paginatedConnectionRequests.query(options);
|
|
17868
17924
|
},
|
|
17869
17925
|
generateInvite: async (_learnCard, challenge, expiration, maxUses) => {
|
|
17870
|
-
|
|
17871
|
-
throw new Error("Please make an account first!");
|
|
17926
|
+
await ensureUser();
|
|
17872
17927
|
return client.profile.generateInvite.mutate({ challenge, expiration, maxUses });
|
|
17873
17928
|
},
|
|
17874
17929
|
listInvites: async () => {
|
|
17875
|
-
|
|
17876
|
-
throw new Error("Please make an account first!");
|
|
17930
|
+
await ensureUser();
|
|
17877
17931
|
return client.profile.listInvites.query();
|
|
17878
17932
|
},
|
|
17879
17933
|
invalidateInvite: async (_learnCard, challenge) => {
|
|
17880
|
-
|
|
17881
|
-
throw new Error("Please make an account first!");
|
|
17934
|
+
await ensureUser();
|
|
17882
17935
|
return client.profile.invalidateInvite.mutate({ challenge });
|
|
17883
17936
|
},
|
|
17884
17937
|
blockProfile: async (_learnCard, profileId) => {
|
|
17885
|
-
|
|
17886
|
-
throw new Error("Please make an account first!");
|
|
17938
|
+
await ensureUser();
|
|
17887
17939
|
return client.profile.blockProfile.mutate({ profileId });
|
|
17888
17940
|
},
|
|
17889
17941
|
unblockProfile: async (_learnCard, profileId) => {
|
|
17890
|
-
|
|
17891
|
-
throw new Error("Please make an account first!");
|
|
17942
|
+
await ensureUser();
|
|
17892
17943
|
return client.profile.unblockProfile.mutate({ profileId });
|
|
17893
17944
|
},
|
|
17894
17945
|
getBlockedProfiles: async () => {
|
|
17895
|
-
|
|
17896
|
-
throw new Error("Please make an account first!");
|
|
17946
|
+
await ensureUser();
|
|
17897
17947
|
return client.profile.blocked.query();
|
|
17898
17948
|
},
|
|
17899
17949
|
sendCredential: async (_learnCard, profileId, vc, encrypt = true) => {
|
|
17900
|
-
|
|
17901
|
-
throw new Error("Please make an account first!");
|
|
17950
|
+
await ensureUser();
|
|
17902
17951
|
if (!encrypt) {
|
|
17903
17952
|
return client.credential.sendCredential.mutate({ profileId, credential: vc });
|
|
17904
17953
|
}
|
|
@@ -17906,39 +17955,33 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
17906
17955
|
if (!target)
|
|
17907
17956
|
throw new Error("Could not find target account");
|
|
17908
17957
|
const credential = await _learnCard.invoke.createDagJwe(vc, [
|
|
17909
|
-
|
|
17958
|
+
_learnCard.id.did(),
|
|
17910
17959
|
target.did
|
|
17911
17960
|
]);
|
|
17912
17961
|
return client.credential.sendCredential.mutate({ profileId, credential });
|
|
17913
17962
|
},
|
|
17914
17963
|
acceptCredential: async (_learnCard, uri, options) => {
|
|
17915
|
-
|
|
17916
|
-
throw new Error("Please make an account first!");
|
|
17964
|
+
await ensureUser();
|
|
17917
17965
|
return client.credential.acceptCredential.mutate({ uri, options });
|
|
17918
17966
|
},
|
|
17919
17967
|
getReceivedCredentials: async (_learnCard, from) => {
|
|
17920
|
-
|
|
17921
|
-
throw new Error("Please make an account first!");
|
|
17968
|
+
await ensureUser();
|
|
17922
17969
|
return client.credential.receivedCredentials.query({ from });
|
|
17923
17970
|
},
|
|
17924
17971
|
getSentCredentials: async (_learnCard, to) => {
|
|
17925
|
-
|
|
17926
|
-
throw new Error("Please make an account first!");
|
|
17972
|
+
await ensureUser();
|
|
17927
17973
|
return client.credential.sentCredentials.query({ to });
|
|
17928
17974
|
},
|
|
17929
17975
|
getIncomingCredentials: async (_learnCard, from) => {
|
|
17930
|
-
|
|
17931
|
-
throw new Error("Please make an account first!");
|
|
17976
|
+
await ensureUser();
|
|
17932
17977
|
return client.credential.incomingCredentials.query({ from });
|
|
17933
17978
|
},
|
|
17934
17979
|
deleteCredential: async (_learnCard, uri) => {
|
|
17935
|
-
|
|
17936
|
-
throw new Error("Please make an account first!");
|
|
17980
|
+
await ensureUser();
|
|
17937
17981
|
return client.credential.deleteCredential.mutate({ uri });
|
|
17938
17982
|
},
|
|
17939
17983
|
sendPresentation: async (_learnCard, profileId, vp, encrypt = true) => {
|
|
17940
|
-
|
|
17941
|
-
throw new Error("Please make an account first!");
|
|
17984
|
+
await ensureUser();
|
|
17942
17985
|
if (!encrypt) {
|
|
17943
17986
|
return client.presentation.sendPresentation.mutate({
|
|
17944
17987
|
profileId,
|
|
@@ -17949,128 +17992,106 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
17949
17992
|
if (!target)
|
|
17950
17993
|
throw new Error("Could not find target account");
|
|
17951
17994
|
const presentation = await _learnCard.invoke.createDagJwe(vp, [
|
|
17952
|
-
|
|
17995
|
+
_learnCard.id.did(),
|
|
17953
17996
|
target.did
|
|
17954
17997
|
]);
|
|
17955
17998
|
return client.presentation.sendPresentation.mutate({ profileId, presentation });
|
|
17956
17999
|
},
|
|
17957
18000
|
acceptPresentation: async (_learnCard, uri) => {
|
|
17958
|
-
|
|
17959
|
-
throw new Error("Please make an account first!");
|
|
18001
|
+
await ensureUser();
|
|
17960
18002
|
return client.presentation.acceptPresentation.mutate({ uri });
|
|
17961
18003
|
},
|
|
17962
18004
|
getReceivedPresentations: async (_learnCard, from) => {
|
|
17963
|
-
|
|
17964
|
-
throw new Error("Please make an account first!");
|
|
18005
|
+
await ensureUser();
|
|
17965
18006
|
return client.presentation.receivedPresentations.query({ from });
|
|
17966
18007
|
},
|
|
17967
18008
|
getSentPresentations: async (_learnCard, to) => {
|
|
17968
|
-
|
|
17969
|
-
throw new Error("Please make an account first!");
|
|
18009
|
+
await ensureUser();
|
|
17970
18010
|
return client.presentation.sentPresentations.query({ to });
|
|
17971
18011
|
},
|
|
17972
18012
|
getIncomingPresentations: async (_learnCard, from) => {
|
|
17973
|
-
|
|
17974
|
-
throw new Error("Please make an account first!");
|
|
18013
|
+
await ensureUser();
|
|
17975
18014
|
return client.presentation.incomingPresentations.query({ from });
|
|
17976
18015
|
},
|
|
17977
18016
|
deletePresentation: async (_learnCard, uri) => {
|
|
17978
|
-
|
|
17979
|
-
throw new Error("Please make an account first!");
|
|
18017
|
+
await ensureUser();
|
|
17980
18018
|
return client.presentation.deletePresentation.mutate({ uri });
|
|
17981
18019
|
},
|
|
17982
18020
|
createBoost: async (_learnCard, credential, metadata) => {
|
|
17983
|
-
|
|
17984
|
-
throw new Error("Please make an account first!");
|
|
18021
|
+
await ensureUser();
|
|
17985
18022
|
return client.boost.createBoost.mutate({ credential, ...metadata });
|
|
17986
18023
|
},
|
|
17987
18024
|
createChildBoost: async (_learnCard, parentUri, credential, metadata) => {
|
|
17988
|
-
|
|
17989
|
-
throw new Error("Please make an account first!");
|
|
18025
|
+
await ensureUser();
|
|
17990
18026
|
return client.boost.createChildBoost.mutate({
|
|
17991
18027
|
parentUri,
|
|
17992
18028
|
boost: { credential, ...metadata }
|
|
17993
18029
|
});
|
|
17994
18030
|
},
|
|
17995
18031
|
getBoost: async (_learnCard, uri) => {
|
|
17996
|
-
|
|
17997
|
-
throw new Error("Please make an account first!");
|
|
18032
|
+
await ensureUser();
|
|
17998
18033
|
return client.boost.getBoost.query({ uri });
|
|
17999
18034
|
},
|
|
18000
18035
|
getBoosts: async (_learnCard, query) => {
|
|
18001
18036
|
console.warn(
|
|
18002
18037
|
"The getBoosts method is deprecated! Please use getPaginatedBoosts instead!"
|
|
18003
18038
|
);
|
|
18004
|
-
|
|
18005
|
-
throw new Error("Please make an account first!");
|
|
18039
|
+
await ensureUser();
|
|
18006
18040
|
return client.boost.getBoosts.query({ query });
|
|
18007
18041
|
},
|
|
18008
18042
|
countBoosts: async (_learnCard, query) => {
|
|
18009
|
-
|
|
18010
|
-
throw new Error("Please make an account first!");
|
|
18043
|
+
await ensureUser();
|
|
18011
18044
|
return client.boost.countBoosts.query({ query });
|
|
18012
18045
|
},
|
|
18013
18046
|
getPaginatedBoosts: async (_learnCard, options) => {
|
|
18014
|
-
|
|
18015
|
-
throw new Error("Please make an account first!");
|
|
18047
|
+
await ensureUser();
|
|
18016
18048
|
return client.boost.getPaginatedBoosts.query(options);
|
|
18017
18049
|
},
|
|
18018
18050
|
getBoostChildren: async (_learnCard, uri, options) => {
|
|
18019
|
-
|
|
18020
|
-
throw new Error("Please make an account first!");
|
|
18051
|
+
await ensureUser();
|
|
18021
18052
|
return client.boost.getBoostChildren.query({ uri, ...options });
|
|
18022
18053
|
},
|
|
18023
18054
|
countBoostChildren: async (_learnCard, uri, options) => {
|
|
18024
|
-
|
|
18025
|
-
throw new Error("Please make an account first!");
|
|
18055
|
+
await ensureUser();
|
|
18026
18056
|
return client.boost.countBoostChildren.query({ uri, ...options });
|
|
18027
18057
|
},
|
|
18028
18058
|
getBoostSiblings: async (_learnCard, uri, options) => {
|
|
18029
|
-
|
|
18030
|
-
throw new Error("Please make an account first!");
|
|
18059
|
+
await ensureUser();
|
|
18031
18060
|
return client.boost.getBoostSiblings.query({ uri, ...options });
|
|
18032
18061
|
},
|
|
18033
18062
|
countBoostSiblings: async (_learnCard, uri, options) => {
|
|
18034
|
-
|
|
18035
|
-
throw new Error("Please make an account first!");
|
|
18063
|
+
await ensureUser();
|
|
18036
18064
|
return client.boost.countBoostSiblings.query({ uri, ...options });
|
|
18037
18065
|
},
|
|
18038
18066
|
getFamilialBoosts: async (_learnCard, uri, options) => {
|
|
18039
|
-
|
|
18040
|
-
throw new Error("Please make an account first!");
|
|
18067
|
+
await ensureUser();
|
|
18041
18068
|
return client.boost.getFamilialBoosts.query({ uri, ...options });
|
|
18042
18069
|
},
|
|
18043
18070
|
countFamilialBoosts: async (_learnCard, uri, options) => {
|
|
18044
|
-
|
|
18045
|
-
throw new Error("Please make an account first!");
|
|
18071
|
+
await ensureUser();
|
|
18046
18072
|
return client.boost.countFamilialBoosts.query({ uri, ...options });
|
|
18047
18073
|
},
|
|
18048
18074
|
getBoostParents: async (_learnCard, uri, options) => {
|
|
18049
|
-
|
|
18050
|
-
throw new Error("Please make an account first!");
|
|
18075
|
+
await ensureUser();
|
|
18051
18076
|
return client.boost.getBoostParents.query({ uri, ...options });
|
|
18052
18077
|
},
|
|
18053
18078
|
countBoostParents: async (_learnCard, uri, options) => {
|
|
18054
|
-
|
|
18055
|
-
throw new Error("Please make an account first!");
|
|
18079
|
+
await ensureUser();
|
|
18056
18080
|
return client.boost.countBoostParents.query({ uri, ...options });
|
|
18057
18081
|
},
|
|
18058
18082
|
makeBoostParent: async (_learnCard, uris) => {
|
|
18059
|
-
|
|
18060
|
-
throw new Error("Please make an account first!");
|
|
18083
|
+
await ensureUser();
|
|
18061
18084
|
return client.boost.makeBoostParent.mutate(uris);
|
|
18062
18085
|
},
|
|
18063
18086
|
removeBoostParent: async (_learnCard, uris) => {
|
|
18064
|
-
|
|
18065
|
-
throw new Error("Please make an account first!");
|
|
18087
|
+
await ensureUser();
|
|
18066
18088
|
return client.boost.removeBoostParent.mutate(uris);
|
|
18067
18089
|
},
|
|
18068
18090
|
getBoostRecipients: async (_learnCard, uri, limit = 25, skip = void 0, includeUnacceptedBoosts = true) => {
|
|
18069
18091
|
console.warn(
|
|
18070
18092
|
"The getBoostRecipients method is deprecated! Please use getPaginatedBoostRecipients instead!"
|
|
18071
18093
|
);
|
|
18072
|
-
|
|
18073
|
-
throw new Error("Please make an account first!");
|
|
18094
|
+
await ensureUser();
|
|
18074
18095
|
return client.boost.getBoostRecipients.query({
|
|
18075
18096
|
uri,
|
|
18076
18097
|
limit,
|
|
@@ -18079,8 +18100,7 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
18079
18100
|
});
|
|
18080
18101
|
},
|
|
18081
18102
|
getPaginatedBoostRecipients: async (_learnCard, uri, limit = 25, cursor = void 0, includeUnacceptedBoosts = true, query) => {
|
|
18082
|
-
|
|
18083
|
-
throw new Error("Please make an account first!");
|
|
18103
|
+
await ensureUser();
|
|
18084
18104
|
return client.boost.getPaginatedBoostRecipients.query({
|
|
18085
18105
|
uri,
|
|
18086
18106
|
limit,
|
|
@@ -18090,8 +18110,7 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
18090
18110
|
});
|
|
18091
18111
|
},
|
|
18092
18112
|
getPaginatedBoostRecipientsWithChildren: async (_learnCard, uri, limit = 25, cursor = void 0, includeUnacceptedBoosts = true, boostQuery, profileQuery, numberOfGenerations = 1) => {
|
|
18093
|
-
|
|
18094
|
-
throw new Error("Please make an account first!");
|
|
18113
|
+
await ensureUser();
|
|
18095
18114
|
return client.boost.getPaginatedBoostRecipientsWithChildren.query({
|
|
18096
18115
|
uri,
|
|
18097
18116
|
limit,
|
|
@@ -18114,13 +18133,11 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
18114
18133
|
});
|
|
18115
18134
|
},
|
|
18116
18135
|
countBoostRecipients: async (_learnCard, uri, includeUnacceptedBoosts = true) => {
|
|
18117
|
-
|
|
18118
|
-
throw new Error("Please make an account first!");
|
|
18136
|
+
await ensureUser();
|
|
18119
18137
|
return client.boost.getBoostRecipientCount.query({ uri, includeUnacceptedBoosts });
|
|
18120
18138
|
},
|
|
18121
18139
|
getConnectedBoostRecipients: async (_learnCard, uri, { limit = 25, cursor = void 0, includeUnacceptedBoosts = true, query } = {}) => {
|
|
18122
|
-
|
|
18123
|
-
throw new Error("Please make an account first!");
|
|
18140
|
+
await ensureUser();
|
|
18124
18141
|
return client.boost.getConnectedBoostRecipients.query({
|
|
18125
18142
|
uri,
|
|
18126
18143
|
limit,
|
|
@@ -18130,41 +18147,35 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
18130
18147
|
});
|
|
18131
18148
|
},
|
|
18132
18149
|
countConnectedBoostRecipients: async (_learnCard, uri, includeUnacceptedBoosts = true) => {
|
|
18133
|
-
|
|
18134
|
-
throw new Error("Please make an account first!");
|
|
18150
|
+
await ensureUser();
|
|
18135
18151
|
return client.boost.getConnectedBoostRecipientCount.query({
|
|
18136
18152
|
uri,
|
|
18137
18153
|
includeUnacceptedBoosts
|
|
18138
18154
|
});
|
|
18139
18155
|
},
|
|
18140
18156
|
getBoostChildrenProfileManagers: async (_learnCard, uri, options) => {
|
|
18141
|
-
|
|
18142
|
-
throw new Error("Please make an account first!");
|
|
18157
|
+
await ensureUser();
|
|
18143
18158
|
return client.boost.getChildrenProfileManagers.query({ uri, ...options });
|
|
18144
18159
|
},
|
|
18145
18160
|
updateBoost: async (_learnCard, uri, updates, credential) => {
|
|
18146
|
-
|
|
18147
|
-
throw new Error("Please make an account first!");
|
|
18161
|
+
await ensureUser();
|
|
18148
18162
|
return client.boost.updateBoost.mutate({
|
|
18149
18163
|
uri,
|
|
18150
18164
|
updates: { ...credential && { credential }, ...updates }
|
|
18151
18165
|
});
|
|
18152
18166
|
},
|
|
18153
18167
|
getBoostAdmins: async (_learnCard, uri, options = {}) => {
|
|
18154
|
-
|
|
18155
|
-
throw new Error("Please make an account first!");
|
|
18168
|
+
await ensureUser();
|
|
18156
18169
|
return client.boost.getBoostAdmins.query({ uri, ...options });
|
|
18157
18170
|
},
|
|
18158
18171
|
getBoostPermissions: async (_learnCard, uri, profileId) => {
|
|
18159
|
-
|
|
18160
|
-
throw new Error("Please make an account first!");
|
|
18172
|
+
await ensureUser();
|
|
18161
18173
|
if (!profileId)
|
|
18162
18174
|
return client.boost.getBoostPermissions.query({ uri });
|
|
18163
18175
|
return client.boost.getOtherBoostPermissions.query({ uri, profileId });
|
|
18164
18176
|
},
|
|
18165
18177
|
updateBoostPermissions: async (_learnCard, uri, updates, profileId) => {
|
|
18166
|
-
|
|
18167
|
-
throw new Error("Please make an account first!");
|
|
18178
|
+
await ensureUser();
|
|
18168
18179
|
if (!profileId)
|
|
18169
18180
|
return client.boost.updateBoostPermissions.query({ uri, updates });
|
|
18170
18181
|
const result = await client.boost.updateOtherBoostPermissions.query({
|
|
@@ -18177,29 +18188,25 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
18177
18188
|
return result;
|
|
18178
18189
|
},
|
|
18179
18190
|
addBoostAdmin: async (_learnCard, uri, profileId) => {
|
|
18180
|
-
|
|
18181
|
-
throw new Error("Please make an account first!");
|
|
18191
|
+
await ensureUser();
|
|
18182
18192
|
const result = await client.boost.addBoostAdmin.mutate({ uri, profileId });
|
|
18183
18193
|
if (result)
|
|
18184
18194
|
await _learnCard.invoke.clearDidWebCache?.();
|
|
18185
18195
|
return result;
|
|
18186
18196
|
},
|
|
18187
18197
|
removeBoostAdmin: async (_learnCard, uri, profileId) => {
|
|
18188
|
-
|
|
18189
|
-
throw new Error("Please make an account first!");
|
|
18198
|
+
await ensureUser();
|
|
18190
18199
|
const result = await client.boost.removeBoostAdmin.mutate({ uri, profileId });
|
|
18191
18200
|
if (result)
|
|
18192
18201
|
await _learnCard.invoke.clearDidWebCache?.();
|
|
18193
18202
|
return result;
|
|
18194
18203
|
},
|
|
18195
18204
|
deleteBoost: async (_learnCard, uri) => {
|
|
18196
|
-
|
|
18197
|
-
throw new Error("Please make an account first!");
|
|
18205
|
+
await ensureUser();
|
|
18198
18206
|
return client.boost.deleteBoost.mutate({ uri });
|
|
18199
18207
|
},
|
|
18200
18208
|
sendBoost: async (_learnCard, profileId, boostUri, options = { encrypt: true, skipNotification: false }) => {
|
|
18201
|
-
|
|
18202
|
-
throw new Error("Please make an account first!");
|
|
18209
|
+
await ensureUser();
|
|
18203
18210
|
const result = await _learnCard.invoke.resolveFromLCN(boostUri);
|
|
18204
18211
|
const data = await UnsignedVCValidator.spa(result);
|
|
18205
18212
|
if (!data.success)
|
|
@@ -18240,7 +18247,7 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
18240
18247
|
}
|
|
18241
18248
|
const lcnDid = await client.utilities.getDid.query();
|
|
18242
18249
|
const credential = await _learnCard.invoke.createDagJwe(vc, [
|
|
18243
|
-
|
|
18250
|
+
_learnCard.id.did(),
|
|
18244
18251
|
targetProfile.did,
|
|
18245
18252
|
lcnDid
|
|
18246
18253
|
]);
|
|
@@ -18254,37 +18261,31 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
18254
18261
|
});
|
|
18255
18262
|
},
|
|
18256
18263
|
registerSigningAuthority: async (_learnCard, endpoint, name, _did) => {
|
|
18257
|
-
|
|
18258
|
-
throw new Error("Please make an account first!");
|
|
18264
|
+
await ensureUser();
|
|
18259
18265
|
return client.profile.registerSigningAuthority.mutate({
|
|
18260
18266
|
endpoint,
|
|
18261
18267
|
name,
|
|
18262
18268
|
did: _did
|
|
18263
18269
|
});
|
|
18264
18270
|
},
|
|
18265
|
-
getRegisteredSigningAuthorities: async (_learnCard
|
|
18266
|
-
|
|
18267
|
-
throw new Error("Please make an account first!");
|
|
18271
|
+
getRegisteredSigningAuthorities: async (_learnCard) => {
|
|
18272
|
+
await ensureUser();
|
|
18268
18273
|
return client.profile.signingAuthorities.query();
|
|
18269
18274
|
},
|
|
18270
18275
|
getRegisteredSigningAuthority: async (_learnCard, endpoint, name) => {
|
|
18271
|
-
|
|
18272
|
-
throw new Error("Please make an account first!");
|
|
18276
|
+
await ensureUser();
|
|
18273
18277
|
return client.profile.signingAuthority.query({ endpoint, name });
|
|
18274
18278
|
},
|
|
18275
18279
|
setPrimaryRegisteredSigningAuthority: async (_learnCard, endpoint, name) => {
|
|
18276
|
-
|
|
18277
|
-
throw new Error("Please make an account first!");
|
|
18280
|
+
await ensureUser();
|
|
18278
18281
|
return client.profile.setPrimarySigningAuthority.mutate({ endpoint, name });
|
|
18279
18282
|
},
|
|
18280
18283
|
getPrimaryRegisteredSigningAuthority: async (_learnCard) => {
|
|
18281
|
-
|
|
18282
|
-
throw new Error("Please make an account first!");
|
|
18284
|
+
await ensureUser();
|
|
18283
18285
|
return client.profile.primarySigningAuthority.query();
|
|
18284
18286
|
},
|
|
18285
18287
|
generateClaimLink: async (_learnCard, boostUri, claimLinkSA, options, challenge) => {
|
|
18286
|
-
|
|
18287
|
-
throw new Error("Please make an account first!");
|
|
18288
|
+
await ensureUser();
|
|
18288
18289
|
return client.boost.generateClaimLink.mutate({
|
|
18289
18290
|
boostUri,
|
|
18290
18291
|
claimLinkSA,
|
|
@@ -18293,23 +18294,19 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
18293
18294
|
});
|
|
18294
18295
|
},
|
|
18295
18296
|
claimBoostWithLink: async (_learnCard, boostUri, challenge) => {
|
|
18296
|
-
|
|
18297
|
-
throw new Error("Please make an account first!");
|
|
18297
|
+
await ensureUser();
|
|
18298
18298
|
return client.boost.claimBoostWithLink.mutate({ boostUri, challenge });
|
|
18299
18299
|
},
|
|
18300
18300
|
createContract: async (_learnCard, contract) => {
|
|
18301
|
-
|
|
18302
|
-
throw new Error("Please make an account first!");
|
|
18301
|
+
await ensureUser();
|
|
18303
18302
|
return client.contracts.createConsentFlowContract.mutate(contract);
|
|
18304
18303
|
},
|
|
18305
18304
|
addAutoBoostsToContract: async (_learnCard, contractUri, autoboosts) => {
|
|
18306
|
-
|
|
18307
|
-
throw new Error("Please make an account first!");
|
|
18305
|
+
await ensureUser();
|
|
18308
18306
|
return client.contracts.addAutoBoostsToContract.mutate({ contractUri, autoboosts });
|
|
18309
18307
|
},
|
|
18310
18308
|
removeAutoBoostsFromContract: async (_learnCard, contractUri, boostUris) => {
|
|
18311
|
-
|
|
18312
|
-
throw new Error("Please make an account first!");
|
|
18309
|
+
await ensureUser();
|
|
18313
18310
|
return client.contracts.removeAutoBoostsFromContract.mutate({
|
|
18314
18311
|
contractUri,
|
|
18315
18312
|
boostUris
|
|
@@ -18319,33 +18316,27 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
18319
18316
|
return client.contracts.getConsentFlowContract.query({ uri });
|
|
18320
18317
|
},
|
|
18321
18318
|
getContracts: async (_learnCard, options) => {
|
|
18322
|
-
|
|
18323
|
-
throw new Error("Please make an account first!");
|
|
18319
|
+
await ensureUser();
|
|
18324
18320
|
return client.contracts.getConsentFlowContracts.query(options);
|
|
18325
18321
|
},
|
|
18326
18322
|
deleteContract: async (_learnCard, uri) => {
|
|
18327
|
-
|
|
18328
|
-
throw new Error("Please make an account first!");
|
|
18323
|
+
await ensureUser();
|
|
18329
18324
|
return client.contracts.deleteConsentFlowContract.mutate({ uri });
|
|
18330
18325
|
},
|
|
18331
18326
|
getConsentFlowData: async (_learnCard, uri, options = {}) => {
|
|
18332
|
-
|
|
18333
|
-
throw new Error("Please make an account first!");
|
|
18327
|
+
await ensureUser();
|
|
18334
18328
|
return client.contracts.getConsentedDataForContract.query({ uri, ...options });
|
|
18335
18329
|
},
|
|
18336
18330
|
getConsentFlowDataForDid: async (_learnCard, did2, options = {}) => {
|
|
18337
|
-
|
|
18338
|
-
throw new Error("Please make an account first!");
|
|
18331
|
+
await ensureUser();
|
|
18339
18332
|
return client.contracts.getConsentedDataForDid.query({ did: did2, ...options });
|
|
18340
18333
|
},
|
|
18341
18334
|
getAllConsentFlowData: async (_learnCard, query = {}, options = {}) => {
|
|
18342
|
-
|
|
18343
|
-
throw new Error("Please make an account first!");
|
|
18335
|
+
await ensureUser();
|
|
18344
18336
|
return client.contracts.getConsentedData.query({ query, ...options });
|
|
18345
18337
|
},
|
|
18346
18338
|
writeCredentialToContract: async (_learnCard, did2, contractUri, credential, boostUri) => {
|
|
18347
|
-
|
|
18348
|
-
throw new Error("Please make an account first!");
|
|
18339
|
+
await ensureUser();
|
|
18349
18340
|
return client.contracts.writeCredentialToContract.mutate({
|
|
18350
18341
|
did: did2,
|
|
18351
18342
|
contractUri,
|
|
@@ -18354,8 +18345,7 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
18354
18345
|
});
|
|
18355
18346
|
},
|
|
18356
18347
|
consentToContract: async (_learnCard, contractUri, { terms, expiresAt, oneTime }, recipientToken) => {
|
|
18357
|
-
|
|
18358
|
-
throw new Error("Please make an account first!");
|
|
18348
|
+
await ensureUser();
|
|
18359
18349
|
return client.contracts.consentToContract.mutate({
|
|
18360
18350
|
contractUri,
|
|
18361
18351
|
terms,
|
|
@@ -18365,13 +18355,11 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
18365
18355
|
});
|
|
18366
18356
|
},
|
|
18367
18357
|
getConsentedContracts: async (_learnCard, options) => {
|
|
18368
|
-
|
|
18369
|
-
throw new Error("Please make an account first!");
|
|
18358
|
+
await ensureUser();
|
|
18370
18359
|
return client.contracts.getConsentedContracts.query(options);
|
|
18371
18360
|
},
|
|
18372
18361
|
updateContractTerms: async (_learnCard, uri, { terms, expiresAt, oneTime }) => {
|
|
18373
|
-
|
|
18374
|
-
throw new Error("Please make an account first!");
|
|
18362
|
+
await ensureUser();
|
|
18375
18363
|
return client.contracts.updateConsentedContractTerms.mutate({
|
|
18376
18364
|
uri,
|
|
18377
18365
|
terms,
|
|
@@ -18380,118 +18368,99 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
18380
18368
|
});
|
|
18381
18369
|
},
|
|
18382
18370
|
withdrawConsent: async (_learnCard, uri) => {
|
|
18383
|
-
|
|
18384
|
-
throw new Error("Please make an account first!");
|
|
18371
|
+
await ensureUser();
|
|
18385
18372
|
return client.contracts.withdrawConsent.mutate({ uri });
|
|
18386
18373
|
},
|
|
18387
18374
|
getConsentFlowTransactions: async (_learnCard, uri, options) => {
|
|
18388
|
-
|
|
18389
|
-
throw new Error("Please make an account first!");
|
|
18375
|
+
await ensureUser();
|
|
18390
18376
|
return client.contracts.getTermsTransactionHistory.query({ uri, ...options });
|
|
18391
18377
|
},
|
|
18392
18378
|
getCredentialsForContract: async (_learnCard, termsUri, options = {}) => {
|
|
18393
|
-
|
|
18394
|
-
throw new Error("Please make an account first!");
|
|
18379
|
+
await ensureUser();
|
|
18395
18380
|
return client.contracts.getCredentialsForContract.query({ termsUri, ...options });
|
|
18396
18381
|
},
|
|
18397
18382
|
getConsentFlowCredentials: async (_learnCard, options = {}) => {
|
|
18398
|
-
|
|
18399
|
-
throw new Error("Please make an account first!");
|
|
18383
|
+
await ensureUser();
|
|
18400
18384
|
return client.contracts.getAllCredentialsForTerms.query(options);
|
|
18401
18385
|
},
|
|
18402
18386
|
verifyConsent: async (_learnCard, uri, profileId) => {
|
|
18387
|
+
await ensureUser();
|
|
18403
18388
|
return client.contracts.verifyConsent.query({ uri, profileId });
|
|
18404
18389
|
},
|
|
18405
18390
|
syncCredentialsToContract: async (_learnCard, termsUri, categories) => {
|
|
18406
|
-
|
|
18407
|
-
throw new Error("Please make an account first!");
|
|
18391
|
+
await ensureUser();
|
|
18408
18392
|
return client.contracts.syncCredentialsToContract.mutate({
|
|
18409
18393
|
termsUri,
|
|
18410
18394
|
categories
|
|
18411
18395
|
});
|
|
18412
18396
|
},
|
|
18413
18397
|
addDidMetadata: async (_learnCard, metadata) => {
|
|
18414
|
-
|
|
18415
|
-
throw new Error("Please make an account first!");
|
|
18398
|
+
await ensureUser();
|
|
18416
18399
|
const result = await client.didMetadata.addDidMetadata.mutate(metadata);
|
|
18417
18400
|
if (result)
|
|
18418
18401
|
await _learnCard.invoke.clearDidWebCache?.();
|
|
18419
18402
|
return result;
|
|
18420
18403
|
},
|
|
18421
18404
|
getDidMetadata: async (_learnCard, id) => {
|
|
18422
|
-
|
|
18423
|
-
throw new Error("Please make an account first!");
|
|
18405
|
+
await ensureUser();
|
|
18424
18406
|
return client.didMetadata.getDidMetadata.query({ id });
|
|
18425
18407
|
},
|
|
18426
18408
|
getMyDidMetadata: async () => {
|
|
18427
|
-
|
|
18428
|
-
throw new Error("Please make an account first!");
|
|
18409
|
+
await ensureUser();
|
|
18429
18410
|
return client.didMetadata.getMyDidMetadata.query();
|
|
18430
18411
|
},
|
|
18431
18412
|
updateDidMetadata: async (_learnCard, id, updates) => {
|
|
18432
|
-
|
|
18433
|
-
throw new Error("Please make an account first!");
|
|
18413
|
+
await ensureUser();
|
|
18434
18414
|
const result = await client.didMetadata.updateDidMetadata.mutate({ id, updates });
|
|
18435
18415
|
if (result)
|
|
18436
18416
|
await _learnCard.invoke.clearDidWebCache?.();
|
|
18437
18417
|
return result;
|
|
18438
18418
|
},
|
|
18439
18419
|
deleteDidMetadata: async (_learnCard, id) => {
|
|
18440
|
-
|
|
18441
|
-
throw new Error("Please make an account first!");
|
|
18420
|
+
await ensureUser();
|
|
18442
18421
|
const result = await client.didMetadata.deleteDidMetadata.mutate({ id });
|
|
18443
18422
|
if (result)
|
|
18444
18423
|
await _learnCard.invoke.clearDidWebCache?.();
|
|
18445
18424
|
return result;
|
|
18446
18425
|
},
|
|
18447
18426
|
createClaimHook: async (_learnCard, hook) => {
|
|
18448
|
-
|
|
18449
|
-
throw new Error("Please make an account first!");
|
|
18427
|
+
await ensureUser();
|
|
18450
18428
|
return client.claimHook.createClaimHook.mutate({ hook });
|
|
18451
18429
|
},
|
|
18452
18430
|
getClaimHooksForBoost: async (_learnCard, options) => {
|
|
18453
|
-
|
|
18454
|
-
throw new Error("Please make an account first!");
|
|
18431
|
+
await ensureUser();
|
|
18455
18432
|
return client.claimHook.getClaimHooksForBoost.query(options);
|
|
18456
18433
|
},
|
|
18457
18434
|
deleteClaimHook: async (_learnCard, id) => {
|
|
18458
|
-
|
|
18459
|
-
throw new Error("Please make an account first!");
|
|
18435
|
+
await ensureUser();
|
|
18460
18436
|
return client.claimHook.deleteClaimHook.mutate({ id });
|
|
18461
18437
|
},
|
|
18462
18438
|
addAuthGrant: async (_learnCard, authGrant) => {
|
|
18463
|
-
|
|
18464
|
-
throw new Error("Please make an account first!");
|
|
18439
|
+
await ensureUser();
|
|
18465
18440
|
return client.authGrants.addAuthGrant.mutate(authGrant);
|
|
18466
18441
|
},
|
|
18467
18442
|
revokeAuthGrant: async (_learnCard, id) => {
|
|
18468
|
-
|
|
18469
|
-
throw new Error("Please make an account first!");
|
|
18443
|
+
await ensureUser();
|
|
18470
18444
|
return client.authGrants.revokeAuthGrant.mutate({ id });
|
|
18471
18445
|
},
|
|
18472
18446
|
deleteAuthGrant: async (_learnCard, id) => {
|
|
18473
|
-
|
|
18474
|
-
throw new Error("Please make an account first!");
|
|
18447
|
+
await ensureUser();
|
|
18475
18448
|
return client.authGrants.deleteAuthGrant.mutate({ id });
|
|
18476
18449
|
},
|
|
18477
18450
|
updateAuthGrant: async (_learnCard, id, updates) => {
|
|
18478
|
-
|
|
18479
|
-
throw new Error("Please make an account first!");
|
|
18451
|
+
await ensureUser();
|
|
18480
18452
|
return client.authGrants.updateAuthGrant.mutate({ id, updates });
|
|
18481
18453
|
},
|
|
18482
18454
|
getAuthGrant: async (_learnCard, id) => {
|
|
18483
|
-
|
|
18484
|
-
throw new Error("Please make an account first!");
|
|
18455
|
+
await ensureUser();
|
|
18485
18456
|
return client.authGrants.getAuthGrant.query({ id });
|
|
18486
18457
|
},
|
|
18487
18458
|
getAuthGrants: async (_learnCard, options) => {
|
|
18488
|
-
|
|
18489
|
-
throw new Error("Please make an account first!");
|
|
18459
|
+
await ensureUser();
|
|
18490
18460
|
return client.authGrants.getAuthGrants.query(options);
|
|
18491
18461
|
},
|
|
18492
18462
|
getAPITokenForAuthGrant: async (_learnCard, id) => {
|
|
18493
|
-
|
|
18494
|
-
throw new Error("Please make an account first!");
|
|
18463
|
+
await ensureUser();
|
|
18495
18464
|
const authGrant = await client.authGrants.getAuthGrant.query({ id });
|
|
18496
18465
|
if (!authGrant)
|
|
18497
18466
|
throw new Error("Auth grant not found");
|
|
@@ -18503,52 +18472,44 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
18503
18472
|
throw new Error("Auth grant has no scope");
|
|
18504
18473
|
if (authGrant.expiresAt && new Date(authGrant.expiresAt) < new Date())
|
|
18505
18474
|
throw new Error("Auth grant is expired");
|
|
18506
|
-
const
|
|
18475
|
+
const apiToken2 = await _learnCard.invoke.getDidAuthVp({
|
|
18507
18476
|
challenge: authGrant.challenge,
|
|
18508
18477
|
proofFormat: "jwt"
|
|
18509
18478
|
});
|
|
18510
|
-
if (!
|
|
18479
|
+
if (!apiToken2)
|
|
18511
18480
|
throw new Error("Failed to get API Token for auth grant");
|
|
18512
|
-
return
|
|
18481
|
+
return apiToken2;
|
|
18513
18482
|
},
|
|
18514
18483
|
sendCredentialViaInbox: async (_learnCard, issueInboxCredential) => {
|
|
18515
|
-
|
|
18516
|
-
throw new Error("Please make an account first!");
|
|
18484
|
+
await ensureUser();
|
|
18517
18485
|
return client.inbox.issue.mutate(issueInboxCredential);
|
|
18518
18486
|
},
|
|
18519
18487
|
getMySentInboxCredentials: async (_learnCard, options) => {
|
|
18520
|
-
|
|
18521
|
-
throw new Error("Please make an account first!");
|
|
18488
|
+
await ensureUser();
|
|
18522
18489
|
return client.inbox.getMyIssuedCredentials.query(options);
|
|
18523
18490
|
},
|
|
18524
18491
|
getInboxCredential: async (_learnCard, id) => {
|
|
18525
|
-
|
|
18526
|
-
throw new Error("Please make an account first!");
|
|
18492
|
+
await ensureUser();
|
|
18527
18493
|
return client.inbox.getInboxCredential.query({ credentialId: id });
|
|
18528
18494
|
},
|
|
18529
18495
|
addContactMethod: async (_learnCard, contactMethod) => {
|
|
18530
|
-
|
|
18531
|
-
throw new Error("Please make an account first!");
|
|
18496
|
+
await ensureUser();
|
|
18532
18497
|
return client.contactMethods.addContactMethod.mutate(contactMethod);
|
|
18533
18498
|
},
|
|
18534
18499
|
getMyContactMethods: async (_learnCard) => {
|
|
18535
|
-
|
|
18536
|
-
throw new Error("Please make an account first!");
|
|
18500
|
+
await ensureUser();
|
|
18537
18501
|
return client.contactMethods.getMyContactMethods.query();
|
|
18538
18502
|
},
|
|
18539
18503
|
setPrimaryContactMethod: async (_learnCard, contactMethodId) => {
|
|
18540
|
-
|
|
18541
|
-
throw new Error("Please make an account first!");
|
|
18504
|
+
await ensureUser();
|
|
18542
18505
|
return client.contactMethods.setPrimaryContactMethod.mutate({ contactMethodId });
|
|
18543
18506
|
},
|
|
18544
18507
|
verifyContactMethod: async (_learnCard, token) => {
|
|
18545
|
-
|
|
18546
|
-
throw new Error("Please make an account first!");
|
|
18508
|
+
await ensureUser();
|
|
18547
18509
|
return client.contactMethods.verifyContactMethod.mutate({ token });
|
|
18548
18510
|
},
|
|
18549
18511
|
removeContactMethod: async (_learnCard, id) => {
|
|
18550
|
-
|
|
18551
|
-
throw new Error("Please make an account first!");
|
|
18512
|
+
await ensureUser();
|
|
18552
18513
|
return client.contactMethods.removeContactMethod.mutate({ id });
|
|
18553
18514
|
},
|
|
18554
18515
|
resolveFromLCN: async (_learnCard, uri) => {
|
|
@@ -18558,7 +18519,8 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
18558
18519
|
getLCNClient: () => client
|
|
18559
18520
|
}
|
|
18560
18521
|
};
|
|
18561
|
-
}
|
|
18522
|
+
}
|
|
18523
|
+
__name(getLearnCardNetworkPlugin, "getLearnCardNetworkPlugin");
|
|
18562
18524
|
var getVerifyBoostPlugin = /* @__PURE__ */ __name(async (learnCard, trustedBoostRegistryUrl) => {
|
|
18563
18525
|
const DEFAULT_TRUSTED_BOOST_REGISTRY = [
|
|
18564
18526
|
{
|