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