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