@learncard/network-plugin 2.2.3 → 2.3.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.
@@ -5493,7 +5493,7 @@ var getClient = /* @__PURE__ */ __name2(async (url, didAuthFunction) => {
5493
5493
  const getChallenges = /* @__PURE__ */ __name2(async (amount = 95 + Math.round((Math.random() - 0.5) * 5)) => {
5494
5494
  return challengeRequester.utilities.getChallenges.query({ amount });
5495
5495
  }, "getChallenges");
5496
- challenges = await getChallenges();
5496
+ getChallenges().then((result) => challenges = result);
5497
5497
  const trpc = createTRPCProxyClient({
5498
5498
  transformer: {
5499
5499
  input: import_helpers.RegExpTransformer,
@@ -9554,7 +9554,7 @@ var LCNNotificationValidator = mod.object({
9554
9554
 
9555
9555
  // src/plugin.ts
9556
9556
  var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) => {
9557
- const existingDid = learnCard.id.did();
9557
+ let did = learnCard.id.did();
9558
9558
  learnCard?.debug?.("Adding LearnCardNetwork Plugin");
9559
9559
  const client = await getClient(url, async (challenge) => {
9560
9560
  const jwt = await learnCard.invoke.getDidAuthVp({ proofFormat: "jwt", challenge });
@@ -9563,12 +9563,11 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
9563
9563
  return jwt;
9564
9564
  });
9565
9565
  let userData;
9566
- try {
9567
- userData = await client.profile.getProfile.query();
9568
- } catch (error) {
9569
- learnCard.debug?.("No profile!", error);
9570
- }
9571
- let did = userData?.did || existingDid;
9566
+ const initialQuery = client.profile.getProfile.query().then((result) => {
9567
+ userData = result;
9568
+ if (userData?.did)
9569
+ did = userData.did;
9570
+ });
9572
9571
  return {
9573
9572
  name: "LearnCard Network",
9574
9573
  displayName: "LearnCard Network",
@@ -9664,6 +9663,7 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
9664
9663
  return false;
9665
9664
  },
9666
9665
  getProfile: async (_learnCard, profileId) => {
9666
+ await initialQuery;
9667
9667
  if (!profileId)
9668
9668
  return client.profile.getProfile.query();
9669
9669
  return client.profile.getOtherProfile.query({ profileId });