Skip to content

Commit 0aef2b1

Browse files
committed
feat: using package next
1 parent 63c1c69 commit 0aef2b1

File tree

5 files changed

+84
-70
lines changed

5 files changed

+84
-70
lines changed

App.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ import WebView from 'react-native-webview';
1515
import html from './asset/interpolate.html';
1616
import OraiServiceProvider from '@oraichain/service-provider-orai';
1717
import { LOGIN_TYPE } from '@oraichain/customauth';
18-
18+
console.log(process.env.ANDROID_CLIENT_ID);
1919
GoogleSignin.configure({
20-
iosClientId: process.env.IOS_CLIENT_ID
20+
iosClientId: process.env.IOS_CLIENT_ID,
21+
webClientId: process.env.ANDROID_CLIENT_ID
2122
});
2223

2324
const theme = createTheme({
@@ -40,6 +41,8 @@ const App = () => {
4041

4142
const onLogin = async ({ typeOfLogin, verifier, clientId, idToken }: { typeOfLogin: LOGIN_TYPE; verifier: string; clientId: string; idToken: string }) => {
4243
try {
44+
const start = Date.now();
45+
console.log('triggerLoginMobile 1:', Date.now());
4346
const [v1Data] = await Promise.all([
4447
(onlySocialKey.serviceProvider as OraiServiceProvider).triggerLoginMobile({
4548
typeOfLogin,
@@ -48,6 +51,7 @@ const App = () => {
4851
idToken
4952
})
5053
]);
54+
console.log('triggerLoginMobile 2:', Date.now());
5155
console.log({ v1Data });
5256

5357
setLoginResponse(v1Data);
@@ -64,8 +68,8 @@ const App = () => {
6468
if (userInfoData.idToken) {
6569
await onLogin({
6670
typeOfLogin: 'google',
67-
verifier: 'ios-tkey',
68-
clientId: '88022207528-b4i9ai34taasskcb9jokj8j6gigmta8k.apps.googleusercontent.com',
71+
verifier: 'tkey-google-staging',
72+
clientId: process.env.ANDROID_CLIENT_ID,
6973
idToken: userInfoData.idToken
7074
});
7175
}
@@ -134,6 +138,7 @@ const App = () => {
134138
setLoginResponse(null);
135139
return console.log('🚀 ~ file: index.tsx:131 ~ error:', error);
136140
}
141+
console.log('triggerLoginMobile 3:', Date.now());
137142
setInterpolateResult(result);
138143
}}
139144
/>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<script type="module">
6+
import init, {interpolate, get_pk} from 'https://unpkg.com/@oraichain/[email protected]/blsdkg.js';
7+
const fromHexString = (hexString) =>
8+
Uint8Array.from(hexString.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)));
9+
10+
const toHexString = (bytes) => bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), '');
11+
12+
init().then(() => {
13+
try {
14+
let shares = JSON.parse(window.shares);
15+
shares = shares.map((share) => fromHexString(share));
16+
let indexes = JSON.parse(window.indexes);
17+
indexes = indexes.map((index) => fromHexString(index));
18+
const privKey = interpolate(indexes, shares);
19+
const pubKey = get_pk(privKey);
20+
const result = {
21+
privKey: toHexString(privKey),
22+
pubKey: toHexString(pubKey)
23+
};
24+
window.ReactNativeWebView.postMessage(JSON.stringify({result}));
25+
} catch (error) {
26+
window.ReactNativeWebView.postMessage(JSON.stringify({error: error.message}));
27+
}
28+
});
29+
</script>
30+
</head>
31+
32+
</html>

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = {
1111
"module-resolver",
1212
{
1313
alias: {
14-
"bn.js": "react-native-bignumber",
14+
// "bn.js": "react-native-bignumber",
1515
},
1616
},
1717
],

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
},
1212
"dependencies": {
1313
"@invertase/react-native-apple-authentication": "^2.2.2",
14-
"@oraichain/customauth": "^2.0.0",
15-
"@oraichain/only-social-key": "^2.0.0",
16-
"@oraichain/service-provider-orai": "^2.0.0",
17-
"@oraichain/storage-layer-orai": "^2.0.0",
18-
"@oraichain/multifactors.js": "^2.0.0",
14+
"@oraichain/customauth": "next",
15+
"@oraichain/only-social-key": "next",
16+
"@oraichain/service-provider-orai": "next",
17+
"@oraichain/storage-layer-orai": "next",
18+
"@oraichain/multifactors.js": "next",
1919
"@react-native-google-signin/google-signin": "^10.0.1",
2020
"@rneui/base": "^4.0.0-rc.8",
2121
"@rneui/themed": "^4.0.0-rc.8",
@@ -31,7 +31,6 @@
3131
"os-browserify": "^0.3.0",
3232
"react": "18.2.0",
3333
"react-native": "0.72.5",
34-
"react-native-bignumber": "^0.2.1",
3534
"react-native-dotenv": "^3.4.9",
3635
"react-native-randombytes": "^3.6.1",
3736
"react-native-safe-area-context": "^4.7.2",

yarn.lock

Lines changed: 37 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,14 +1156,6 @@
11561156
resolved "https://registry.yarnpkg.com/@chaitanyapotti/register-service-worker/-/register-service-worker-1.7.3.tgz#0e670b8a4de1c319a147700d7ebb4f8a2b2e1b84"
11571157
integrity sha512-ywnUSfwvqdHchO3ELFWP6hlnhzc2UUETbk+TaBT/vicuMnJbnBLuDCcoy3aWvUE9bjmzg4QQpssRLSz1iZ7XRA==
11581158

1159-
"@craftzdog/react-native-buffer@^6.0.4":
1160-
version "6.0.5"
1161-
resolved "https://registry.yarnpkg.com/@craftzdog/react-native-buffer/-/react-native-buffer-6.0.5.tgz#0d4fbe0dd104186d2806655e3c0d25cebdae91d3"
1162-
integrity sha512-Av+YqfwA9e7jhgI9GFE/gTpwl/H+dRRLmZyJPOpKTy107j9Oj7oXlm3/YiMNz+C/CEGqcKAOqnXDLs4OL6AAFw==
1163-
dependencies:
1164-
ieee754 "^1.2.1"
1165-
react-native-quick-base64 "^2.0.5"
1166-
11671159
"@eslint-community/eslint-utils@^4.2.0":
11681160
version "4.4.0"
11691161
resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59"
@@ -1568,26 +1560,26 @@
15681560
"@nodelib/fs.scandir" "2.1.5"
15691561
fastq "^1.6.0"
15701562

1571-
"@oraichain/common-types@^2.0.0":
1572-
version "2.0.0"
1573-
resolved "https://registry.yarnpkg.com/@oraichain/common-types/-/common-types-2.0.0.tgz#3f2b0cfc061ae33888718e17173b166d955563a1"
1574-
integrity sha512-opYhp8zJnvtM+rNhO/aXQiW9GNJRvCiSaoF0XI5jnTyANV5FvaktBsPEHT1+1zx14LVBNtnw0yb0yEhUMO8MNg==
1563+
"@oraichain/common-types@^2.0.4":
1564+
version "2.0.4"
1565+
resolved "https://registry.npmjs.org/@oraichain/common-types/-/common-types-2.0.4.tgz#067a2da80875f16424d2f47bb7cca65eb9a31f7d"
1566+
integrity sha512-UDLASFg3o79yfW/7QQSuND4BNTiBs0blDLGLWIUeWluSGvwAWGIF75NuR+ew7QGhFoLvNi+TPO9zpmO2hAaChw==
15751567
dependencies:
1576-
"@oraichain/customauth" "^2.0.0"
1568+
"@oraichain/customauth" "^2.0.4"
15771569
"@toruslabs/eccrypto" "^1.1.8"
15781570
bn.js "^5.2.1"
15791571
elliptic "^6.5.4"
15801572
serialize-error "^8.1.0"
15811573
ts-custom-error "^3.3.1"
15821574
web3-utils "^1.8.1"
15831575

1584-
"@oraichain/customauth@^2.0.0":
1585-
version "2.0.0"
1586-
resolved "https://registry.yarnpkg.com/@oraichain/customauth/-/customauth-2.0.0.tgz#13e89d5af96b175bd4b7fbe78889565dac7014fb"
1587-
integrity sha512-uuoLwmHgBh/wd/vPmSO9IhhPGml0jnTFh58UKbQ0goSMJSe3m/ClCc6wQIwsNoQA45NUZ5l68h/yNQvOyDQwNQ==
1576+
"@oraichain/customauth@^2.0.4", "@oraichain/customauth@next":
1577+
version "2.0.4"
1578+
resolved "https://registry.npmjs.org/@oraichain/customauth/-/customauth-2.0.4.tgz#b3c7c0d76ee10945ce4600889aa93e75dce2a12e"
1579+
integrity sha512-z+o466yAYyStyr+aPYB01XTHXOS8NJqTIC9jNvKpcp6iFp5rjcT7xVQVRMRf1UaboEiKqJlWsjtvnpTUO3lWSQ==
15881580
dependencies:
15891581
"@chaitanyapotti/register-service-worker" "^1.7.3"
1590-
"@oraichain/multifactors.js" "^2.0.0"
1582+
"@oraichain/multifactors.js" "^2.0.4"
15911583
"@toruslabs/broadcast-channel" "^6.2.0"
15921584
"@toruslabs/eccrypto" "^2.0.0"
15931585
"@toruslabs/http-helpers" "^3.3.0"
@@ -1600,10 +1592,10 @@
16001592
serialize-error "^8.1.0"
16011593
web3-utils "^1.8.2"
16021594

1603-
"@oraichain/multifactors.js@^2.0.0":
1604-
version "2.0.0"
1605-
resolved "https://registry.yarnpkg.com/@oraichain/multifactors.js/-/multifactors.js-2.0.0.tgz#cb3851e4f795db1e3530cfb102a8aa81e78f6bb5"
1606-
integrity sha512-fbNq3oiGhi8VJD25JvYX6o9sTymCwkVZYp/Gv49xeLzUrcok+PQjiNwqPdkTCncc5LPECz/FF4xzw3EoBR9/1A==
1595+
"@oraichain/multifactors.js@^2.0.4", "@oraichain/multifactors.js@next":
1596+
version "2.0.4"
1597+
resolved "https://registry.npmjs.org/@oraichain/multifactors.js/-/multifactors.js-2.0.4.tgz#48c591e6d601d7b5f95608fa335b4450fbc7f937"
1598+
integrity sha512-KC8NQpc572q7miwBxQtDKyyb8GFSqEgr0A8gNX4Jt4ggDfWh7Gks5S+0exTxR+YEF1xPaZZ92ylWW2xtXuZ2Vw==
16071599
dependencies:
16081600
"@toruslabs/eccrypto" "^2.0.0"
16091601
"@toruslabs/http-helpers" "^3.3.0"
@@ -1614,46 +1606,46 @@
16141606
loglevel "^1.8.1"
16151607
web3-utils "^1.8.2"
16161608

1617-
"@oraichain/only-social-key@^2.0.0":
1618-
version "2.0.0"
1619-
resolved "https://registry.yarnpkg.com/@oraichain/only-social-key/-/only-social-key-2.0.0.tgz#3edf337f686583bfd356bde8a86a69f294669ca3"
1620-
integrity sha512-/bYt/VSiNwiyHDklDgceNwtitocvTeXPQBC1NGUcVPmZMkqselPPb2zw+vSMlraPNWnRVQRY2V6621WHohpzUg==
1609+
"@oraichain/only-social-key@next":
1610+
version "2.0.4"
1611+
resolved "https://registry.npmjs.org/@oraichain/only-social-key/-/only-social-key-2.0.4.tgz#c221be0259e33d972b1aaa98f149f3d85d10e5af"
1612+
integrity sha512-jFsjgcrU74hWF0LdDR2MqofpBYZ5Qm/8Bl8TZ3SgHp9vzUCfCgVpJGLKuEJ66V7nqwIIUntcP+E7Hht3woWwow==
16211613
dependencies:
1622-
"@oraichain/common-types" "^2.0.0"
1614+
"@oraichain/common-types" "^2.0.4"
16231615
"@toruslabs/eccrypto" "^1.1.8"
16241616
"@toruslabs/http-helpers" "^3.2.0"
16251617
bn.js "^5.2.1"
16261618
elliptic "^6.5.4"
16271619
json-stable-stringify "^1.0.2"
16281620
web3-utils "^1.8.1"
16291621

1630-
"@oraichain/service-provider-base@^2.0.0":
1631-
version "2.0.0"
1632-
resolved "https://registry.yarnpkg.com/@oraichain/service-provider-base/-/service-provider-base-2.0.0.tgz#8300f583d6f8d33d7c397434443bbd547d4107f5"
1633-
integrity sha512-q69zwXDvL77YUsfjPeWbyYEOZFDlUekrZpjeuT9O5ZB6hcNZDqcurkZMun5xWTqec5sTisxKwCcNAHtMpeOVmg==
1622+
"@oraichain/service-provider-base@^2.0.4":
1623+
version "2.0.4"
1624+
resolved "https://registry.npmjs.org/@oraichain/service-provider-base/-/service-provider-base-2.0.4.tgz#cffb5a5eccbac8b18058adcbee56890dd571d66b"
1625+
integrity sha512-qhbrLD3qLE28d4TvLNSk/PoFVieapjsPQLZWGd6ymWENPga0nM0+rEBnNjXZ57Ekv747rTDc2wbu26hjCmqV3w==
16341626
dependencies:
1635-
"@oraichain/common-types" "^2.0.0"
1627+
"@oraichain/common-types" "^2.0.4"
16361628
bn.js "^5.2.1"
16371629
elliptic "^6.5.4"
16381630

1639-
"@oraichain/service-provider-orai@^2.0.0":
1640-
version "2.0.0"
1641-
resolved "https://registry.yarnpkg.com/@oraichain/service-provider-orai/-/service-provider-orai-2.0.0.tgz#cc7f200b6b6b0d8ccbb375640967c5fd714822c8"
1642-
integrity sha512-0zuZ+WzbjYUmf3ObIep0kCDrwcv+zCqzti3Syr6vn8bGXzMRcSqgxgpXvh1E0dvil4Bwyz/VjQaoJf8pyMwE3g==
1631+
"@oraichain/service-provider-orai@next":
1632+
version "2.0.4"
1633+
resolved "https://registry.npmjs.org/@oraichain/service-provider-orai/-/service-provider-orai-2.0.4.tgz#31a53169b88027d8b98aa239ee7d9578eeda213d"
1634+
integrity sha512-OlV0nJWkW3rmtJ/dltYO/K4Am5Sbo8KsULx7OpD92XBohSp20OJDvPyHV8M6gFKjzM5lMYxi3oXQoDEaBJXOgA==
16431635
dependencies:
1644-
"@oraichain/common-types" "^2.0.0"
1645-
"@oraichain/customauth" "^2.0.0"
1646-
"@oraichain/service-provider-base" "^2.0.0"
1636+
"@oraichain/common-types" "^2.0.4"
1637+
"@oraichain/customauth" "^2.0.4"
1638+
"@oraichain/service-provider-base" "^2.0.4"
16471639
bn.js "^5.2.1"
16481640
elliptic "^6.5.4"
16491641
web3-utils "^1.8.2"
16501642

1651-
"@oraichain/storage-layer-orai@^2.0.0":
1652-
version "2.0.0"
1653-
resolved "https://registry.yarnpkg.com/@oraichain/storage-layer-orai/-/storage-layer-orai-2.0.0.tgz#1227c322b4feff0ac3f8db3ca66317882f42d095"
1654-
integrity sha512-Lq5NjF2JP4JgDxxFY4GD3a2xn91DGfy746fHqMGTsajH8ZNVJHlGOt+iGoIjiZoTXcYntIYfzEp7cXYNzk78WA==
1643+
"@oraichain/storage-layer-orai@next":
1644+
version "2.0.4"
1645+
resolved "https://registry.npmjs.org/@oraichain/storage-layer-orai/-/storage-layer-orai-2.0.4.tgz#764f51cf94c8c7cf0a7a9c04c3e00b43a451ffa3"
1646+
integrity sha512-vjNZRdObpxQzQG4S/luSWd9G/24DzOaY5RIfJaAcl88iiTYCjhC0yNY0SEIrhPzfTEz/dicFpHElpRAnzSVUIQ==
16551647
dependencies:
1656-
"@oraichain/common-types" "^2.0.0"
1648+
"@oraichain/common-types" "^2.0.4"
16571649
"@toruslabs/http-helpers" "^3.2.0"
16581650
bn.js "^5.2.1"
16591651
json-stable-stringify "^1.0.2"
@@ -2679,7 +2671,7 @@ balanced-match@^1.0.0:
26792671
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
26802672
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
26812673

2682-
base64-js@^1.0.2, base64-js@^1.1.2, base64-js@^1.3.1, base64-js@^1.5.1:
2674+
base64-js@^1.0.2, base64-js@^1.1.2, base64-js@^1.3.1:
26832675
version "1.5.1"
26842676
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
26852677
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
@@ -6386,27 +6378,13 @@ react-is@^17.0.1:
63866378
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
63876379
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==
63886380

6389-
react-native-bignumber@^0.2.1:
6390-
version "0.2.1"
6391-
resolved "https://registry.yarnpkg.com/react-native-bignumber/-/react-native-bignumber-0.2.1.tgz#c2370d0e124419bda9043ecffd2fde321981d4b6"
6392-
integrity sha512-jEtfsYtU/WNR+XHilwtwJRKvoK9Cw0ZWV4ZOIOz5RBRfgxIdGIKS3d1bc1JaOPVGBqbDZ32zBQ/CTI0xyA/vvQ==
6393-
dependencies:
6394-
"@craftzdog/react-native-buffer" "^6.0.4"
6395-
63966381
react-native-dotenv@^3.4.9:
63976382
version "3.4.9"
63986383
resolved "https://registry.yarnpkg.com/react-native-dotenv/-/react-native-dotenv-3.4.9.tgz#621c5b0c1d0c5c7f569bfe5a1d804bec7885c010"
63996384
integrity sha512-dbyd+mcy7SUzxEgmt33TRf1FGcNe6swJhXmB0unKkI49F7+pidog9kPtjxMLTAfmKA8gcN2XHQSKltGfGbGCLQ==
64006385
dependencies:
64016386
dotenv "^16.3.1"
64026387

6403-
react-native-quick-base64@^2.0.5:
6404-
version "2.0.7"
6405-
resolved "https://registry.yarnpkg.com/react-native-quick-base64/-/react-native-quick-base64-2.0.7.tgz#70ec863fb5dba8cd858a262f6b901dbbfbfdd3df"
6406-
integrity sha512-QmOon3zXAWFi3KvQVCJjCC7N66rwfl1R4nLPuJ+OVs8nWysvKlaU8mKxe2BV4Ud1nB3nTDgyi2VCJFpjtjJxKw==
6407-
dependencies:
6408-
base64-js "^1.5.1"
6409-
64106388
react-native-randombytes@^3.6.1:
64116389
version "3.6.1"
64126390
resolved "https://registry.yarnpkg.com/react-native-randombytes/-/react-native-randombytes-3.6.1.tgz#cac578093b5ca38e3e085becffdc6cbcf6f0d654"

0 commit comments

Comments
 (0)