@phantom/react-native-sdk 0.1.2 → 0.1.4

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
@@ -293,9 +293,11 @@ var import_crypto = require("@phantom/crypto");
293
293
  var import_base64url = require("@phantom/base64url");
294
294
  var import_sdk_types = require("@phantom/sdk-types");
295
295
  var ReactNativeStamper = class {
296
+ // Optional for PKI, required for OIDC
296
297
  constructor(config = {}) {
297
298
  this.keyInfo = null;
298
299
  this.algorithm = import_sdk_types.Algorithm.ed25519;
300
+ this.type = "PKI";
299
301
  this.keyPrefix = config.keyPrefix || "phantom-rn-stamper";
300
302
  this.organizationId = config.organizationId || "default";
301
303
  }
@@ -332,10 +334,10 @@ var ReactNativeStamper = class {
332
334
  }
333
335
  /**
334
336
  * Create X-Phantom-Stamp header value using stored secret key
335
- * @param data - Data to sign (Buffer)
337
+ * @param params - Parameters object with data to sign and optional override params
336
338
  * @returns Complete X-Phantom-Stamp header value
337
339
  */
338
- async stamp({ data }) {
340
+ async stamp(params) {
339
341
  if (!this.keyInfo) {
340
342
  throw new Error("Stamper not initialized. Call init() first.");
341
343
  }
@@ -344,7 +346,7 @@ var ReactNativeStamper = class {
344
346
  throw new Error("Secret key not found in secure storage");
345
347
  }
346
348
  const apiKeyStamper = new import_api_key_stamper.ApiKeyStamper({ apiSecretKey: storedSecretKey });
347
- return await apiKeyStamper.stamp({ data });
349
+ return await apiKeyStamper.stamp(params);
348
350
  }
349
351
  /**
350
352
  * Clear all stored keys from SecureStore
@@ -481,15 +483,26 @@ function PhantomProvider({ children, config }) {
481
483
  (0, import_react.useEffect)(() => {
482
484
  updateConnectionState();
483
485
  }, [updateConnectionState]);
484
- const value = {
485
- sdk,
486
- isConnected,
487
- addresses,
488
- walletId,
489
- error,
490
- updateConnectionState,
491
- setWalletId
492
- };
486
+ const value = (0, import_react.useMemo)(
487
+ () => ({
488
+ sdk,
489
+ isConnected,
490
+ addresses,
491
+ walletId,
492
+ error,
493
+ updateConnectionState,
494
+ setWalletId
495
+ }),
496
+ [
497
+ sdk,
498
+ isConnected,
499
+ addresses,
500
+ walletId,
501
+ error,
502
+ updateConnectionState,
503
+ setWalletId
504
+ ]
505
+ );
493
506
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PhantomContext.Provider, { value, children });
494
507
  }
495
508
  function usePhantom() {
package/dist/index.mjs CHANGED
@@ -249,9 +249,11 @@ import { generateKeyPair } from "@phantom/crypto";
249
249
  import { base64urlEncode } from "@phantom/base64url";
250
250
  import { Algorithm } from "@phantom/sdk-types";
251
251
  var ReactNativeStamper = class {
252
+ // Optional for PKI, required for OIDC
252
253
  constructor(config = {}) {
253
254
  this.keyInfo = null;
254
255
  this.algorithm = Algorithm.ed25519;
256
+ this.type = "PKI";
255
257
  this.keyPrefix = config.keyPrefix || "phantom-rn-stamper";
256
258
  this.organizationId = config.organizationId || "default";
257
259
  }
@@ -288,10 +290,10 @@ var ReactNativeStamper = class {
288
290
  }
289
291
  /**
290
292
  * Create X-Phantom-Stamp header value using stored secret key
291
- * @param data - Data to sign (Buffer)
293
+ * @param params - Parameters object with data to sign and optional override params
292
294
  * @returns Complete X-Phantom-Stamp header value
293
295
  */
294
- async stamp({ data }) {
296
+ async stamp(params) {
295
297
  if (!this.keyInfo) {
296
298
  throw new Error("Stamper not initialized. Call init() first.");
297
299
  }
@@ -300,7 +302,7 @@ var ReactNativeStamper = class {
300
302
  throw new Error("Secret key not found in secure storage");
301
303
  }
302
304
  const apiKeyStamper = new ApiKeyStamper({ apiSecretKey: storedSecretKey });
303
- return await apiKeyStamper.stamp({ data });
305
+ return await apiKeyStamper.stamp(params);
304
306
  }
305
307
  /**
306
308
  * Clear all stored keys from SecureStore
@@ -437,15 +439,26 @@ function PhantomProvider({ children, config }) {
437
439
  useEffect(() => {
438
440
  updateConnectionState();
439
441
  }, [updateConnectionState]);
440
- const value = {
441
- sdk,
442
- isConnected,
443
- addresses,
444
- walletId,
445
- error,
446
- updateConnectionState,
447
- setWalletId
448
- };
442
+ const value = useMemo(
443
+ () => ({
444
+ sdk,
445
+ isConnected,
446
+ addresses,
447
+ walletId,
448
+ error,
449
+ updateConnectionState,
450
+ setWalletId
451
+ }),
452
+ [
453
+ sdk,
454
+ isConnected,
455
+ addresses,
456
+ walletId,
457
+ error,
458
+ updateConnectionState,
459
+ setWalletId
460
+ ]
461
+ );
449
462
  return /* @__PURE__ */ jsx(PhantomContext.Provider, { value, children });
450
463
  }
451
464
  function usePhantom() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phantom/react-native-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Phantom Wallet SDK for React Native and Expo applications",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -45,13 +45,13 @@
45
45
  "directory": "packages/react-native-sdk"
46
46
  },
47
47
  "dependencies": {
48
- "@phantom/api-key-stamper": "^0.1.3",
48
+ "@phantom/api-key-stamper": "^0.1.5",
49
49
  "@phantom/base64url": "^0.1.0",
50
- "@phantom/client": "^0.1.6",
51
- "@phantom/constants": "^0.0.2",
50
+ "@phantom/client": "^0.1.8",
51
+ "@phantom/constants": "^0.0.3",
52
52
  "@phantom/crypto": "^0.1.2",
53
- "@phantom/embedded-provider-core": "^0.1.3",
54
- "@phantom/sdk-types": "^0.1.2",
53
+ "@phantom/embedded-provider-core": "^0.1.5",
54
+ "@phantom/sdk-types": "^0.1.4",
55
55
  "@types/bs58": "^5.0.0",
56
56
  "bs58": "^6.0.0",
57
57
  "buffer": "^6.0.3"