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

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,18 @@ export const PersSDKProvider = ({ children, config }) => {
25
25
  try {
26
26
  // Create HTTP client
27
27
  const httpClient = new ReactNativeHttpClient();
28
+ // Ensure DPoP is enabled by default for all platforms
29
+ const dpopConfig = config.dpop || {};
30
+ const isDpopEnabled = dpopConfig.enabled ?? true;
31
+ // Prepare DPoP settings for Auth Provider
32
+ const dpopSettings = {
33
+ enabled: isDpopEnabled,
34
+ cryptoProvider: dpopConfig.cryptoProvider
35
+ };
36
+ // Inject Native DPoP Provider (crypto-based) for mobile platforms if not already provided
37
+ if (Platform.OS !== 'web' && isDpopEnabled && !dpopSettings.cryptoProvider) {
38
+ dpopSettings.cryptoProvider = new ReactNativeDPoPProvider();
39
+ }
28
40
  // Create platform-aware auth provider if not provided
29
41
  let authProvider;
30
42
  if (config.authProvider) {
@@ -33,23 +45,16 @@ export const PersSDKProvider = ({ children, config }) => {
33
45
  else {
34
46
  // Use our platform-aware auth provider that automatically selects LocalStorage (web) or AsyncStorage (mobile)
35
47
  authProvider = createReactNativeAuthProvider(config.apiProjectKey || 'default-project', {
36
- debug: false
48
+ debug: false,
49
+ dpop: dpopSettings
37
50
  });
38
51
  }
39
52
  // Enhanced config with platform-appropriate auth provider
40
53
  const sdkConfig = {
41
54
  ...config,
42
- authProvider
55
+ authProvider,
56
+ dpop: dpopSettings
43
57
  };
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
58
  // Initialize PersSDK with platform-aware auth provider
54
59
  const sdkInstance = new PersSDK(httpClient, sdkConfig);
55
60
  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,CAiCrB"}
@@ -25,15 +25,21 @@ 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;
33
38
  // Return DefaultAuthProvider configured with platform-appropriate storage
34
39
  return new DefaultAuthProvider({
35
40
  authType,
36
41
  projectKey,
37
- storage: tokenStorage
42
+ storage: tokenStorage,
43
+ dpop: dpopConfig
38
44
  });
39
45
  }
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.30",
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
+ // Ensure DPoP is enabled by default for all platforms
92
+ const dpopConfig = config.dpop || {};
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,18 @@ 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
+
65
77
  // Return DefaultAuthProvider configured with platform-appropriate storage
66
78
  return new DefaultAuthProvider({
67
79
  authType,
68
80
  projectKey,
69
- storage: tokenStorage
81
+ storage: tokenStorage,
82
+ dpop: dpopConfig
70
83
  });
71
84
  }
72
85