@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.
@@ -5518,7 +5518,7 @@ var getClient = /* @__PURE__ */ __name2(async (url, didAuthFunction) => {
5518
5518
  const getChallenges = /* @__PURE__ */ __name2(async (amount = 95 + Math.round((Math.random() - 0.5) * 5)) => {
5519
5519
  return challengeRequester.utilities.getChallenges.query({ amount });
5520
5520
  }, "getChallenges");
5521
- challenges = await getChallenges();
5521
+ getChallenges().then((result) => challenges = result);
5522
5522
  const trpc = createTRPCProxyClient({
5523
5523
  transformer: {
5524
5524
  input: import_helpers.RegExpTransformer,
@@ -9579,7 +9579,7 @@ var LCNNotificationValidator = mod.object({
9579
9579
 
9580
9580
  // src/plugin.ts
9581
9581
  var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) => {
9582
- const existingDid = learnCard.id.did();
9582
+ let did = learnCard.id.did();
9583
9583
  learnCard?.debug?.("Adding LearnCardNetwork Plugin");
9584
9584
  const client = await getClient(url, async (challenge) => {
9585
9585
  const jwt = await learnCard.invoke.getDidAuthVp({ proofFormat: "jwt", challenge });
@@ -9588,12 +9588,11 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
9588
9588
  return jwt;
9589
9589
  });
9590
9590
  let userData;
9591
- try {
9592
- userData = await client.profile.getProfile.query();
9593
- } catch (error) {
9594
- learnCard.debug?.("No profile!", error);
9595
- }
9596
- let did = userData?.did || existingDid;
9591
+ const initialQuery = client.profile.getProfile.query().then((result) => {
9592
+ userData = result;
9593
+ if (userData?.did)
9594
+ did = userData.did;
9595
+ });
9597
9596
  return {
9598
9597
  name: "LearnCard Network",
9599
9598
  displayName: "LearnCard Network",
@@ -9689,6 +9688,7 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
9689
9688
  return false;
9690
9689
  },
9691
9690
  getProfile: async (_learnCard, profileId) => {
9691
+ await initialQuery;
9692
9692
  if (!profileId)
9693
9693
  return client.profile.getProfile.query();
9694
9694
  return client.profile.getOtherProfile.query({ profileId });