@onairos/react-native 1.0.3 → 2.0.1

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.
@@ -5,36 +5,42 @@ export interface DataTier {
5
5
  }
6
6
 
7
7
  export interface OnairosButtonProps {
8
- title: string;
9
- onPress: () => void;
10
- style?: any;
11
- buttonType?: 'default' | 'pill';
12
- buttonForm?: 'signup' | 'login';
8
+ returnLink?: string;
9
+ prefillUrl?: string;
13
10
  AppName: string;
14
- requestData: {
11
+ buttonType?: 'normal' | 'pill';
12
+ requestData?: {
15
13
  Small: DataTier;
16
14
  Medium: DataTier;
17
15
  Large: DataTier;
18
16
  };
19
- returnLink: string;
20
- onComplete: (apiUrl: string, token: string, data: any) => void;
21
- embedd?: boolean;
17
+ buttonWidth?: number;
18
+ buttonHeight?: number;
19
+ hasStroke?: boolean;
20
+ enabled?: boolean;
21
+ buttonForm?: 'default' | 'login' | 'signup';
22
+ onRejection?: () => void;
23
+ onResolved?: (apiUrl: string, token: string, userData: any) => void;
24
+ preCheck?: () => Promise<boolean>;
25
+ color?: string;
26
+ swerv?: boolean;
22
27
  debug?: boolean;
23
- test?: boolean;
28
+ preferredPlatform?: string;
29
+ testMode?: boolean;
24
30
  }
25
31
 
26
32
  export interface UniversalOnboardingProps {
27
33
  visible: boolean;
28
34
  onClose: () => void;
29
35
  AppName: string;
30
- requestData: {
36
+ requestData?: {
31
37
  Small: DataTier;
32
38
  Medium: DataTier;
33
39
  Large: DataTier;
34
40
  };
35
- returnLink: string;
36
- onComplete: (apiUrl: string, token: string, data: any) => void;
37
- embedd?: boolean;
41
+ returnLink?: string;
42
+ onComplete: (apiUrl: string, token: string, userData: any) => void;
43
+ preferredPlatform?: string;
38
44
  debug?: boolean;
39
45
  test?: boolean;
40
46
  }
@@ -0,0 +1,25 @@
1
+ import { RSA } from 'react-native-rsa-native';
2
+ import { onairosApi } from '../api';
3
+
4
+ export const encryptModelKey = async (publicKey: string, modelKey: string): Promise<string> => {
5
+ try {
6
+ const encrypted = await RSA.encrypt(modelKey, publicKey);
7
+ return encrypted;
8
+ } catch (error) {
9
+ console.error('Error encrypting model key:', error);
10
+ throw error;
11
+ }
12
+ };
13
+
14
+ export const getServerPublicKey = async (): Promise<string> => {
15
+ try {
16
+ const response = await onairosApi.get('public/getPublicKey');
17
+ if (response && response.publicKey) {
18
+ return response.publicKey;
19
+ }
20
+ throw new Error('Server response does not contain publicKey field');
21
+ } catch (error) {
22
+ console.error('Error getting server public key:', error);
23
+ throw error;
24
+ }
25
+ };