signet-login 0.10.4 → 0.10.5

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/modal.js CHANGED
@@ -888,6 +888,10 @@ function resolveRelayUrls(opts) {
888
888
  const cleanRelayUrls = relayUrls.map(relay => relay.trim()).filter(Boolean);
889
889
  return cleanRelayUrls.length > 0 ? cleanRelayUrls : [DEFAULTS.relayUrl];
890
890
  }
891
+ function resolvePrimaryRelayUrl(opts, relayUrls) {
892
+ const relayUrl = opts.relayUrl?.trim();
893
+ return relayUrl || relayUrls[0] || DEFAULTS.relayUrl;
894
+ }
891
895
  function resolveOptions(opts) {
892
896
  const challenge = opts.challenge ?? generateChallenge();
893
897
  if (!/^[0-9a-f]{64}$/i.test(challenge))
@@ -895,6 +899,7 @@ function resolveOptions(opts) {
895
899
  const origin = typeof window !== 'undefined' ? window.location.origin : 'http://localhost';
896
900
  const timeout = Math.max(5000, Math.min(opts.timeout ?? DEFAULTS.timeout, 600000));
897
901
  const relayUrls = resolveRelayUrls(opts);
902
+ const relayUrl = resolvePrimaryRelayUrl(opts, relayUrls);
898
903
  const methodConfig = resolveMethodConfig(opts);
899
904
  const result = {
900
905
  appName: opts.appName,
@@ -902,7 +907,7 @@ function resolveOptions(opts) {
902
907
  origin,
903
908
  methods: methodConfig.methods,
904
909
  advancedMethods: methodConfig.advancedMethods,
905
- relayUrl: relayUrls[0],
910
+ relayUrl,
906
911
  relayUrls,
907
912
  nostrConnectPerms: opts.nostrConnectPerms ?? DEFAULT_NOSTR_CONNECT_PERMS,
908
913
  theme: opts.theme ?? DEFAULTS.theme,