@onairos/react-native 2.0.8 → 2.1.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.
- package/lib/commonjs/components/OnairosButton.js +60 -23
- package/lib/commonjs/components/OnairosButton.js.map +1 -1
- package/lib/commonjs/components/Overlay.js +37 -24
- package/lib/commonjs/components/Overlay.js.map +1 -1
- package/lib/commonjs/utils/secureStorage.js +14 -103
- package/lib/commonjs/utils/secureStorage.js.map +1 -1
- package/lib/module/components/OnairosButton.js +60 -23
- package/lib/module/components/OnairosButton.js.map +1 -1
- package/lib/module/components/Overlay.js +39 -24
- package/lib/module/components/Overlay.js.map +1 -1
- package/lib/module/index.js +8 -31
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/secureStorage.js +14 -102
- package/lib/module/utils/secureStorage.js.map +1 -1
- package/package.json +1 -1
- package/src/components/OnairosButton.tsx +78 -31
- package/src/components/Overlay.tsx +32 -19
- package/src/utils/secureStorage.ts +14 -104
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { TouchableOpacity, Text, StyleSheet, View } from 'react-native';
|
|
3
3
|
import { UniversalOnboarding } from './UniversalOnboarding';
|
|
4
|
+
import { Overlay } from './Overlay';
|
|
5
|
+
import { hasCredentials, getCredentials } from '../utils/secureStorage';
|
|
4
6
|
export const OnairosButton = ({
|
|
5
7
|
returnLink,
|
|
6
8
|
prefillUrl,
|
|
7
9
|
AppName,
|
|
8
10
|
buttonType = 'normal',
|
|
9
11
|
requestData,
|
|
10
|
-
buttonWidth =
|
|
11
|
-
buttonHeight,
|
|
12
|
-
hasStroke =
|
|
12
|
+
buttonWidth = 240,
|
|
13
|
+
buttonHeight = 48,
|
|
14
|
+
hasStroke = true,
|
|
13
15
|
enabled = true,
|
|
14
16
|
buttonForm = 'default',
|
|
15
17
|
onRejection,
|
|
@@ -22,6 +24,9 @@ export const OnairosButton = ({
|
|
|
22
24
|
testMode = false
|
|
23
25
|
}) => {
|
|
24
26
|
const [showOnboarding, setShowOnboarding] = useState(false);
|
|
27
|
+
const [showOverlay, setShowOverlay] = useState(false);
|
|
28
|
+
const [storedCredentials, setStoredCredentials] = useState(null);
|
|
29
|
+
const isDarkMode = color === 'black' || !color && !hasStroke;
|
|
25
30
|
const handlePress = async () => {
|
|
26
31
|
if (!enabled) return;
|
|
27
32
|
if (preCheck) {
|
|
@@ -31,27 +36,46 @@ export const OnairosButton = ({
|
|
|
31
36
|
return;
|
|
32
37
|
}
|
|
33
38
|
}
|
|
34
|
-
|
|
39
|
+
|
|
40
|
+
// Check if credentials exist
|
|
41
|
+
const hasStoredCreds = await hasCredentials();
|
|
42
|
+
if (hasStoredCreds) {
|
|
43
|
+
// If credentials exist, fetch them and display overlay
|
|
44
|
+
const credentials = await getCredentials();
|
|
45
|
+
setStoredCredentials(credentials);
|
|
46
|
+
setShowOverlay(true);
|
|
47
|
+
} else {
|
|
48
|
+
// If no credentials, show onboarding
|
|
49
|
+
setShowOnboarding(true);
|
|
50
|
+
}
|
|
35
51
|
};
|
|
36
52
|
const handleOnboardingComplete = (apiUrl, token, data) => {
|
|
37
53
|
setShowOnboarding(false);
|
|
38
54
|
onResolved === null || onResolved === void 0 || onResolved(apiUrl, token, data);
|
|
39
55
|
};
|
|
56
|
+
const handleOverlayResolved = (apiUrl, token, data) => {
|
|
57
|
+
setShowOverlay(false);
|
|
58
|
+
onResolved === null || onResolved === void 0 || onResolved(apiUrl, token, data);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// Calculate button styles based on props
|
|
40
62
|
const buttonStyle = [styles.button, buttonType === 'pill' && styles.pillButton, hasStroke && styles.strokedButton, {
|
|
41
|
-
width: buttonWidth
|
|
42
|
-
}, buttonHeight ? {
|
|
63
|
+
width: buttonWidth,
|
|
43
64
|
height: buttonHeight
|
|
44
|
-
}
|
|
65
|
+
}, color ? {
|
|
45
66
|
backgroundColor: color
|
|
46
|
-
} : null, swerv && styles.swervButton].filter(Boolean);
|
|
47
|
-
|
|
67
|
+
} : null, isDarkMode ? styles.darkButton : styles.lightButton, swerv && styles.swervButton].filter(Boolean);
|
|
68
|
+
|
|
69
|
+
// Calculate text styles based on props
|
|
70
|
+
const textStyle = [styles.buttonText, isDarkMode ? styles.lightText : styles.darkText].filter(Boolean);
|
|
48
71
|
return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
49
72
|
style: buttonStyle,
|
|
50
73
|
onPress: handlePress,
|
|
51
|
-
disabled: !enabled
|
|
74
|
+
disabled: !enabled,
|
|
75
|
+
accessibilityLabel: `Sign in with Onairos`
|
|
52
76
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
53
77
|
style: textStyle
|
|
54
|
-
},
|
|
78
|
+
}, "Sign in with Onairos")), showOnboarding && /*#__PURE__*/React.createElement(UniversalOnboarding, {
|
|
55
79
|
visible: showOnboarding,
|
|
56
80
|
onClose: () => setShowOnboarding(false),
|
|
57
81
|
AppName: AppName,
|
|
@@ -61,19 +85,24 @@ export const OnairosButton = ({
|
|
|
61
85
|
preferredPlatform: preferredPlatform,
|
|
62
86
|
debug: debug,
|
|
63
87
|
test: testMode
|
|
88
|
+
}), showOverlay && storedCredentials && /*#__PURE__*/React.createElement(Overlay, {
|
|
89
|
+
data: requestData || {},
|
|
90
|
+
username: storedCredentials.username,
|
|
91
|
+
modelKey: storedCredentials.userPin || '',
|
|
92
|
+
onResolved: handleOverlayResolved
|
|
64
93
|
}));
|
|
65
94
|
};
|
|
66
95
|
const styles = StyleSheet.create({
|
|
67
96
|
button: {
|
|
68
|
-
|
|
69
|
-
paddingVertical: 12,
|
|
70
|
-
paddingHorizontal: 24,
|
|
71
|
-
borderRadius: 8,
|
|
97
|
+
flexDirection: 'row',
|
|
72
98
|
alignItems: 'center',
|
|
73
|
-
justifyContent: 'center'
|
|
99
|
+
justifyContent: 'center',
|
|
100
|
+
paddingVertical: 12,
|
|
101
|
+
paddingHorizontal: 16,
|
|
102
|
+
borderRadius: 4
|
|
74
103
|
},
|
|
75
104
|
pillButton: {
|
|
76
|
-
borderRadius:
|
|
105
|
+
borderRadius: 24
|
|
77
106
|
},
|
|
78
107
|
strokedButton: {
|
|
79
108
|
backgroundColor: 'transparent',
|
|
@@ -85,16 +114,24 @@ const styles = StyleSheet.create({
|
|
|
85
114
|
rotate: '-2deg'
|
|
86
115
|
}]
|
|
87
116
|
},
|
|
117
|
+
darkButton: {
|
|
118
|
+
backgroundColor: '#000',
|
|
119
|
+
borderColor: '#000'
|
|
120
|
+
},
|
|
121
|
+
lightButton: {
|
|
122
|
+
backgroundColor: '#fff',
|
|
123
|
+
borderColor: '#000'
|
|
124
|
+
},
|
|
88
125
|
buttonText: {
|
|
89
|
-
color: '#fff',
|
|
90
126
|
fontSize: 16,
|
|
91
|
-
fontWeight: '600'
|
|
127
|
+
fontWeight: '600',
|
|
128
|
+
textAlign: 'center'
|
|
92
129
|
},
|
|
93
|
-
|
|
94
|
-
color: '#000'
|
|
95
|
-
},
|
|
96
|
-
customColorText: {
|
|
130
|
+
lightText: {
|
|
97
131
|
color: '#fff'
|
|
132
|
+
},
|
|
133
|
+
darkText: {
|
|
134
|
+
color: '#000'
|
|
98
135
|
}
|
|
99
136
|
});
|
|
100
137
|
//# sourceMappingURL=OnairosButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useState","TouchableOpacity","Text","StyleSheet","View","UniversalOnboarding","OnairosButton","returnLink","prefillUrl","AppName","buttonType","requestData","buttonWidth","buttonHeight","hasStroke","enabled","buttonForm","onRejection","onResolved","preCheck","color","swerv","debug","preferredPlatform","testMode","showOnboarding","setShowOnboarding","handlePress","shouldProceed","handleOnboardingComplete","apiUrl","token","data","buttonStyle","styles","button","pillButton","strokedButton","width","height","backgroundColor","swervButton","filter","Boolean","textStyle","buttonText","
|
|
1
|
+
{"version":3,"names":["React","useState","TouchableOpacity","Text","StyleSheet","View","UniversalOnboarding","Overlay","hasCredentials","getCredentials","OnairosButton","returnLink","prefillUrl","AppName","buttonType","requestData","buttonWidth","buttonHeight","hasStroke","enabled","buttonForm","onRejection","onResolved","preCheck","color","swerv","debug","preferredPlatform","testMode","showOnboarding","setShowOnboarding","showOverlay","setShowOverlay","storedCredentials","setStoredCredentials","isDarkMode","handlePress","shouldProceed","hasStoredCreds","credentials","handleOnboardingComplete","apiUrl","token","data","handleOverlayResolved","buttonStyle","styles","button","pillButton","strokedButton","width","height","backgroundColor","darkButton","lightButton","swervButton","filter","Boolean","textStyle","buttonText","lightText","darkText","createElement","style","onPress","disabled","accessibilityLabel","visible","onClose","onComplete","test","username","modelKey","userPin","create","flexDirection","alignItems","justifyContent","paddingVertical","paddingHorizontal","borderRadius","borderWidth","borderColor","transform","rotate","fontSize","fontWeight","textAlign"],"sourceRoot":"..\\..\\..\\src","sources":["components/OnairosButton.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,gBAAgB,EAAEC,IAAI,EAAEC,UAAU,EAAEC,IAAI,QAAqC,cAAc;AACpG,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,OAAO,QAAQ,WAAW;AAGnC,SAASC,cAAc,EAAEC,cAAc,QAAQ,wBAAwB;AAEvE,OAAO,MAAMC,aAA2C,GAAGA,CAAC;EAC1DC,UAAU;EACVC,UAAU;EACVC,OAAO;EACPC,UAAU,GAAG,QAAQ;EACrBC,WAAW;EACXC,WAAW,GAAG,GAAG;EACjBC,YAAY,GAAG,EAAE;EACjBC,SAAS,GAAG,IAAI;EAChBC,OAAO,GAAG,IAAI;EACdC,UAAU,GAAG,SAAS;EACtBC,WAAW;EACXC,UAAU;EACVC,QAAQ;EACRC,KAAK;EACLC,KAAK,GAAG,KAAK;EACbC,KAAK,GAAG,KAAK;EACbC,iBAAiB;EACjBC,QAAQ,GAAG;AACb,CAAC,KAAK;EACJ,MAAM,CAACC,cAAc,EAAEC,iBAAiB,CAAC,GAA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AAE1C;EAAS,CAChB,CACF,EAEAG,WAAW,IAAIE,iBAAiB,iBAC/BjC,KAAA,CAAA8D,aAAA,CAACvD,OAAO;IACNoC,IAAI,EAAE5B,WAAW,IAAI,CAAC,CAAE;IACxBwD,QAAQ,EAAEtC,iBAAiB,CAACsC,QAAS;IACrCC,QAAQ,EAAEvC,iBAAiB,CAACwC,OAAO,IAAI,EAAG;IAC1CnD,UAAU,EAAEsB;EAAsB,CACnC,CAEC,CAAC;AAEX,CAAC;AAED,MAAME,MAAM,GAAG1C,UAAU,CAACsE,MAAM,CAAC;EAC/B3B,MAAM,EAAE;IACN4B,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,eAAe,EAAE,EAAE;IACnBC,iBAAiB,EAAE,EAAE;IACrBC,YAAY,EAAE;EAChB,CAAC;EACDhC,UAAU,EAAE;IACVgC,YAAY,EAAE;EAChB,CAAC;EACD/B,aAAa,EAAE;IACbG,eAAe,EAAE,aAAa;IAC9B6B,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE;EACf,CAAC;EACD3B,WAAW,EAAE;IACX4B,SAAS,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAQ,CAAC;EACjC,CAAC;EACD/B,UAAU,EAAE;IACVD,eAAe,EAAE,MAAM;IACvB8B,WAAW,EAAE;EACf,CAAC;EACD5B,WAAW,EAAE;IACXF,eAAe,EAAE,MAAM;IACvB8B,WAAW,EAAE;EACf,CAAC;EACDvB,UAAU,EAAE;IACV0B,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBC,SAAS,EAAE;EACb,CAAC;EACD3B,SAAS,EAAE;IACTpC,KAAK,EAAE;EACT,CAAC;EACDqC,QAAQ,EAAE;IACRrC,KAAK,EAAE;EACT;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { useState, useEffect } from 'react';
|
|
3
|
-
import { View, Text, StyleSheet, TouchableOpacity, ScrollView, Alert, Platform } from 'react-native';
|
|
2
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
3
|
+
import { View, Text, StyleSheet, TouchableOpacity, ScrollView, Alert, Platform, Dimensions } from 'react-native';
|
|
4
4
|
import { BottomSheetModal, BottomSheetBackdrop } from '@gorhom/bottom-sheet';
|
|
5
|
-
import DeviceInfo from 'react-native-device-info';
|
|
5
|
+
// import DeviceInfo from 'react-native-device-info'; // Comment out device info import
|
|
6
6
|
import { COLORS } from '../constants';
|
|
7
7
|
import { onairosApi } from '../api';
|
|
8
8
|
import { encryptModelKey, getServerPublicKey } from '../utils/encryption';
|
|
@@ -14,7 +14,9 @@ export const Overlay = ({
|
|
|
14
14
|
}) => {
|
|
15
15
|
const [selections, setSelections] = useState({});
|
|
16
16
|
const [details, setDetails] = useState('');
|
|
17
|
-
const bottomSheetRef =
|
|
17
|
+
const bottomSheetRef = useRef(null);
|
|
18
|
+
const snapPoints = ['60%']; // Set to 60% of screen height
|
|
19
|
+
|
|
18
20
|
useEffect(() => {
|
|
19
21
|
// Initialize selection state
|
|
20
22
|
const initialSelections = {};
|
|
@@ -23,6 +25,12 @@ export const Overlay = ({
|
|
|
23
25
|
});
|
|
24
26
|
setSelections(initialSelections);
|
|
25
27
|
getDetails();
|
|
28
|
+
|
|
29
|
+
// Present the bottom sheet when component mounts
|
|
30
|
+
setTimeout(() => {
|
|
31
|
+
var _bottomSheetRef$curre;
|
|
32
|
+
(_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 || _bottomSheetRef$curre.present();
|
|
33
|
+
}, 100);
|
|
26
34
|
}, []);
|
|
27
35
|
const getDetails = async () => {
|
|
28
36
|
try {
|
|
@@ -37,22 +45,17 @@ export const Overlay = ({
|
|
|
37
45
|
}
|
|
38
46
|
};
|
|
39
47
|
const closeOverlay = () => {
|
|
40
|
-
var _bottomSheetRef$
|
|
41
|
-
(_bottomSheetRef$
|
|
48
|
+
var _bottomSheetRef$curre2;
|
|
49
|
+
(_bottomSheetRef$curre2 = bottomSheetRef.current) === null || _bottomSheetRef$curre2 === void 0 || _bottomSheetRef$curre2.dismiss();
|
|
42
50
|
};
|
|
43
51
|
const confirmSelection = async () => {
|
|
44
52
|
try {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
default: 'unknown'
|
|
52
|
-
});
|
|
53
|
-
} catch (e) {
|
|
54
|
-
console.warn('Failed to get app identifier:', e);
|
|
55
|
-
}
|
|
53
|
+
// Mock app identifier
|
|
54
|
+
const appId = Platform.select({
|
|
55
|
+
ios: 'com.onairos.mock',
|
|
56
|
+
android: 'com.onairos.mock',
|
|
57
|
+
default: 'unknown'
|
|
58
|
+
});
|
|
56
59
|
const serverPublicKey = await getServerPublicKey();
|
|
57
60
|
const encryptedModelKey = encryptModelKey(serverPublicKey, modelKey);
|
|
58
61
|
const response = await onairosApi.post('getAPIUrlMobile', {
|
|
@@ -73,7 +76,7 @@ export const Overlay = ({
|
|
|
73
76
|
closeOverlay();
|
|
74
77
|
}
|
|
75
78
|
} catch (e) {
|
|
76
|
-
console.error('Error
|
|
79
|
+
console.error('Error confirming selection:', e);
|
|
77
80
|
showErrorModal('Failed to confirm selection. Please try again.');
|
|
78
81
|
}
|
|
79
82
|
};
|
|
@@ -85,11 +88,16 @@ export const Overlay = ({
|
|
|
85
88
|
const selectedCount = Object.values(selections).filter(Boolean).length;
|
|
86
89
|
return /*#__PURE__*/React.createElement(BottomSheetModal, {
|
|
87
90
|
ref: bottomSheetRef,
|
|
88
|
-
snapPoints:
|
|
91
|
+
snapPoints: snapPoints,
|
|
92
|
+
handleIndicatorStyle: styles.handleIndicator,
|
|
89
93
|
backdropComponent: props => /*#__PURE__*/React.createElement(BottomSheetBackdrop, _extends({}, props, {
|
|
90
94
|
appearsOnIndex: 0,
|
|
91
|
-
disappearsOnIndex: -1
|
|
92
|
-
|
|
95
|
+
disappearsOnIndex: -1,
|
|
96
|
+
opacity: 0.7
|
|
97
|
+
})),
|
|
98
|
+
enablePanDownToClose: true,
|
|
99
|
+
keyboardBehavior: "interactive",
|
|
100
|
+
keyboardBlurBehavior: "restore"
|
|
93
101
|
}, /*#__PURE__*/React.createElement(View, {
|
|
94
102
|
style: styles.container
|
|
95
103
|
}, /*#__PURE__*/React.createElement(View, {
|
|
@@ -139,12 +147,19 @@ export const Overlay = ({
|
|
|
139
147
|
style: styles.footerButtonText
|
|
140
148
|
}, "Confirm")))));
|
|
141
149
|
};
|
|
150
|
+
const {
|
|
151
|
+
width: SCREEN_WIDTH
|
|
152
|
+
} = Dimensions.get('window');
|
|
142
153
|
const styles = StyleSheet.create({
|
|
143
154
|
container: {
|
|
144
155
|
flex: 1,
|
|
145
156
|
backgroundColor: COLORS.white,
|
|
146
|
-
|
|
147
|
-
|
|
157
|
+
width: SCREEN_WIDTH
|
|
158
|
+
},
|
|
159
|
+
handleIndicator: {
|
|
160
|
+
backgroundColor: '#999',
|
|
161
|
+
width: 40,
|
|
162
|
+
height: 5
|
|
148
163
|
},
|
|
149
164
|
header: {
|
|
150
165
|
flexDirection: 'row',
|
|
@@ -167,7 +182,7 @@ const styles = StyleSheet.create({
|
|
|
167
182
|
},
|
|
168
183
|
username: {
|
|
169
184
|
fontSize: 18,
|
|
170
|
-
color: COLORS.
|
|
185
|
+
color: COLORS.white
|
|
171
186
|
},
|
|
172
187
|
content: {
|
|
173
188
|
flex: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useState","useEffect","View","Text","StyleSheet","TouchableOpacity","ScrollView","Alert","Platform","
|
|
1
|
+
{"version":3,"names":["React","useState","useEffect","useRef","View","Text","StyleSheet","TouchableOpacity","ScrollView","Alert","Platform","Dimensions","BottomSheetModal","BottomSheetBackdrop","COLORS","onairosApi","encryptModelKey","getServerPublicKey","Overlay","data","username","modelKey","onResolved","selections","setSelections","details","setDetails","bottomSheetRef","snapPoints","initialSelections","Object","keys","forEach","key","getDetails","setTimeout","_bottomSheetRef$curre","current","present","response","post","Info","AccountInfo","e","console","error","closeOverlay","_bottomSheetRef$curre2","dismiss","confirmSelection","appId","select","ios","android","default","serverPublicKey","encryptedModelKey","storage","confirmations","developerURL","EncryptedUserPin","account","proofMode","apiUrl","token","showErrorModal","errorMessage","alert","text","selectedCount","values","filter","Boolean","length","createElement","ref","handleIndicatorStyle","styles","handleIndicator","backdropComponent","props","_extends","appearsOnIndex","disappearsOnIndex","opacity","enablePanDownToClose","keyboardBehavior","keyboardBlurBehavior","style","container","header","headerTitle","onPress","closeButton","content","entries","map","value","card","checkboxContainer","prev","checkbox","checkboxSelected","cardContent","cardTitle","type","cardDescription","descriptions","reward","cardReward","footer","footerButton","footerButtonText","width","SCREEN_WIDTH","get","create","flex","backgroundColor","white","height","flexDirection","alignItems","justifyContent","padding","primary","borderTopLeftRadius","borderTopRightRadius","fontSize","color","fontWeight","borderRadius","marginBottom","shadowColor","black","shadowOffset","shadowOpacity","shadowRadius","elevation","borderWidth","borderColor","marginRight","gray","success","borderTopWidth","borderTopColor","lightGray","paddingVertical","paddingHorizontal"],"sourceRoot":"..\\..\\..\\src","sources":["components/Overlay.tsx"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAC1D,SACEC,IAAI,EACJC,IAAI,EACJC,UAAU,EACVC,gBAAgB,EAChBC,UAAU,EACVC,KAAK,EACLC,QAAQ,EACRC,UAAU,QACL,cAAc;AACrB,SAASC,gBAAgB,EAAEC,mBAAmB,QAAQ,sBAAsB;AAC5E;AACA,SAASC,MAAM,QAAQ,cAAc;AACrC,SAASC,UAAU,QAAQ,QAAQ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,eAAe,EAAE;IACfsB,QAAQ,EAAE,EAAE;IACZC,KAAK,EAAEnH,MAAM,CAACgI,IAAI;IAClBV,YAAY,EAAE;EAChB,CAAC;EACDvB,UAAU,EAAE;IACVmB,QAAQ,EAAE,EAAE;IACZC,KAAK,EAAEnH,MAAM,CAACiI,OAAO;IACrBb,UAAU,EAAE;EACd,CAAC;EACDpB,MAAM,EAAE;IACNW,aAAa,EAAE,KAAK;IACpBE,cAAc,EAAE,eAAe;IAC/BD,UAAU,EAAE,QAAQ;IACpBE,OAAO,EAAE,EAAE;IACXoB,cAAc,EAAE,CAAC;IACjBC,cAAc,EAAEnI,MAAM,CAACoI;EACzB,CAAC;EACDnC,YAAY,EAAE;IACZoC,eAAe,EAAE,CAAC;IAClBC,iBAAiB,EAAE,EAAE;IACrBjB,YAAY,EAAE,CAAC;IACfb,eAAe,EAAExG,MAAM,CAAC+G;EAC1B,CAAC;EACDb,gBAAgB,EAAE;IAChBiB,KAAK,EAAEnH,MAAM,CAACyG,KAAK;IACnBS,QAAQ,EAAE,EAAE;IACZE,UAAU,EAAE;EACd,CAAC;EACD7D,aAAa,EAAE;IACb2D,QAAQ,EAAE,EAAE;IACZC,KAAK,EAAEnH,MAAM,CAACgI;EAChB;AACF,CAAC,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,34 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import OnairosButton from './components/OnairosButton';
|
|
2
|
+
import * as AuthUtils from './utils/auth';
|
|
3
|
+
import * as CryptoUtils from './utils/crypto';
|
|
4
|
+
import * as ApiUtils from './utils/api';
|
|
5
5
|
|
|
6
|
-
//
|
|
7
|
-
export
|
|
8
|
-
export { PinCreationScreen } from './components/screens/PinCreationScreen';
|
|
9
|
-
export { LoadingScreen } from './components/screens/LoadingScreen';
|
|
6
|
+
// Export the main component
|
|
7
|
+
export default OnairosButton;
|
|
10
8
|
|
|
11
|
-
//
|
|
12
|
-
export {
|
|
13
|
-
export { PlatformConnector } from './components/onboarding/PlatformConnector';
|
|
14
|
-
export { OnboardingHeader } from './components/onboarding/OnboardingHeader';
|
|
15
|
-
export { PinInput } from './components/onboarding/PinInput';
|
|
16
|
-
|
|
17
|
-
// Hooks
|
|
18
|
-
export { useConnections } from './hooks/useConnections';
|
|
19
|
-
export { useCredentials } from './hooks/useCredentials';
|
|
20
|
-
|
|
21
|
-
// Utilities
|
|
22
|
-
export { storeCredentials, getCredentials, hasCredentials, deleteCredentials, updateCredentials, generateDeviceUsername, verifyCredentials } from './utils/secureStorage';
|
|
23
|
-
export { validateCredentials, createAccount, authenticate, refreshToken, getPlatformData, getUserProfile, updatePlatformConnections } from './utils/onairosApi';
|
|
24
|
-
export { rsaEncrypt, sha256, base64ToBuffer } from './utils/crypto';
|
|
25
|
-
export { logDebug, logError, isDebugMode } from './utils/debugHelper';
|
|
26
|
-
|
|
27
|
-
// Services
|
|
28
|
-
export { connectPlatform, disconnectPlatform, initializeOAuthService, cleanupOAuthService, storePlatformConnection } from './services/oauthService';
|
|
29
|
-
|
|
30
|
-
// Types
|
|
31
|
-
|
|
32
|
-
// Constants
|
|
33
|
-
export { COLORS, PLATFORMS, API_ENDPOINTS, STORAGE_KEYS, PIN_REQUIREMENTS, DEEP_LINK_CONFIG } from './constants';
|
|
9
|
+
// Export utilities for advanced usage
|
|
10
|
+
export { AuthUtils, CryptoUtils, ApiUtils };
|
|
34
11
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["OnairosButton","
|
|
1
|
+
{"version":3,"names":["OnairosButton","AuthUtils","CryptoUtils","ApiUtils"],"sourceRoot":"..\\..\\src","sources":["index.js"],"mappings":"AAAA,OAAOA,aAAa,MAAM,4BAA4B;AACtD,OAAO,KAAKC,SAAS,MAAM,cAAc;AACzC,OAAO,KAAKC,WAAW,MAAM,gBAAgB;AAC7C,OAAO,KAAKC,QAAQ,MAAM,aAAa;;AAEvC;AACA,eAAeH,aAAa;;AAE5B;AACA,SACEC,SAAS,EACTC,WAAW,EACXC,QAAQ","ignoreList":[]}
|
|
@@ -1,51 +1,15 @@
|
|
|
1
|
-
import * as Keychain from 'react-native-keychain';
|
|
2
1
|
import { Platform } from 'react-native';
|
|
3
2
|
import { sha256 } from './crypto';
|
|
4
|
-
|
|
3
|
+
// Temporary in-memory storage
|
|
4
|
+
let mockStorage = {};
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Store credentials
|
|
7
|
+
* Store credentials in memory (temporary solution)
|
|
8
8
|
*/
|
|
9
9
|
export const storeCredentials = async (credentials, options = {}) => {
|
|
10
10
|
try {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
biometricPrompt
|
|
14
|
-
} = options;
|
|
15
|
-
|
|
16
|
-
// Create a JSON string of the credentials
|
|
17
|
-
const credentialsString = JSON.stringify(credentials);
|
|
18
|
-
|
|
19
|
-
// Configure security options based on platform
|
|
20
|
-
const securityOptions = {
|
|
21
|
-
service: CREDENTIALS_KEY,
|
|
22
|
-
accessible: Keychain.ACCESSIBLE.WHEN_UNLOCKED_THIS_DEVICE_ONLY
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// Add biometric protection if requested
|
|
26
|
-
if (useBiometrics) {
|
|
27
|
-
// iOS specific options
|
|
28
|
-
if (Platform.OS === 'ios') {
|
|
29
|
-
securityOptions.accessControl = Keychain.ACCESS_CONTROL.BIOMETRY_ANY_OR_DEVICE_PASSCODE;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Android specific options
|
|
33
|
-
if (Platform.OS === 'android') {
|
|
34
|
-
securityOptions.accessControl = Keychain.ACCESS_CONTROL.BIOMETRY_ANY;
|
|
35
|
-
if (biometricPrompt) {
|
|
36
|
-
securityOptions.authenticationType = Keychain.AUTHENTICATION_TYPE.BIOMETRIC;
|
|
37
|
-
securityOptions.authenticationPrompt = {
|
|
38
|
-
title: biometricPrompt.title || 'Biometric Authentication',
|
|
39
|
-
subtitle: biometricPrompt.subtitle,
|
|
40
|
-
description: 'Please authenticate to access your Onairos credentials',
|
|
41
|
-
cancel: 'Cancel'
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Store in the secure keychain
|
|
48
|
-
await Keychain.setGenericPassword(credentials.username, credentialsString, securityOptions);
|
|
11
|
+
console.log('[Mock] Storing credentials:', credentials.username);
|
|
12
|
+
mockStorage[credentials.username] = JSON.stringify(credentials);
|
|
49
13
|
return true;
|
|
50
14
|
} catch (error) {
|
|
51
15
|
console.error('Error storing credentials:', error);
|
|
@@ -54,39 +18,16 @@ export const storeCredentials = async (credentials, options = {}) => {
|
|
|
54
18
|
};
|
|
55
19
|
|
|
56
20
|
/**
|
|
57
|
-
* Retrieve credentials from
|
|
21
|
+
* Retrieve credentials from memory (temporary solution)
|
|
58
22
|
*/
|
|
59
23
|
export const getCredentials = async (options = {}) => {
|
|
60
24
|
try {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} = options;
|
|
65
|
-
|
|
66
|
-
// Configure security options
|
|
67
|
-
const securityOptions = {
|
|
68
|
-
service: CREDENTIALS_KEY
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
// Add biometric prompt if required
|
|
72
|
-
if (useBiometrics && biometricPrompt) {
|
|
73
|
-
securityOptions.authenticationPrompt = {
|
|
74
|
-
title: biometricPrompt.title || 'Biometric Authentication',
|
|
75
|
-
subtitle: biometricPrompt.subtitle,
|
|
76
|
-
description: 'Please authenticate to access your Onairos credentials',
|
|
77
|
-
cancel: 'Cancel'
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Retrieve from keychain
|
|
82
|
-
const result = await Keychain.getGenericPassword(securityOptions);
|
|
83
|
-
if (!result) {
|
|
25
|
+
// Get the first stored credential (temporary solution)
|
|
26
|
+
const storedCredential = Object.values(mockStorage)[0];
|
|
27
|
+
if (!storedCredential) {
|
|
84
28
|
return null;
|
|
85
29
|
}
|
|
86
|
-
|
|
87
|
-
// Parse the stored JSON
|
|
88
|
-
const credentials = JSON.parse(result.password);
|
|
89
|
-
return credentials;
|
|
30
|
+
return JSON.parse(storedCredential);
|
|
90
31
|
} catch (error) {
|
|
91
32
|
console.error('Error retrieving credentials:', error);
|
|
92
33
|
return null;
|
|
@@ -98,10 +39,7 @@ export const getCredentials = async (options = {}) => {
|
|
|
98
39
|
*/
|
|
99
40
|
export const hasCredentials = async () => {
|
|
100
41
|
try {
|
|
101
|
-
|
|
102
|
-
service: CREDENTIALS_KEY
|
|
103
|
-
});
|
|
104
|
-
return !!result;
|
|
42
|
+
return Object.keys(mockStorage).length > 0;
|
|
105
43
|
} catch (error) {
|
|
106
44
|
console.error('Error checking for credentials:', error);
|
|
107
45
|
return false;
|
|
@@ -113,9 +51,7 @@ export const hasCredentials = async () => {
|
|
|
113
51
|
*/
|
|
114
52
|
export const deleteCredentials = async () => {
|
|
115
53
|
try {
|
|
116
|
-
|
|
117
|
-
service: CREDENTIALS_KEY
|
|
118
|
-
});
|
|
54
|
+
mockStorage = {};
|
|
119
55
|
return true;
|
|
120
56
|
} catch (error) {
|
|
121
57
|
console.error('Error deleting credentials:', error);
|
|
@@ -128,19 +64,14 @@ export const deleteCredentials = async () => {
|
|
|
128
64
|
*/
|
|
129
65
|
export const updateCredentials = async (updates, options = {}) => {
|
|
130
66
|
try {
|
|
131
|
-
// Get current credentials
|
|
132
67
|
const currentCredentials = await getCredentials(options);
|
|
133
68
|
if (!currentCredentials) {
|
|
134
69
|
return false;
|
|
135
70
|
}
|
|
136
|
-
|
|
137
|
-
// Merge updates with current credentials
|
|
138
71
|
const updatedCredentials = {
|
|
139
72
|
...currentCredentials,
|
|
140
73
|
...updates
|
|
141
74
|
};
|
|
142
|
-
|
|
143
|
-
// Store updated credentials
|
|
144
75
|
return await storeCredentials(updatedCredentials, options);
|
|
145
76
|
} catch (error) {
|
|
146
77
|
console.error('Error updating credentials:', error);
|
|
@@ -153,40 +84,21 @@ export const updateCredentials = async (updates, options = {}) => {
|
|
|
153
84
|
*/
|
|
154
85
|
export const generateDeviceUsername = async () => {
|
|
155
86
|
try {
|
|
156
|
-
// Get a device-specific identifier that we can use
|
|
157
|
-
// This is a simplified example - in production you might want to use
|
|
158
|
-
// a more robust device identifier method
|
|
159
87
|
const deviceInfo = `${Platform.OS}-${Platform.Version}-${Date.now()}`;
|
|
160
|
-
|
|
161
|
-
// Hash it to create a unique identifier
|
|
162
88
|
const username = `onairos_${sha256(deviceInfo).substring(0, 10)}`;
|
|
163
89
|
return username;
|
|
164
90
|
} catch (error) {
|
|
165
91
|
console.error('Error generating device username:', error);
|
|
166
|
-
// Fallback to a timestamp-based username if there's an error
|
|
167
92
|
return `onairos_${Date.now().toString(36)}`;
|
|
168
93
|
}
|
|
169
94
|
};
|
|
170
95
|
|
|
171
96
|
/**
|
|
172
|
-
* Verify
|
|
97
|
+
* Verify credentials (temporary mock implementation)
|
|
173
98
|
*/
|
|
174
99
|
export const verifyCredentials = async credentials => {
|
|
175
100
|
try {
|
|
176
|
-
|
|
177
|
-
if (!credentials || !credentials.accessToken || !credentials.username) {
|
|
178
|
-
return false;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// Check for expiration (example: credentials expire after 30 days)
|
|
182
|
-
const thirtyDaysMs = 30 * 24 * 60 * 60 * 1000;
|
|
183
|
-
const isExpired = Date.now() - credentials.createdAt > thirtyDaysMs;
|
|
184
|
-
if (isExpired) {
|
|
185
|
-
return false;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// Add any additional verification logic here
|
|
189
|
-
|
|
101
|
+
console.log('[Mock] Verifying credentials for:', credentials.username);
|
|
190
102
|
return true;
|
|
191
103
|
} catch (error) {
|
|
192
104
|
console.error('Error verifying credentials:', error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["Platform","sha256","mockStorage","storeCredentials","credentials","options","console","log","username","JSON","stringify","error","getCredentials","storedCredential","Object","values","parse","hasCredentials","keys","length","deleteCredentials","updateCredentials","updates","currentCredentials","updatedCredentials","generateDeviceUsername","deviceInfo","OS","Version","Date","now","substring","toString","verifyCredentials"],"sourceRoot":"..\\..\\..\\src","sources":["utils/secureStorage.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,MAAM,QAAQ,UAAU;AAwBjC;AACA,IAAIC,WAAsC,GAAG,CAAC,CAAC;;AAE/C;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAG,MAAAA,CAC9BC,WAA+B,EAC/BC,OAAuB,GAAG,CAAC,CAAC,KACP;EACrB,IAAI;IACFC,OAAO,CAACC,GAAG,CAAC,6BAA6B,EAAEH,WAAW,CAACI,QAAQ,CAAC;IAChEN,WAAW,CAACE,WAAW,CAACI,QAAQ,CAAC,GAAGC,IAAI,CAACC,SAAS,CAACN,WAAW,CAAC;IAC/D,OAAO,IAAI;EACb,CAAC,CAAC,OAAOO,KAAK,EAAE;IACdL,OAAO,CAACK,KAAK,CAAC,4BAA4B,EAAEA,KAAK,CAAC;IAClD,OAAO,KAAK;EACd;AACF,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAG,MAAAA,CAC5BP,OAAuB,GAAG,CAAC,CAAC,KACW;EACvC,IAAI;IACF;IACA,MAAMQ,gBAAgB,GAAGC,MAAM,CAACC,MAAM,CAACb,WAAW,CAAC,CAAC,CAAC,CAAC;IACtD,IAAI,CAACW,gBAAgB,EAAE;MACrB,OAAO,IAAI;IACb;IACA,OAAOJ,IAAI,CAACO,KAAK,CAACH,gBAAgB,CAAC;EACrC,CAAC,CAAC,OAAOF,KAAK,EAAE;IACdL,OAAO,CAACK,KAAK,CAAC,+BAA+B,EAAEA,KAAK,CAAC;IACrD,OAAO,IAAI;EACb;AACF,CAAC;;AAED;AACA;AACA;AACA,O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