@explorins/pers-sdk-react-native 1.5.29 → 1.5.31

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":"PersSDKProvider.d.ts","sourceRoot":"","sources":["../../src/providers/PersSDKProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAuC,SAAS,EAAkC,MAAM,OAAO,CAAC;AAE9G,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAsB,MAAM,0BAA0B,CAAC;AAIxG,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAG3D,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAGlC,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,MAAM,WAAW,cAAc;IAE7B,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IAGpB,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IAC1B,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,eAAe,GAAG,IAAI,CAAC;IACnC,SAAS,EAAE,eAAe,GAAG,IAAI,CAAC;IAClC,WAAW,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACtC,YAAY,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACxC,SAAS,EAAE,eAAe,GAAG,IAAI,CAAC;IAClC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9B,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACnC,SAAS,EAAE,eAAe,GAAG,IAAI,CAAC;IAGlC,QAAQ,EAAE,eAAe,GAAG,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AAO,cAQ7B,CAAC"}
@@ -25,6 +25,17 @@ export const PersSDKProvider = ({ children, config }) => {
25
25
  try {
26
26
  // Create HTTP client
27
27
  const httpClient = new ReactNativeHttpClient();
28
+ const dpopConfig = config.dpop ?? {};
29
+ const isDpopEnabled = dpopConfig.enabled ?? true;
30
+ // Prepare DPoP settings for Auth Provider
31
+ const dpopSettings = {
32
+ enabled: isDpopEnabled,
33
+ cryptoProvider: dpopConfig.cryptoProvider
34
+ };
35
+ // Inject Native DPoP Provider (crypto-based) for mobile platforms if not already provided
36
+ if (Platform.OS !== 'web' && isDpopEnabled && !dpopSettings.cryptoProvider) {
37
+ dpopSettings.cryptoProvider = new ReactNativeDPoPProvider();
38
+ }
28
39
  // Create platform-aware auth provider if not provided
29
40
  let authProvider;
30
41
  if (config.authProvider) {
@@ -33,23 +44,16 @@ export const PersSDKProvider = ({ children, config }) => {
33
44
  else {
34
45
  // Use our platform-aware auth provider that automatically selects LocalStorage (web) or AsyncStorage (mobile)
35
46
  authProvider = createReactNativeAuthProvider(config.apiProjectKey || 'default-project', {
36
- debug: false
47
+ debug: false,
48
+ dpop: dpopSettings
37
49
  });
38
50
  }
39
51
  // Enhanced config with platform-appropriate auth provider
40
52
  const sdkConfig = {
41
53
  ...config,
42
- authProvider
54
+ authProvider,
55
+ dpop: dpopSettings
43
56
  };
44
- // Inject Native DPoP Provider (crypto-based) for mobile platforms
45
- // Web platforms use built-in WebCrypto provider by default
46
- if (Platform.OS !== 'web' && (!config.dpop?.cryptoProvider)) {
47
- sdkConfig.dpop = {
48
- ...(config.dpop || {}),
49
- enabled: config.dpop?.enabled ?? true,
50
- cryptoProvider: new ReactNativeDPoPProvider()
51
- };
52
- }
53
57
  // Initialize PersSDK with platform-aware auth provider
54
58
  const sdkInstance = new PersSDK(httpClient, sdkConfig);
55
59
  setAuthProvider(authProvider);
@@ -19,6 +19,11 @@ export interface ReactNativeAuthConfig {
19
19
  customStorage?: TokenStorage;
20
20
  /** Authentication type (default: 'user') */
21
21
  authType?: AuthType;
22
+ /** DPoP Configuration (optional) */
23
+ dpop?: {
24
+ enabled?: boolean;
25
+ cryptoProvider?: import('@explorins/pers-sdk/core').DPoPCryptoProvider;
26
+ };
22
27
  }
23
28
  /**
24
29
  * Create a React Native auth provider with platform-appropriate storage
@@ -1 +1 @@
1
- {"version":3,"file":"react-native-auth-provider.d.ts","sourceRoot":"","sources":["../../src/providers/react-native-auth-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,mBAAmB,EAAW,QAAQ,EAA4B,MAAM,0BAA0B,CAAC;AAG5G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAK7D;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0CAA0C;IAC1C,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,qBAA0B,GACjC,mBAAmB,CAyBrB"}
1
+ {"version":3,"file":"react-native-auth-provider.d.ts","sourceRoot":"","sources":["../../src/providers/react-native-auth-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,mBAAmB,EAAW,QAAQ,EAA4B,MAAM,0BAA0B,CAAC;AAG5G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAK7D;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0CAA0C;IAC1C,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,oCAAoC;IACpC,IAAI,CAAC,EAAE;QACL,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,cAAc,CAAC,EAAE,OAAO,0BAA0B,EAAE,kBAAkB,CAAC;KACxE,CAAC;CACH;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,qBAA0B,GACjC,mBAAmB,CAsCrB"}
@@ -25,15 +25,25 @@ export function createReactNativeAuthProvider(projectKey, config = {}) {
25
25
  if (!projectKey || typeof projectKey !== 'string') {
26
26
  throw new Error('createReactNativeAuthProvider: projectKey is required and must be a string');
27
27
  }
28
- const { keyPrefix = `pers_${projectKey.slice(0, 8)}_`, debug = false, customStorage, authType = 'user' } = config;
28
+ const { keyPrefix = `pers_${projectKey.slice(0, 8)}_`, debug = false, customStorage, authType = 'user', dpop } = config;
29
29
  // Platform-specific storage selection
30
30
  const tokenStorage = customStorage || (isWebPlatform
31
31
  ? new LocalStorageTokenStorage()
32
32
  : new ReactNativeSecureStorage(keyPrefix));
33
+ // Prepare DPoP config ensuring enabled is boolean (default true)
34
+ const dpopConfig = dpop ? {
35
+ enabled: dpop.enabled ?? true,
36
+ cryptoProvider: dpop.cryptoProvider
37
+ } : undefined;
38
+ // DEBUG LOGGING
39
+ if (debug) {
40
+ console.log('[ReactNativeAuthProvider] Creating provider with DPoP config:', JSON.stringify(dpopConfig));
41
+ }
33
42
  // Return DefaultAuthProvider configured with platform-appropriate storage
34
43
  return new DefaultAuthProvider({
35
44
  authType,
36
45
  projectKey,
37
- storage: tokenStorage
46
+ storage: tokenStorage,
47
+ dpop: dpopConfig
38
48
  });
39
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@explorins/pers-sdk-react-native",
3
- "version": "1.5.29",
3
+ "version": "1.5.31",
4
4
  "description": "React Native SDK for PERS Platform - Tourism Loyalty System with Blockchain Transaction Signing and WebAuthn Authentication",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -88,6 +88,21 @@ export const PersSDKProvider: React.FC<{
88
88
  // Create HTTP client
89
89
  const httpClient = new ReactNativeHttpClient();
90
90
 
91
+ const dpopConfig = config.dpop ?? {};
92
+
93
+ const isDpopEnabled = dpopConfig.enabled ?? true;
94
+
95
+ // Prepare DPoP settings for Auth Provider
96
+ const dpopSettings = {
97
+ enabled: isDpopEnabled,
98
+ cryptoProvider: dpopConfig.cryptoProvider
99
+ };
100
+
101
+ // Inject Native DPoP Provider (crypto-based) for mobile platforms if not already provided
102
+ if (Platform.OS !== 'web' && isDpopEnabled && !dpopSettings.cryptoProvider) {
103
+ dpopSettings.cryptoProvider = new ReactNativeDPoPProvider();
104
+ }
105
+
91
106
  // Create platform-aware auth provider if not provided
92
107
  let authProvider: DefaultAuthProvider;
93
108
  if (config.authProvider) {
@@ -95,26 +110,18 @@ export const PersSDKProvider: React.FC<{
95
110
  } else {
96
111
  // Use our platform-aware auth provider that automatically selects LocalStorage (web) or AsyncStorage (mobile)
97
112
  authProvider = createReactNativeAuthProvider(config.apiProjectKey || 'default-project', {
98
- debug: false
113
+ debug: false,
114
+ dpop: dpopSettings
99
115
  });
100
116
  }
101
117
 
102
118
  // Enhanced config with platform-appropriate auth provider
103
119
  const sdkConfig: PersConfig = {
104
120
  ...config,
105
- authProvider
121
+ authProvider,
122
+ dpop: dpopSettings
106
123
  };
107
124
 
108
- // Inject Native DPoP Provider (crypto-based) for mobile platforms
109
- // Web platforms use built-in WebCrypto provider by default
110
- if (Platform.OS !== 'web' && (!config.dpop?.cryptoProvider)) {
111
- sdkConfig.dpop = {
112
- ...(config.dpop || {}),
113
- enabled: config.dpop?.enabled ?? true,
114
- cryptoProvider: new ReactNativeDPoPProvider()
115
- };
116
- }
117
-
118
125
  // Initialize PersSDK with platform-aware auth provider
119
126
  const sdkInstance = new PersSDK(httpClient, sdkConfig);
120
127
 
@@ -27,6 +27,11 @@ export interface ReactNativeAuthConfig {
27
27
  customStorage?: TokenStorage;
28
28
  /** Authentication type (default: 'user') */
29
29
  authType?: AuthType;
30
+ /** DPoP Configuration (optional) */
31
+ dpop?: {
32
+ enabled?: boolean;
33
+ cryptoProvider?: import('@explorins/pers-sdk/core').DPoPCryptoProvider;
34
+ };
30
35
  }
31
36
 
32
37
  /**
@@ -52,7 +57,8 @@ export function createReactNativeAuthProvider(
52
57
  keyPrefix = `pers_${projectKey.slice(0, 8)}_`,
53
58
  debug = false,
54
59
  customStorage,
55
- authType = 'user'
60
+ authType = 'user',
61
+ dpop
56
62
  } = config;
57
63
 
58
64
  // Platform-specific storage selection
@@ -62,11 +68,23 @@ export function createReactNativeAuthProvider(
62
68
  : new ReactNativeSecureStorage(keyPrefix)
63
69
  );
64
70
 
71
+ // Prepare DPoP config ensuring enabled is boolean (default true)
72
+ const dpopConfig = dpop ? {
73
+ enabled: dpop.enabled ?? true,
74
+ cryptoProvider: dpop.cryptoProvider
75
+ } : undefined;
76
+
77
+ // DEBUG LOGGING
78
+ if (debug) {
79
+ console.log('[ReactNativeAuthProvider] Creating provider with DPoP config:', JSON.stringify(dpopConfig));
80
+ }
81
+
65
82
  // Return DefaultAuthProvider configured with platform-appropriate storage
66
83
  return new DefaultAuthProvider({
67
84
  authType,
68
85
  projectKey,
69
- storage: tokenStorage
86
+ storage: tokenStorage,
87
+ dpop: dpopConfig
70
88
  });
71
89
  }
72
90