@explorins/pers-sdk-react-native 1.5.10 → 1.5.12
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTransactionSigner.d.ts","sourceRoot":"","sources":["../../src/hooks/useTransactionSigner.ts"],"names":[],"mappings":"AA6EA,UAAU,wBAAwB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAKD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,oBAAoB;
|
|
1
|
+
{"version":3,"file":"useTransactionSigner.d.ts","sourceRoot":"","sources":["../../src/hooks/useTransactionSigner.ts"],"names":[],"mappings":"AA6EA,UAAU,wBAAwB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAKD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,oBAAoB;IAoQ7B;;OAEG;2BAvE2C,MAAM,KAAG,QAAQ,wBAAwB,CAAC;IA0ExF;;OAEG;gCAjLgD;QACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B;IAgLC;;OAEG;;IAGH;;OAEG;;CAGN,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE5E;;GAEG;AACH,YAAY,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -95,12 +95,13 @@ export const useTransactionSigner = () => {
|
|
|
95
95
|
console.log('[useTransactionSigner] SDK config:', sdkConfig);
|
|
96
96
|
// Try to extract tenantId from JWT token if available
|
|
97
97
|
let tenantIdFromJWT;
|
|
98
|
+
let authToken;
|
|
98
99
|
if (authProvider.getToken) {
|
|
99
100
|
try {
|
|
100
|
-
|
|
101
|
-
if (
|
|
101
|
+
authToken = await authProvider.getToken();
|
|
102
|
+
if (authToken) {
|
|
102
103
|
// Decode JWT to get tenant information
|
|
103
|
-
const tokenParts =
|
|
104
|
+
const tokenParts = authToken.split('.');
|
|
104
105
|
if (tokenParts.length >= 2) {
|
|
105
106
|
const payload = JSON.parse(atob(tokenParts[1]));
|
|
106
107
|
console.log('[useTransactionSigner] JWT payload decoded:', payload);
|
|
@@ -177,19 +178,20 @@ export const useTransactionSigner = () => {
|
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
180
|
else if (config?.tenantId) {
|
|
180
|
-
console.log('[useTransactionSigner] No project key provided, will initialize tenant
|
|
181
|
+
console.log('[useTransactionSigner] No project key provided, will initialize tenant with tenantId:', config.tenantId);
|
|
181
182
|
try {
|
|
182
183
|
// Import and initialize tenant environment to get project key
|
|
183
184
|
const { PersService } = await import('@explorins/pers-signer/react-native');
|
|
184
|
-
console.log('[useTransactionSigner] Initializing tenant
|
|
185
|
+
console.log('[useTransactionSigner] Initializing tenant for tenantId:', config.tenantId);
|
|
185
186
|
// We need to set the auth token first for tenant initialization
|
|
187
|
+
let authToken;
|
|
186
188
|
if (authProvider) {
|
|
187
189
|
try {
|
|
188
|
-
|
|
189
|
-
if (
|
|
190
|
+
authToken = await authProvider.getToken();
|
|
191
|
+
if (authToken) {
|
|
190
192
|
console.log('[useTransactionSigner] Setting auth token for tenant initialization');
|
|
191
193
|
PersService.configure({
|
|
192
|
-
token:
|
|
194
|
+
token: authToken
|
|
193
195
|
});
|
|
194
196
|
}
|
|
195
197
|
}
|
|
@@ -197,14 +199,14 @@ export const useTransactionSigner = () => {
|
|
|
197
199
|
console.warn('[useTransactionSigner] Could not get auth token for tenant initialization:', tokenError);
|
|
198
200
|
}
|
|
199
201
|
}
|
|
200
|
-
await PersService.
|
|
201
|
-
console.log('[useTransactionSigner] Tenant
|
|
202
|
+
await PersService.initializeTenant(config.tenantId, authToken);
|
|
203
|
+
console.log('[useTransactionSigner] Tenant initialized successfully');
|
|
202
204
|
// Verify configuration
|
|
203
205
|
const persConfig = PersService.getConfig();
|
|
204
206
|
console.log('[useTransactionSigner] PERS service config after tenant initialization:', persConfig);
|
|
205
207
|
}
|
|
206
208
|
catch (configError) {
|
|
207
|
-
console.error('[useTransactionSigner] Failed to initialize tenant
|
|
209
|
+
console.error('[useTransactionSigner] Failed to initialize tenant:', configError);
|
|
208
210
|
}
|
|
209
211
|
}
|
|
210
212
|
const signerSDK = await createPersSignerSDK({
|
package/dist/index.js
CHANGED
|
@@ -30337,12 +30337,13 @@ const useTransactionSigner = () => {
|
|
|
30337
30337
|
console.log('[useTransactionSigner] SDK config:', sdkConfig);
|
|
30338
30338
|
// Try to extract tenantId from JWT token if available
|
|
30339
30339
|
let tenantIdFromJWT;
|
|
30340
|
+
let authToken;
|
|
30340
30341
|
if (authProvider.getToken) {
|
|
30341
30342
|
try {
|
|
30342
|
-
|
|
30343
|
-
if (
|
|
30343
|
+
authToken = await authProvider.getToken();
|
|
30344
|
+
if (authToken) {
|
|
30344
30345
|
// Decode JWT to get tenant information
|
|
30345
|
-
const tokenParts =
|
|
30346
|
+
const tokenParts = authToken.split('.');
|
|
30346
30347
|
if (tokenParts.length >= 2) {
|
|
30347
30348
|
const payload = JSON.parse(atob(tokenParts[1]));
|
|
30348
30349
|
console.log('[useTransactionSigner] JWT payload decoded:', payload);
|
|
@@ -30419,19 +30420,20 @@ const useTransactionSigner = () => {
|
|
|
30419
30420
|
}
|
|
30420
30421
|
}
|
|
30421
30422
|
else if (config?.tenantId) {
|
|
30422
|
-
console.log('[useTransactionSigner] No project key provided, will initialize tenant
|
|
30423
|
+
console.log('[useTransactionSigner] No project key provided, will initialize tenant with tenantId:', config.tenantId);
|
|
30423
30424
|
try {
|
|
30424
30425
|
// Import and initialize tenant environment to get project key
|
|
30425
30426
|
const { PersService } = await Promise.resolve().then(function () { return require('./react-native.esm-BtyCg4n1.js'); });
|
|
30426
|
-
console.log('[useTransactionSigner] Initializing tenant
|
|
30427
|
+
console.log('[useTransactionSigner] Initializing tenant for tenantId:', config.tenantId);
|
|
30427
30428
|
// We need to set the auth token first for tenant initialization
|
|
30429
|
+
let authToken;
|
|
30428
30430
|
if (authProvider) {
|
|
30429
30431
|
try {
|
|
30430
|
-
|
|
30431
|
-
if (
|
|
30432
|
+
authToken = await authProvider.getToken();
|
|
30433
|
+
if (authToken) {
|
|
30432
30434
|
console.log('[useTransactionSigner] Setting auth token for tenant initialization');
|
|
30433
30435
|
PersService.configure({
|
|
30434
|
-
token:
|
|
30436
|
+
token: authToken
|
|
30435
30437
|
});
|
|
30436
30438
|
}
|
|
30437
30439
|
}
|
|
@@ -30439,14 +30441,14 @@ const useTransactionSigner = () => {
|
|
|
30439
30441
|
console.warn('[useTransactionSigner] Could not get auth token for tenant initialization:', tokenError);
|
|
30440
30442
|
}
|
|
30441
30443
|
}
|
|
30442
|
-
await PersService.
|
|
30443
|
-
console.log('[useTransactionSigner] Tenant
|
|
30444
|
+
await PersService.initializeTenant(config.tenantId, authToken);
|
|
30445
|
+
console.log('[useTransactionSigner] Tenant initialized successfully');
|
|
30444
30446
|
// Verify configuration
|
|
30445
30447
|
const persConfig = PersService.getConfig();
|
|
30446
30448
|
console.log('[useTransactionSigner] PERS service config after tenant initialization:', persConfig);
|
|
30447
30449
|
}
|
|
30448
30450
|
catch (configError) {
|
|
30449
|
-
console.error('[useTransactionSigner] Failed to initialize tenant
|
|
30451
|
+
console.error('[useTransactionSigner] Failed to initialize tenant:', configError);
|
|
30450
30452
|
}
|
|
30451
30453
|
}
|
|
30452
30454
|
const signerSDK = await createPersSignerSDK({
|