Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-example-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
node-version: '22'

- name: Set up JDK 17
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'
Expand All @@ -26,7 +26,7 @@ jobs:
yarn setup

- name: Cache Gradle packages
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"workspaces": {
"packages": [
"packages/*",
"packages/connect-examples/shared-constants",
"packages/connect-examples/expo-example",
"packages/connect-examples/electron-example",
"packages/connect-examples/expo-playground"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,32 @@ export default function CommonParamsView() {
return (
<PanelView title={intl.formatMessage({ id: 'title__common_parameters' })}>
<Stack gap="$4" flexDirection="row" flexWrap="wrap">
<CommonInput
label="Passphrase State"
type="text"
value={commonParams.passphraseState ?? ''}
onChange={value => handleSetParam('passphraseState', value)}
/>
<SwitchInput
label={intl.formatMessage({ id: 'label__use_empty_passphrase' })}
value={!!commonParams.useEmptyPassphrase}
onToggle={value => handleSetParam('useEmptyPassphrase', value)}
/>
<SwitchInput
label="skipPassphraseCheck"
value={!!commonParams.skipPassphraseCheck}
onToggle={value => handleSetParam('skipPassphraseCheck', value)}
/>
<SwitchInput
label={intl.formatMessage({ id: 'label__keep_session' })}
value={!!commonParams.keepSession}
onToggle={value => handleSetParam('keepSession', value)}
/>
<SwitchInput
label={intl.formatMessage({ id: 'label__init_session' })}
value={!!commonParams.initSession}
onToggle={value => handleSetParam('initSession', value)}
/>
<CommonInput
label={intl.formatMessage({ id: 'label__retry_count' })}
type="number"
Expand All @@ -39,22 +60,6 @@ export default function CommonParamsView() {
value={commonParams.timeout?.toString() ?? ''}
onChange={value => handleSetParam('timeout', parseInt(value))}
/>
<CommonInput
label="Passphrase State"
type="text"
value={commonParams.passphraseState ?? ''}
onChange={value => handleSetParam('passphraseState', value)}
/>
<SwitchInput
label={intl.formatMessage({ id: 'label__init_session' })}
value={!!commonParams.initSession}
onToggle={value => handleSetParam('initSession', value)}
/>
<SwitchInput
label={intl.formatMessage({ id: 'label__use_empty_passphrase' })}
value={!!commonParams.useEmptyPassphrase}
onToggle={value => handleSetParam('useEmptyPassphrase', value)}
/>
<SwitchInput
label="detectBootloaderDevice"
value={!!commonParams.detectBootloaderDevice}
Expand All @@ -65,11 +70,6 @@ export default function CommonParamsView() {
value={!!commonParams.skipWebDevicePrompt}
onToggle={value => handleSetParam('skipWebDevicePrompt', value)}
/>
<SwitchInput
label="skipPassphraseCheck"
value={!!commonParams.skipPassphraseCheck}
onToggle={value => handleSetParam('skipPassphraseCheck', value)}
/>
</Stack>
</PanelView>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// eslint-disable-next-line import/no-relative-packages
import { getConnectSrc } from '../../../constants';
import { getConnectSrc } from '@onekey-internal/shared-constants';

export const CONNECT_SRC = getConnectSrc();
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getConnectSrc } from '../../../constants';
import { getConnectSrc } from '@onekey-internal/shared-constants';

/**
* OneKey Hardware SDK Connect Source Configuration
Expand Down
10 changes: 10 additions & 0 deletions packages/connect-examples/shared-constants/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@onekey-internal/shared-constants",
"version": "1.1.10-alpha.2",
"private": true,
"author": "OneKey",
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
"license": "ISC",
"type": "module",
"main": "constants.js"
}
41 changes: 41 additions & 0 deletions patches/react-native-crypto+2.2.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
diff --git a/node_modules/react-native-crypto/index.js b/node_modules/react-native-crypto/index.js
index f644543..bf38ebb 100644
--- a/node_modules/react-native-crypto/index.js
+++ b/node_modules/react-native-crypto/index.js
@@ -1,28 +1,16 @@
'use strict'
+import { getRandomValues } from 'react-native-get-random-values';

-import { randomBytes } from 'react-native-randombytes'
-exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = randomBytes
-
-// implement window.getRandomValues(), for packages that rely on it
-if (typeof window === 'object') {
- if (!window.crypto) window.crypto = {}
- if (!window.crypto.getRandomValues) {
- window.crypto.getRandomValues = function getRandomValues (arr) {
- let orig = arr
- if (arr.byteLength != arr.length) {
- // Get access to the underlying raw bytes
- arr = new Uint8Array(arr.buffer)
- }
- const bytes = randomBytes(arr.length)
- for (var i = 0; i < bytes.length; i++) {
- arr[i] = bytes[i]
- }
-
- return orig
- }
+if (typeof globalThis === 'object') {
+ if (!globalThis.crypto) {
+ globalThis.crypto = {};
+ }
+ if (!globalThis.crypto.getRandomValues) {
+ globalThis.crypto.getRandomValues = getRandomValues;
}
}

+
exports.createHash = exports.Hash = require('create-hash')
exports.createHmac = exports.Hmac = require('create-hmac')