@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.js CHANGED
@@ -809,11 +809,14 @@ var DeeplinkHandler = class {
809
809
  console.log(TAG, "No pending requests to resolve \u2014 redirect may have arrived late");
810
810
  }
811
811
  }
812
- /** Try to extract a request ID from the URL path segment after the redirect base. */
812
+ /** Extract the request ID from the dubs_rid query parameter. */
813
813
  extractRequestId(url) {
814
- const afterBase = url.slice(this.redirectBase.length);
815
- const match = afterBase.match(/^\/?([a-zA-Z0-9_-]+)/);
816
- return match?.[1] ?? null;
814
+ try {
815
+ const parsed = new URL(url);
816
+ return parsed.searchParams.get("dubs_rid");
817
+ } catch {
818
+ return null;
819
+ }
817
820
  }
818
821
  };
819
822
 
@@ -886,7 +889,7 @@ var PhantomDeeplinkAdapter = class {
886
889
  const dappPubBase58 = import_bs582.default.encode(this._dappKeyPair.publicKey);
887
890
  console.log(TAG2, "Dapp public key:", dappPubBase58);
888
891
  const requestId = nextRequestId();
889
- const redirectLink = `${this.config.redirectUri}/${requestId}`;
892
+ const redirectLink = `${this.config.redirectUri}?dubs_rid=${requestId}`;
890
893
  console.log(TAG2, `connect() requestId=${requestId} redirectLink=${redirectLink}`);
891
894
  const appUrl = this.config.appUrl || this.config.redirectUri;
892
895
  console.log(TAG2, "Using app_url:", appUrl);
@@ -947,7 +950,7 @@ var PhantomDeeplinkAdapter = class {
947
950
  this._sharedSecret
948
951
  );
949
952
  const requestId = nextRequestId();
950
- const redirectLink = `${this.config.redirectUri}/${requestId}`;
953
+ const redirectLink = `${this.config.redirectUri}?dubs_rid=${requestId}`;
951
954
  console.log(TAG2, `signTransaction() requestId=${requestId}`);
952
955
  const params = new URLSearchParams({
953
956
  dapp_encryption_public_key: import_bs582.default.encode(this._dappKeyPair.publicKey),
@@ -979,7 +982,7 @@ var PhantomDeeplinkAdapter = class {
979
982
  this._sharedSecret
980
983
  );
981
984
  const requestId = nextRequestId();
982
- const redirectLink = `${this.config.redirectUri}/${requestId}`;
985
+ const redirectLink = `${this.config.redirectUri}?dubs_rid=${requestId}`;
983
986
  console.log(TAG2, `signAndSendTransaction() requestId=${requestId}`);
984
987
  const params = new URLSearchParams({
985
988
  dapp_encryption_public_key: import_bs582.default.encode(this._dappKeyPair.publicKey),
@@ -1002,12 +1005,27 @@ var PhantomDeeplinkAdapter = class {
1002
1005
  async signMessage(message) {
1003
1006
  this.assertConnected();
1004
1007
  console.log(TAG2, "signMessage() \u2014 message length:", message.length);
1005
- const { nonce, ciphertext } = encryptPayload(
1006
- { message: import_bs582.default.encode(message), session: this._sessionToken },
1007
- this._sharedSecret
1008
- );
1008
+ const encodedMessage = import_bs582.default.encode(message);
1009
+ const payload = {
1010
+ session: this._sessionToken,
1011
+ message: encodedMessage,
1012
+ display: "utf8"
1013
+ };
1014
+ console.log(TAG2, "signMessage() payload keys:", Object.keys(payload).join(", "));
1015
+ console.log(TAG2, "signMessage() message (first 40 chars):", encodedMessage.substring(0, 40) + "...");
1016
+ console.log(TAG2, "signMessage() session (first 20 chars):", this._sessionToken?.substring(0, 20) + "...");
1017
+ console.log(TAG2, "signMessage() sharedSecret length:", this._sharedSecret.length);
1018
+ console.log(TAG2, "signMessage() dappPubKey:", import_bs582.default.encode(this._dappKeyPair.publicKey));
1019
+ const { nonce, ciphertext } = encryptPayload(payload, this._sharedSecret);
1020
+ console.log(TAG2, "signMessage() encrypted \u2014 nonce length:", import_bs582.default.decode(nonce).length, "ciphertext length:", import_bs582.default.decode(ciphertext).length);
1021
+ try {
1022
+ const selfTest = decryptPayload(ciphertext, nonce, this._sharedSecret);
1023
+ console.log(TAG2, "signMessage() self-test decrypt OK \u2014 keys:", Object.keys(selfTest).join(", "));
1024
+ } catch (err) {
1025
+ console.log(TAG2, "signMessage() SELF-TEST FAILED:", err instanceof Error ? err.message : err);
1026
+ }
1009
1027
  const requestId = nextRequestId();
1010
- const redirectLink = `${this.config.redirectUri}/${requestId}`;
1028
+ const redirectLink = `${this.config.redirectUri}?dubs_rid=${requestId}`;
1011
1029
  console.log(TAG2, `signMessage() requestId=${requestId}`);
1012
1030
  const params = new URLSearchParams({
1013
1031
  dapp_encryption_public_key: import_bs582.default.encode(this._dappKeyPair.publicKey),
@@ -1016,6 +1034,7 @@ var PhantomDeeplinkAdapter = class {
1016
1034
  redirect_link: redirectLink
1017
1035
  });
1018
1036
  const url = `https://phantom.app/ul/v1/signMessage?${params.toString()}`;
1037
+ console.log(TAG2, "signMessage() full URL length:", url.length);
1019
1038
  console.log(TAG2, "Opening Phantom signMessage deeplink...");
1020
1039
  const response = await this.handler.send(url, requestId, this.timeout);
1021
1040
  console.log(TAG2, "Received signMessage response");