@dubsdotapp/expo 0.2.15 → 0.2.17

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/index.mjs CHANGED
@@ -745,11 +745,14 @@ var DeeplinkHandler = class {
745
745
  console.log(TAG, "No pending requests to resolve \u2014 redirect may have arrived late");
746
746
  }
747
747
  }
748
- /** Try to extract a request ID from the URL path segment after the redirect base. */
748
+ /** Extract the request ID from the dubs_rid query parameter. */
749
749
  extractRequestId(url) {
750
- const afterBase = url.slice(this.redirectBase.length);
751
- const match = afterBase.match(/^\/?([a-zA-Z0-9_-]+)/);
752
- return match?.[1] ?? null;
750
+ try {
751
+ const parsed = new URL(url);
752
+ return parsed.searchParams.get("dubs_rid");
753
+ } catch {
754
+ return null;
755
+ }
753
756
  }
754
757
  };
755
758
 
@@ -822,7 +825,7 @@ var PhantomDeeplinkAdapter = class {
822
825
  const dappPubBase58 = bs582.encode(this._dappKeyPair.publicKey);
823
826
  console.log(TAG2, "Dapp public key:", dappPubBase58);
824
827
  const requestId = nextRequestId();
825
- const redirectLink = `${this.config.redirectUri}/${requestId}`;
828
+ const redirectLink = `${this.config.redirectUri}?dubs_rid=${requestId}`;
826
829
  console.log(TAG2, `connect() requestId=${requestId} redirectLink=${redirectLink}`);
827
830
  const appUrl = this.config.appUrl || this.config.redirectUri;
828
831
  console.log(TAG2, "Using app_url:", appUrl);
@@ -883,7 +886,7 @@ var PhantomDeeplinkAdapter = class {
883
886
  this._sharedSecret
884
887
  );
885
888
  const requestId = nextRequestId();
886
- const redirectLink = `${this.config.redirectUri}/${requestId}`;
889
+ const redirectLink = `${this.config.redirectUri}?dubs_rid=${requestId}`;
887
890
  console.log(TAG2, `signTransaction() requestId=${requestId}`);
888
891
  const params = new URLSearchParams({
889
892
  dapp_encryption_public_key: bs582.encode(this._dappKeyPair.publicKey),
@@ -915,7 +918,7 @@ var PhantomDeeplinkAdapter = class {
915
918
  this._sharedSecret
916
919
  );
917
920
  const requestId = nextRequestId();
918
- const redirectLink = `${this.config.redirectUri}/${requestId}`;
921
+ const redirectLink = `${this.config.redirectUri}?dubs_rid=${requestId}`;
919
922
  console.log(TAG2, `signAndSendTransaction() requestId=${requestId}`);
920
923
  const params = new URLSearchParams({
921
924
  dapp_encryption_public_key: bs582.encode(this._dappKeyPair.publicKey),
@@ -938,12 +941,27 @@ var PhantomDeeplinkAdapter = class {
938
941
  async signMessage(message) {
939
942
  this.assertConnected();
940
943
  console.log(TAG2, "signMessage() \u2014 message length:", message.length);
941
- const { nonce, ciphertext } = encryptPayload(
942
- { message: bs582.encode(message), session: this._sessionToken },
943
- this._sharedSecret
944
- );
944
+ const encodedMessage = bs582.encode(message);
945
+ const payload = {
946
+ session: this._sessionToken,
947
+ message: encodedMessage,
948
+ display: "utf8"
949
+ };
950
+ console.log(TAG2, "signMessage() payload keys:", Object.keys(payload).join(", "));
951
+ console.log(TAG2, "signMessage() message (first 40 chars):", encodedMessage.substring(0, 40) + "...");
952
+ console.log(TAG2, "signMessage() session (first 20 chars):", this._sessionToken?.substring(0, 20) + "...");
953
+ console.log(TAG2, "signMessage() sharedSecret length:", this._sharedSecret.length);
954
+ console.log(TAG2, "signMessage() dappPubKey:", bs582.encode(this._dappKeyPair.publicKey));
955
+ const { nonce, ciphertext } = encryptPayload(payload, this._sharedSecret);
956
+ console.log(TAG2, "signMessage() encrypted \u2014 nonce length:", bs582.decode(nonce).length, "ciphertext length:", bs582.decode(ciphertext).length);
957
+ try {
958
+ const selfTest = decryptPayload(ciphertext, nonce, this._sharedSecret);
959
+ console.log(TAG2, "signMessage() self-test decrypt OK \u2014 keys:", Object.keys(selfTest).join(", "));
960
+ } catch (err) {
961
+ console.log(TAG2, "signMessage() SELF-TEST FAILED:", err instanceof Error ? err.message : err);
962
+ }
945
963
  const requestId = nextRequestId();
946
- const redirectLink = `${this.config.redirectUri}/${requestId}`;
964
+ const redirectLink = `${this.config.redirectUri}?dubs_rid=${requestId}`;
947
965
  console.log(TAG2, `signMessage() requestId=${requestId}`);
948
966
  const params = new URLSearchParams({
949
967
  dapp_encryption_public_key: bs582.encode(this._dappKeyPair.publicKey),
@@ -952,6 +970,7 @@ var PhantomDeeplinkAdapter = class {
952
970
  redirect_link: redirectLink
953
971
  });
954
972
  const url = `https://phantom.app/ul/v1/signMessage?${params.toString()}`;
973
+ console.log(TAG2, "signMessage() full URL length:", url.length);
955
974
  console.log(TAG2, "Opening Phantom signMessage deeplink...");
956
975
  const response = await this.handler.send(url, requestId, this.timeout);
957
976
  console.log(TAG2, "Received signMessage response");