@onekeyfe/react-native-lite-card 1.0.11 → 1.0.13
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/LICENSE.md +51 -0
- package/android/build.gradle +1 -1
- package/android/gradle.properties +4 -4
- package/android/src/main/cpp/CMakeLists.txt +4 -0
- package/android/src/main/java/so/onekey/app/wallet/lite/OKLiteManager.kt +41 -30
- package/android/src/main/java/so/onekey/app/wallet/lite/nfc/NfcUtils.kt +0 -9
- package/android/src/main/java/so/onekey/app/wallet/lite/onekeyLite/OnekeyLiteCard.kt +1 -1
- package/android/src/main/jniLibs/arm64-v8a/libgpchannelNDK.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libgpchannelNDK.so +0 -0
- package/package.json +1 -1
- package/LICENSE +0 -20
package/LICENSE.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# ONEKEY STANDARD SOURCE LICENSE (O-SSL)
|
|
2
|
+
|
|
3
|
+
This license governs use of the accompanying software. If you use the software,
|
|
4
|
+
you accept this license. If you do not accept the license, do not use the
|
|
5
|
+
software.
|
|
6
|
+
|
|
7
|
+
## 1. Definitions
|
|
8
|
+
|
|
9
|
+
The terms "reproduce," "reproduction" and "distribution" have the same meaning
|
|
10
|
+
here as under Hong Kong copyright law.
|
|
11
|
+
|
|
12
|
+
"You" means the licensee of the software.
|
|
13
|
+
|
|
14
|
+
"Your company" means the company you worked for when you downloaded the
|
|
15
|
+
software.
|
|
16
|
+
|
|
17
|
+
"Reference use" means use of the software within your company as a reference,
|
|
18
|
+
in read only form, for the sole purposes of debugging your products,
|
|
19
|
+
maintaining your products, or enhancing the interoperability of your products
|
|
20
|
+
with the software, and specifically excludes the right to distribute the
|
|
21
|
+
software outside of your company.
|
|
22
|
+
|
|
23
|
+
"Licensed patents" means any Licensor patent claims which read directly on the
|
|
24
|
+
software as distributed by the Licensor under this license.
|
|
25
|
+
|
|
26
|
+
## 2. Grant of Rights
|
|
27
|
+
|
|
28
|
+
(A) Copyright Grant - Subject to the terms of this license, the Licensor grants
|
|
29
|
+
you a non-transferable, non-exclusive, worldwide, royalty-free copyright
|
|
30
|
+
license to reproduce the software for reference use.
|
|
31
|
+
|
|
32
|
+
(B) Patent Grant - Subject to the terms of this license, the Licensor grants
|
|
33
|
+
you a non-transferable, non-exclusive, worldwide, royalty-free patent license
|
|
34
|
+
under licensed patents for reference use.
|
|
35
|
+
|
|
36
|
+
## 3. Limitations
|
|
37
|
+
|
|
38
|
+
(A) No Trademark License - This license does not grant you any rights to use
|
|
39
|
+
the Licensor's name, logo, or trademarks.
|
|
40
|
+
|
|
41
|
+
(B) If you begin patent litigation against the Licensor over patents that you
|
|
42
|
+
think may apply to the software (including a cross-claim or counterclaim in
|
|
43
|
+
a lawsuit), your license to the software ends automatically.
|
|
44
|
+
|
|
45
|
+
(C) The software is licensed "as-is." You bear the risk of using it. The
|
|
46
|
+
Licensor gives no express warranties, guarantees or conditions. You may have
|
|
47
|
+
additional consumer rights under your local laws which this license cannot
|
|
48
|
+
change. To the extent permitted under your local laws, the Licensor excludes
|
|
49
|
+
the implied warranties of merchantability, fitness for a particular purpose and
|
|
50
|
+
non-infringement.This license agreement is governed by the laws of Hong Kong,
|
|
51
|
+
and any disputes related to this license agreement shall be resolved in accordance with Hong Kong law.
|
package/android/build.gradle
CHANGED
|
@@ -8,7 +8,7 @@ buildscript {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
dependencies {
|
|
11
|
-
classpath "com.android.tools.build:gradle:
|
|
11
|
+
classpath "com.android.tools.build:gradle:8.0.2"
|
|
12
12
|
// noinspection DifferentKotlinGradleVersion
|
|
13
13
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
14
14
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
LiteCard_kotlinVersion=1.
|
|
1
|
+
LiteCard_kotlinVersion=2.1.20
|
|
2
2
|
LiteCard_minSdkVersion=21
|
|
3
|
-
LiteCard_targetSdkVersion=
|
|
4
|
-
LiteCard_compileSdkVersion=
|
|
5
|
-
LiteCard_ndkversion=
|
|
3
|
+
LiteCard_targetSdkVersion=35
|
|
4
|
+
LiteCard_compileSdkVersion=35
|
|
5
|
+
LiteCard_ndkversion=26.1.10909125
|
|
@@ -5,6 +5,10 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Os -Oz")
|
|
|
5
5
|
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
|
6
6
|
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
|
7
7
|
|
|
8
|
+
# Support for Android 15 16KB page size
|
|
9
|
+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,max-page-size=16384")
|
|
10
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-z,max-page-size=16384")
|
|
11
|
+
|
|
8
12
|
add_library(keys SHARED
|
|
9
13
|
../../../../keys/keys.c
|
|
10
14
|
validation.c)
|
|
@@ -323,18 +323,20 @@ class OKLiteManager(private val context: ReactApplicationContext) :
|
|
|
323
323
|
}
|
|
324
324
|
|
|
325
325
|
@ReactMethod
|
|
326
|
-
fun getLiteInfo(callback: Callback)
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
326
|
+
fun getLiteInfo(callback: Callback) {
|
|
327
|
+
launch {
|
|
328
|
+
Log.d(TAG, "getLiteInfo")
|
|
329
|
+
handleOperation(callback) { isoDep ->
|
|
330
|
+
Log.e(TAG, "getLiteInfo Obtain the device")
|
|
331
|
+
val cardInfo = OneKeyLiteCard.getCardInfo(isoDep)
|
|
332
|
+
Log.e(TAG, "getLiteInfo result $cardInfo")
|
|
333
|
+
cardInfo.createArguments()
|
|
334
|
+
}
|
|
333
335
|
}
|
|
334
336
|
}
|
|
335
337
|
|
|
336
338
|
@ReactMethod
|
|
337
|
-
fun setMnemonic(mnemonic: String, pwd: String, overwrite: Boolean, callback: Callback)
|
|
339
|
+
fun setMnemonic(mnemonic: String, pwd: String, overwrite: Boolean, callback: Callback) {
|
|
338
340
|
launch {
|
|
339
341
|
handleOperation(callback) { isoDep ->
|
|
340
342
|
Log.e(TAG, "setMnemonic Obtain the device")
|
|
@@ -345,22 +347,27 @@ class OKLiteManager(private val context: ReactApplicationContext) :
|
|
|
345
347
|
true
|
|
346
348
|
}
|
|
347
349
|
}
|
|
350
|
+
}
|
|
348
351
|
|
|
349
352
|
@ReactMethod
|
|
350
|
-
fun getMnemonicWithPin(pwd: String, callback: Callback)
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
353
|
+
fun getMnemonicWithPin(pwd: String, callback: Callback) {
|
|
354
|
+
launch {
|
|
355
|
+
Log.d(TAG, "getMnemonicWithPin")
|
|
356
|
+
handleOperation(callback) { isoDep ->
|
|
357
|
+
Log.e(TAG, "getMnemonicWithPin Obtain the device")
|
|
358
|
+
OneKeyLiteCard.getMnemonicWithPin(mCurrentCardState, isoDep, pwd)
|
|
359
|
+
}
|
|
355
360
|
}
|
|
356
361
|
}
|
|
357
362
|
|
|
358
363
|
@ReactMethod
|
|
359
|
-
fun changePin(oldPwd: String, newPwd: String, callback: Callback)
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
+
fun changePin(oldPwd: String, newPwd: String, callback: Callback) {
|
|
365
|
+
launch {
|
|
366
|
+
Log.d(TAG, "changePin")
|
|
367
|
+
handleOperation(callback) { isoDep ->
|
|
368
|
+
Log.e(TAG, "changePin Obtain the device")
|
|
369
|
+
OneKeyLiteCard.changPin(mCurrentCardState, isoDep, oldPwd, newPwd)
|
|
370
|
+
}
|
|
364
371
|
}
|
|
365
372
|
}
|
|
366
373
|
|
|
@@ -396,22 +403,26 @@ class OKLiteManager(private val context: ReactApplicationContext) :
|
|
|
396
403
|
}
|
|
397
404
|
|
|
398
405
|
@ReactMethod
|
|
399
|
-
fun reset(callback: Callback)
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
406
|
+
fun reset(callback: Callback) {
|
|
407
|
+
launch {
|
|
408
|
+
Log.d(TAG, "reset")
|
|
409
|
+
handleOperation(callback) { isoDep ->
|
|
410
|
+
Log.e(TAG, "reset Obtain the device")
|
|
411
|
+
val isSuccess = OneKeyLiteCard.reset(isoDep)
|
|
412
|
+
if (!isSuccess) throw NFCExceptions.ExecFailureException()
|
|
413
|
+
Log.e(TAG, "reset result success")
|
|
414
|
+
true
|
|
415
|
+
}
|
|
407
416
|
}
|
|
408
417
|
}
|
|
409
418
|
|
|
410
419
|
@ReactMethod
|
|
411
|
-
fun intoSetting()
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
420
|
+
fun intoSetting() {
|
|
421
|
+
launch {
|
|
422
|
+
Log.d(TAG, "intoSetting")
|
|
423
|
+
Utils.getTopActivity()?.let {
|
|
424
|
+
NfcUtils.intentToNfcSetting(it)
|
|
425
|
+
}
|
|
415
426
|
}
|
|
416
427
|
}
|
|
417
428
|
}
|
|
@@ -101,15 +101,6 @@ object NfcUtils {
|
|
|
101
101
|
* @return `true` 跳转成功 <br></br> `false` 跳转失败
|
|
102
102
|
*/
|
|
103
103
|
fun intentToNfcSetting(context: Context): Boolean {
|
|
104
|
-
if ("Smartisan".equals(Build.MANUFACTURER, true)) {
|
|
105
|
-
if (intentToNfcShare(context)) {
|
|
106
|
-
return true
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
if ("xiaomi".equals(Build.MANUFACTURER, true)) {
|
|
110
|
-
MiUtil.intentToAppSetting(context)
|
|
111
|
-
return true
|
|
112
|
-
}
|
|
113
104
|
if (isNfcExits(context)) {
|
|
114
105
|
return toIntent(context, Settings.ACTION_NFC_SETTINGS)
|
|
115
106
|
}
|
|
@@ -39,7 +39,7 @@ object OneKeyLiteCard {
|
|
|
39
39
|
|
|
40
40
|
NfcPermissionUtils.checkPermission(activity) {
|
|
41
41
|
printLog(TAG, "startNfc Have permission")
|
|
42
|
-
if (!activity.
|
|
42
|
+
if (!activity.lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED)) {
|
|
43
43
|
return@checkPermission
|
|
44
44
|
}
|
|
45
45
|
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/LICENSE
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 OneKeyHQ
|
|
4
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
in the Software without restriction, including without limitation the rights
|
|
7
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
furnished to do so, subject to the following conditions:
|
|
10
|
-
|
|
11
|
-
The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
copies or substantial portions of the Software.
|
|
13
|
-
|
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
SOFTWARE.
|