From 9e344edddbb2c3abbb70976011fa79d363f254a2 Mon Sep 17 00:00:00 2001 From: William Chong Date: Sat, 20 Jan 2024 02:11:49 +0800 Subject: [PATCH 01/21] =?UTF-8?q?=E2=9C=A8=20Add=20authcore=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 + .../connection-method-selection-dialog.tsx | 16 +- src/i18n/translations/zh.json | 1 + src/index.tsx | 23 ++ src/types.ts | 4 + src/types/index.d.ts | 2 + src/utils/authcore.ts | 117 +++++++ src/utils/wallet.ts | 6 + yarn.lock | 298 +++++++++++++++++- 9 files changed, 462 insertions(+), 7 deletions(-) create mode 100644 src/types/index.d.ts create mode 100644 src/utils/authcore.ts diff --git a/package.json b/package.json index 8f047a8..99f1eb4 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,8 @@ "devDependencies": { "@babel/core": "^7.18.5", "@keplr-wallet/types": "^0.11.3", + "@likecoin/authcore-js": "0.3.0-like.0", + "@likecoin/secretd-js": "^0.4.4", "@size-limit/preset-small-lib": "^7.0.8", "@storybook/addon-essentials": "^6.5.9", "@storybook/addon-info": "^5.3.21", diff --git a/src/components/connection-method-selection-dialog.tsx b/src/components/connection-method-selection-dialog.tsx index 550a8b1..2748f8a 100644 --- a/src/components/connection-method-selection-dialog.tsx +++ b/src/components/connection-method-selection-dialog.tsx @@ -16,6 +16,15 @@ import { ConnectionMethodList } from './connection-method-list'; import { Dialog } from './dialog'; const connectionMethodMap = [ + { + type: LikeCoinWalletConnectorMethodType.Authcore, + name: 'Authcore', + tier: 1, + isInstalled: true, + isMobileOk: true, + url: 'https://niomon.io/', + description: 'connect_wallet_method_description_authcore', + }, { type: LikeCoinWalletConnectorMethodType.Keplr, name: 'Keplr', @@ -194,7 +203,12 @@ export const ConnectionMethodSelectionDialog: FC {}), }; @@ -143,6 +146,22 @@ export class LikeCoinWalletConnector { this._renderingRoot = createRoot(container); } + async handleRedirect( + method: LikeCoinWalletConnectorMethodType, + payload: any + ) { + switch (method) { + case LikeCoinWalletConnectorMethodType.Authcore: + const { user, idToken, accessToken } = await handleAuthcoreRedirect( + this.options, + payload + ); + const result = await initAuthcore(this.options, accessToken); + return { user, idToken, ...result }; + } + return null; + } + /** * @deprecated Please use openConnectionMethodSelectionDialog() instead */ @@ -335,6 +354,10 @@ export class LikeCoinWalletConnector { let initiator: Promise; switch (methodType) { + case LikeCoinWalletConnectorMethodType.Authcore: + initiator = initAuthcore(this.options); + break; + case LikeCoinWalletConnectorMethodType.Keplr: initiator = initKeplr(this.options); break; diff --git a/src/types.ts b/src/types.ts index d75aa5b..49cb012 100644 --- a/src/types.ts +++ b/src/types.ts @@ -15,6 +15,7 @@ export enum LikeCoinWalletConnectorMethodType { Leap = 'leap', MetaMaskLeap = 'metamask-leap', WalletConnectV2 = 'walletconnect-v2', + Authcore = 'authcore', } export interface LikeCoinWalletConnectorMethodConfigurable { @@ -95,6 +96,9 @@ export interface LikeCoinWalletConnectorConfig { connectWalletTitle?: string; connectWalletMobileWarning?: string; + authcoreApiHost?: string; + authcoreRedirectUrl?: string; + language?: string; onEvent?: (event: LikeCoinWalletConnectorEvent) => void; diff --git a/src/types/index.d.ts b/src/types/index.d.ts new file mode 100644 index 0000000..82c7872 --- /dev/null +++ b/src/types/index.d.ts @@ -0,0 +1,2 @@ +declare module '@likecoin/secretd-js'; +declare module '@likecoin/authcore-js'; diff --git a/src/utils/authcore.ts b/src/utils/authcore.ts new file mode 100644 index 0000000..e95663f --- /dev/null +++ b/src/utils/authcore.ts @@ -0,0 +1,117 @@ +import { AminoSignResponse } from '@cosmjs/amino'; +import { + AccountData, + DirectSignResponse, + OfflineSigner, + makeSignBytes, +} from '@cosmjs/proto-signing'; +import { SignDoc } from 'cosmjs-types/cosmos/tx/v1beta1/tx'; +import { + AuthcoreCosmosProvider, + AuthcoreVaultClient, +} from '@likecoin/secretd-js'; +import { AuthCoreAuthClient, AuthCoreWidgets } from '@likecoin/authcore-js'; + +import { + LikeCoinWalletConnectorInitResponse, + LikeCoinWalletConnectorOptions, +} from '../types'; +import { convertAddressPrefix } from './wallet'; + +let cosmosProvider: any | null = null; +let keyVaultClient: any | null = null; + +export async function initAuthcore( + options: LikeCoinWalletConnectorOptions, + accessToken?: string +): Promise { + const authcoreApiHost = options.authcoreApiHost; + + let accounts: AccountData[] = []; + if (accessToken) { + keyVaultClient = await new AuthcoreVaultClient({ + apiBaseURL: authcoreApiHost, + accessToken, + }); + cosmosProvider = await new AuthcoreCosmosProvider({ + client: keyVaultClient, + }); + const addresses = await cosmosProvider.getAddresses(); + accounts = addresses.map((address: string) => { + const likeAddress = convertAddressPrefix(address); + const pubkey = { + type: 'tendermint/PubKeySecp256k1', + value: cosmosProvider.wallets[0].publicKey, + }; + const pubkeyBytes = Buffer.from(pubkey.value, 'base64'); + return { + algo: 'secp256k1', + address: likeAddress, + pubkey: pubkeyBytes, + }; + }); + } else { + // TODO: Better login dialog + const container = document.createElement('div'); + container.setAttribute('id', 'authcore-dialog'); + container.setAttribute( + 'style', + 'background-color: white; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 9999;' + ); + document.body.appendChild(container); + new AuthCoreWidgets.Login({ + primaryColour: '#28646e', + container: 'authcore-dialog', + root: `${authcoreApiHost}/widgets`, + initialScreen: 'signin', + socialLoginPaneStyle: 'top', + socialLoginPaneOption: 'grid', + internal: true, + language: options.language?.toLowerCase().includes('zh') ? 'zh-hk' : 'en', + fixedContact: false, + successRedirectUrl: options.authcoreRedirectUrl, + }); + return; + } + const offlineSigner: OfflineSigner = { + getAccounts: async () => Promise.resolve(accounts), + signAmino: async (signerBech32Address, data) => { + const { signatures, ...signed } = await cosmosProvider.sign( + data, + signerBech32Address + ); + return { signed, signature: signatures[0] } as AminoSignResponse; + }, + signDirect: async (signerBech32Address, signDoc) => { + const dataToSign = makeSignBytes(signDoc); + const { signed, signatures } = await cosmosProvider.directSign( + dataToSign, + signerBech32Address + ); + const decodedSigned = SignDoc.decode(signed); + return { + signed: decodedSigned, + signature: signatures[0], + } as DirectSignResponse; + }, + }; + + return { + accounts, + offlineSigner, + }; +} + +export async function handleAuthcoreRedirect( + options: LikeCoinWalletConnectorOptions, + code: string +) { + const authClient = await new AuthCoreAuthClient({ + apiBaseURL: options.authcoreApiHost, + }); + const token = await authClient.createAccessToken(code); + const { access_token: accessToken, id_token: idToken } = token; + await authClient.setAccessToken(accessToken); + const user = await authClient.getCurrentUser(); + return { accessToken, user, idToken }; +} diff --git a/src/utils/wallet.ts b/src/utils/wallet.ts index 6ef5ce2..13881e6 100644 --- a/src/utils/wallet.ts +++ b/src/utils/wallet.ts @@ -1,4 +1,5 @@ import { AccountData } from '@cosmjs/proto-signing'; +import bech32 from 'bech32'; import { WalletConnectAccountResponse } from '../types'; @@ -10,6 +11,11 @@ export function deserializePublicKey(value: string) { return new Uint8Array(Buffer.from(value, 'hex')); } +export function convertAddressPrefix(address: string, prefix = 'like') { + const { words } = bech32.decode(address); + return bech32.encode(prefix, words); +} + export function convertWalletConnectAccountResponse( account: WalletConnectAccountResponse ) { diff --git a/yarn.lock b/yarn.lock index bab9100..0f11188 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1095,6 +1095,14 @@ core-js-pure "^3.20.2" regenerator-runtime "^0.13.4" +"@babel/runtime-corejs3@^7.11.2", "@babel/runtime-corejs3@^7.9.2": + version "7.23.8" + resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.23.8.tgz#b8aa3d47570bdd08fed77fdfd69542118af0df26" + integrity sha512-2ZzmcDugdm0/YQKFVYsXiwUN7USPX8PM7cytpb4PFl87fM+qYPSvTZX//8tyeJB1j0YDmafBJEbl5f8NfLyuKw== + dependencies: + core-js-pure "^3.30.2" + regenerator-runtime "^0.14.0" + "@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.16.3", "@babel/runtime@^7.17.8", "@babel/runtime@^7.3.1", "@babel/runtime@^7.5.0", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": version "7.18.3" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.18.3.tgz#c7b654b57f6f63cf7f8b418ac9ca04408c4579f4" @@ -1882,6 +1890,43 @@ bignumber.js "^9.1.2" long "^5.2.3" +"@likecoin/authcore-js@0.3.0-like.0": + version "0.3.0-like.0" + resolved "https://registry.yarnpkg.com/@likecoin/authcore-js/-/authcore-js-0.3.0-like.0.tgz#56b490d7419e5aed9a3a32650d19e25324a8ee48" + integrity sha512-j9MjrXDCdBImONUqndNda0+h4wLgee67YhCsJCk4guzg8GvxQLeAEox5zbF0NhOG2H1eE4wmgMfql7mK0dcaLg== + dependencies: + "@babel/runtime-corejs3" "^7.9.2" + axios "^0.19.2" + base32-encode "^1.1.0" + color "^3.1.2" + lodash "^4.17.15" + spake2 "1.0.2" + swagger-client "^3.8.22" + +"@likecoin/noise-js@^0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@likecoin/noise-js/-/noise-js-0.1.0.tgz#a119006ddfac281cad7860ff4c31f722680fa169" + integrity sha512-M1urRpN+QRK5ErNarIjitclKXPnAuE3HW0alUMc/BiYQKKqu4tV8pWpU7Fy9Nff802xxY5L6DGy7WpgszPSJTA== + dependencies: + clone "^2.1.2" + nanoassert "^1.1.0" + tweetnacl "^1.0.1" + +"@likecoin/secretd-js@^0.4.4": + version "0.4.4" + resolved "https://registry.yarnpkg.com/@likecoin/secretd-js/-/secretd-js-0.4.4.tgz#93d55f236af7b47b5ba84584d8e3ea32269c8ebe" + integrity sha512-ntuMOdsT64GF30Ti26IlRz/jjv8uouyz4m2QzprpfYab4TewnsKFcEzFIuJha13Y2NFFnc6Cv4juKI53D4/WHg== + dependencies: + "@babel/runtime-corejs3" "^7.9.2" + "@likecoin/noise-js" "^0.1.0" + agentkeepalive "^4.2.1" + axios "^0.19.0" + bech32 "^1.1.3" + bignumber.js "^9.0.0" + cbor "^5.0.1" + fast-json-stable-stringify "^2.0.0" + lodash "^4.17.15" + "@lit-labs/ssr-dom-shim@^1.0.0", "@lit-labs/ssr-dom-shim@^1.1.0": version "1.1.1" resolved "https://registry.yarnpkg.com/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.1.1.tgz#64df34e2f12e68e78ac57e571d25ec07fa460ca9" @@ -4383,6 +4428,13 @@ address@^1.0.1: resolved "https://registry.yarnpkg.com/address/-/address-1.2.0.tgz#d352a62c92fee90f89a693eccd2a8b2139ab02d9" integrity sha512-tNEZYz5G/zYunxFm7sfhAxkXEuLj3K6BKwv6ZURlsF6yiUQ65z0Q2wZW9L5cPUl9ocofGvXOdFYbFHp0+6MOig== +agentkeepalive@^4.2.1: + version "4.5.0" + resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.5.0.tgz#2673ad1389b3c418c5a20c5d7364f93ca04be923" + integrity sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew== + dependencies: + humanize-ms "^1.2.1" + aggregate-error@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" @@ -4560,6 +4612,11 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== + aria-query@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-4.2.2.tgz#0d2ca6c9aceb56b8977e9fed6aed7e15bbd2f83b" @@ -4812,6 +4869,13 @@ axios@0.21.1: dependencies: follow-redirects "^1.10.0" +axios@^0.19.0, axios@^0.19.2: + version "0.19.2" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27" + integrity sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA== + dependencies: + follow-redirects "1.5.10" + axios@^0.21.1: version "0.21.4" resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" @@ -5052,6 +5116,13 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +base32-encode@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/base32-encode/-/base32-encode-1.2.0.tgz#e150573a5e431af0a998e32bdfde7045725ca453" + integrity sha512-cHFU8XeRyx0GgmoWi5qHMCVRiqU6J3MHWxVgun7jggCBUpVzm1Ir7M9dYr2whjSNc3tFeXfQ/oZjQu/4u55h9A== + dependencies: + to-data-view "^1.1.0" + base64-js@^1.0.2, base64-js@^1.3.0, base64-js@^1.3.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" @@ -5099,7 +5170,7 @@ big.js@^5.2.2: resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ== -bignumber.js@^9.1.2: +bignumber.js@^9.0.0, bignumber.js@^9.0.1, bignumber.js@^9.1.2: version "9.1.2" resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug== @@ -5333,6 +5404,11 @@ bser@2.1.1: dependencies: node-int64 "^0.4.0" +btoa@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/btoa/-/btoa-1.2.1.tgz#01a9909f8b2c93f6bf680ba26131eb30f7fa3d73" + integrity sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g== + buffer-from@1.x, buffer-from@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" @@ -5567,6 +5643,14 @@ caseless@~0.12.0: resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw== +cbor@^5.0.1: + version "5.2.0" + resolved "https://registry.yarnpkg.com/cbor/-/cbor-5.2.0.tgz#4cca67783ccd6de7b50ab4ed62636712f287a67c" + integrity sha512-5IMhi9e1QU76ppa5/ajP1BmMWZ2FHkhAhjeVKQ/EFCgYSEaeVaoGtL7cxJskf9oCCk+XjzaIdc3IuU/dbA/o2A== + dependencies: + bignumber.js "^9.0.1" + nofilter "^1.0.4" + ccount@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/ccount/-/ccount-1.1.0.tgz#246687debb6014735131be8abab2d93898f8d043" @@ -5810,6 +5894,11 @@ clone@^1.0.2: resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" integrity sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg== +clone@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" + integrity sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w== + co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" @@ -5833,7 +5922,7 @@ collection-visit@^1.0.0: map-visit "^1.0.0" object-visit "^1.0.0" -color-convert@^1.9.0: +color-convert@^1.9.0, color-convert@^1.9.3: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== @@ -5852,16 +5941,32 @@ color-name@1.1.3: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== -color-name@^1.1.4, color-name@~1.1.4: +color-name@^1.0.0, color-name@^1.1.4, color-name@~1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== +color-string@^1.6.0: + version "1.9.1" + resolved "https://registry.yarnpkg.com/color-string/-/color-string-1.9.1.tgz#4467f9146f036f855b764dfb5bf8582bf342c7a4" + integrity sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg== + dependencies: + color-name "^1.0.0" + simple-swizzle "^0.2.2" + color-support@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== +color@^3.1.2: + version "3.2.1" + resolved "https://registry.yarnpkg.com/color/-/color-3.2.1.tgz#3544dc198caf4490c3ecc9a790b54fe9ff45e164" + integrity sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA== + dependencies: + color-convert "^1.9.3" + color-string "^1.6.0" + colord@^2.9.1: version "2.9.2" resolved "https://registry.yarnpkg.com/colord/-/colord-2.9.2.tgz#25e2bacbbaa65991422c07ea209e2089428effb1" @@ -6005,6 +6110,11 @@ cookie@0.5.0: resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.5.0.tgz#d1f5d71adec6558c58f389987c366aa47e994f8b" integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw== +cookie@~0.4.1: + version "0.4.2" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.2.tgz#0e41f24de5ecf317947c82fc789e06a884824432" + integrity sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA== + copy-concurrently@^1.0.0: version "1.0.5" resolved "https://registry.yarnpkg.com/copy-concurrently/-/copy-concurrently-1.0.5.tgz#92297398cae34937fcafd6ec8139c18051f0b5e0" @@ -6035,6 +6145,11 @@ core-js-pure@^3.20.2, core-js-pure@^3.8.1: resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.23.2.tgz#efe5e486469c5ed2d088d76e973eb12e74a930e7" integrity sha512-t6u7H4Ff/yZNk+zqTr74UjCcZ3k8ApBryeLLV4rYQd9aF3gqmjjGjjR44ENfeBMH8VVvSynIjAJ0mUuFhzQtrA== +core-js-pure@^3.30.2: + version "3.35.0" + resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.35.0.tgz#4660033304a050215ae82e476bd2513a419fbb34" + integrity sha512-f+eRYmkou59uh7BPcyJ8MC76DiGhspj1KMxVIcF24tzP8NA9HVa1uC7BTW2tgx7E1QVCzDzsgp7kArrzhlz8Ew== + core-js@^1.0.0: version "1.2.7" resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" @@ -6165,6 +6280,13 @@ create-react-context@0.3.0: gud "^1.0.0" warning "^4.0.3" +cross-fetch@^3.1.4: + version "3.1.8" + resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.8.tgz#0327eba65fd68a7d119f8fb2bf9334a1a7956f82" + integrity sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg== + dependencies: + node-fetch "^2.6.12" + cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" @@ -6388,6 +6510,13 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.9: dependencies: ms "2.0.0" +debug@=3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== + dependencies: + ms "2.0.0" + debug@^3.0.0, debug@^3.2.7: version "3.2.7" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" @@ -6434,6 +6563,11 @@ deep-equal@^1.1.1: object-keys "^1.1.1" regexp.prototype.flags "^1.2.0" +deep-extend@~0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== + deep-is@~0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" @@ -6761,7 +6895,7 @@ electron-to-chromium@^1.4.172: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.172.tgz#87335795a3dc19e7b6dd5af291038477d81dc6b1" integrity sha512-yDoFfTJnqBAB6hSiPvzmsBJSrjOXJtHSJoqJdI/zSIh7DYupYnIOHt/bbPw/WE31BJjNTybDdNAs21gCMnTh0Q== -elliptic@^6.4.0, elliptic@^6.5.3, elliptic@^6.5.4: +elliptic@^6.4.0, elliptic@^6.5.0, elliptic@^6.5.3, elliptic@^6.5.4: version "6.5.4" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== @@ -7641,6 +7775,11 @@ fast-json-parse@^1.0.3: resolved "https://registry.yarnpkg.com/fast-json-parse/-/fast-json-parse-1.0.3.tgz#43e5c61ee4efa9265633046b770fb682a7577c4d" integrity sha512-FRWsaZRWEJ1ESVNbDWmsAlqDk96gPQezzLghafp5J4GUKjbCz3OkAHuZs5TuPEtkbVQERysLp9xv6c24fBm8Aw== +fast-json-patch@^3.0.0-1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/fast-json-patch/-/fast-json-patch-3.1.1.tgz#85064ea1b1ebf97a3f7ad01e23f9337e72c66947" + integrity sha512-vf6IHUX2SBcA+5/+4883dsIjpBTqmfBjmYiWK1savxQmFk4JfBMLa7ynTYOs1Rolp/T1betJxHiGD3g1Mn8lUQ== + fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" @@ -7873,6 +8012,13 @@ focus-lock@^0.11.2: dependencies: tslib "^2.0.3" +follow-redirects@1.5.10: + version "1.5.10" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a" + integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ== + dependencies: + debug "=3.1.0" + follow-redirects@^1.10.0, follow-redirects@^1.14.0: version "1.15.1" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.1.tgz#0ca6a452306c9b276e4d3127483e29575e207ad5" @@ -7933,6 +8079,11 @@ fork-ts-checker-webpack-plugin@^6.0.4: semver "^7.3.2" tapable "^1.0.0" +form-data-encoder@^1.4.3: + version "1.9.0" + resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-1.9.0.tgz#fd18d316b1ec830d2a8be8ad86c1cf0317320b34" + integrity sha512-rahaRMkN8P8d/tgK/BLPX+WBVM27NbvdXBxqQujBtkDAIFspaRqN7Od7lfdGQA6KAD+f82fYCLBq1ipvcu8qLw== + form-data@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" @@ -7965,6 +8116,14 @@ format@^0.2.0: resolved "https://registry.yarnpkg.com/format/-/format-0.2.2.tgz#d6170107e9efdc4ed30c9dc39016df942b5cb58b" integrity sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww== +formdata-node@^4.0.0: + version "4.4.1" + resolved "https://registry.yarnpkg.com/formdata-node/-/formdata-node-4.4.1.tgz#23f6a5cb9cb55315912cbec4ff7b0f59bbd191e2" + integrity sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ== + dependencies: + node-domexception "1.0.0" + web-streams-polyfill "4.0.0-beta.3" + forwarded@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" @@ -8088,6 +8247,11 @@ functions-have-names@^1.2.2: resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== +futoin-hkdf@^1.2.0: + version "1.5.3" + resolved "https://registry.yarnpkg.com/futoin-hkdf/-/futoin-hkdf-1.5.3.tgz#6c8024f2e1429da086d4e18289ef2239ad33ee35" + integrity sha512-SewY5KdMpaoCeh7jachEWFsh1nNlaDjNHZXWqL5IGwtpEYHTgkr2+AMCgNwKWkcc0wpSYrZfR7he4WdmHFtDxQ== + gauge@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/gauge/-/gauge-3.0.2.tgz#03bf4441c044383908bcfa0656ad91803259b395" @@ -8679,6 +8843,13 @@ humanize-duration@^3.15.3: resolved "https://registry.yarnpkg.com/humanize-duration/-/humanize-duration-3.27.2.tgz#4b4e565bec098d22c9a54344e16156d1c649f160" integrity sha512-A15OmA3FLFRnehvF4ZMocsxTZYvHq4ze7L+AgR1DeHw0xC9vMd4euInY83uqGU9/XXKNnVIEeKc1R8G8nKqtzg== +humanize-ms@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed" + integrity sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ== + dependencies: + ms "^2.0.0" + husky@^8.0.1: version "8.0.1" resolved "https://registry.yarnpkg.com/husky/-/husky-8.0.1.tgz#511cb3e57de3e3190514ae49ed50f6bc3f50b3e9" @@ -8935,6 +9106,11 @@ is-arrayish@^0.2.1: resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== +is-arrayish@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03" + integrity sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ== + is-bigint@^1.0.1: version "1.0.4" resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.4.tgz#08147a1875bc2b32005d41ccd8291dffc6691df3" @@ -9913,6 +10089,13 @@ js-yaml@^3.13.1: argparse "^1.0.7" esprima "^4.0.0" +js-yaml@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" + integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + dependencies: + argparse "^2.0.1" + jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" @@ -10821,7 +11004,7 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@2.1.3, ms@^2.1.1: +ms@2.1.3, ms@^2.0.0, ms@^2.1.1: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== @@ -10841,6 +11024,11 @@ nan@^2.12.1: resolved "https://registry.yarnpkg.com/nan/-/nan-2.16.0.tgz#664f43e45460fb98faf00edca0bb0d7b8dce7916" integrity sha512-UdAqHyFngu7TfQKsCBgAA6pWDkT8MAO7d0jyOecVhN5354xbLqdn8mV9Tat9gepAupm0bt2DbeaSC8vS52MuFA== +nanoassert@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/nanoassert/-/nanoassert-1.1.0.tgz#4f3152e09540fde28c76f44b19bbcd1d5a42478d" + integrity sha512-C40jQ3NzfkP53NsO8kEOFd79p4b9kDXQMwgiY1z8ZwrDZgUyom0AHwGegF4Dm99L+YoYhuaB0ceerUcXmqr1rQ== + nanoid@^3.2.0, nanoid@^3.3.1, nanoid@^3.3.4: version "3.3.4" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" @@ -10915,6 +11103,11 @@ node-dir@^0.1.10: dependencies: minimatch "^3.0.2" +node-domexception@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" + integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== + node-fetch@^1.0.1: version "1.7.3" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" @@ -10930,6 +11123,13 @@ node-fetch@^2.6.1, node-fetch@^2.6.7: dependencies: whatwg-url "^5.0.0" +node-fetch@^2.6.12: + version "2.7.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" + integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== + dependencies: + whatwg-url "^5.0.0" + node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" @@ -10980,6 +11180,11 @@ node-releases@^2.0.5: resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.5.tgz#280ed5bc3eba0d96ce44897d8aee478bfb3d9666" integrity sha512-U9h1NLROZTq9uE1SNffn6WuPDg8icmi3ns4rEl/oTfIle4iLjTliCzgTsbaIFMq/Xn078/lfY/BL0GWZ+psK4Q== +nofilter@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/nofilter/-/nofilter-1.0.4.tgz#78d6f4b6a613e7ced8b015cec534625f7667006e" + integrity sha512-N8lidFp+fCz+TD51+haYdbDGrcBWwuHX40F5+z0qkUjMJ5Tp+rdSuAkMJ9N9eoolDlEVTf6u5icM+cNKkKW2mA== + normalize-package-data@^2.3.2, normalize-package-data@^2.3.4, normalize-package-data@^2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" @@ -12344,7 +12549,7 @@ punycode@1.3.2: resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" integrity sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw== -punycode@^1.2.4: +punycode@^1.2.4, punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" integrity sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ== @@ -12383,6 +12588,13 @@ qs@^6.10.0, qs@^6.6.0: dependencies: side-channel "^1.0.4" +qs@^6.11.2, qs@^6.9.4: + version "6.11.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.2.tgz#64bea51f12c1f5da1bc01496f48ffcff7c69d7d9" + integrity sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA== + dependencies: + side-channel "^1.0.4" + qs@~6.5.2: version "6.5.3" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.3.tgz#3aeeffc91967ef6e35c0e488ef46fb296ab76aad" @@ -12835,6 +13047,11 @@ regenerator-runtime@^0.13.4, regenerator-runtime@^0.13.7: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52" integrity sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA== +regenerator-runtime@^0.14.0: + version "0.14.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz#356ade10263f685dda125100cd862c1db895327f" + integrity sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw== + regenerator-transform@^0.15.0: version "0.15.0" resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.15.0.tgz#cbd9ead5d77fae1a48d957cf889ad0586adb6537" @@ -13381,6 +13598,11 @@ schema-utils@^3.0.0, schema-utils@^3.1.0, schema-utils@^3.1.1: ajv "^6.12.5" ajv-keywords "^3.5.2" +scrypt-js@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-2.0.4.tgz#32f8c5149f0797672e551c07e230f834b6af5f16" + integrity sha512-4KsaGcPnuhtCZQCxFxN3GVYIhKFPTdLd8PLC552XwbMndtD0cjRFAhDuuydXQ0h08ZfPgzqe6EKHozpuH74iDw== + secretjs@0.17.7: version "0.17.7" resolved "https://registry.yarnpkg.com/secretjs/-/secretjs-0.17.7.tgz#a1aef5866a35cf673be9ddd717d20729afd056ac" @@ -13607,6 +13829,13 @@ signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== +simple-swizzle@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" + integrity sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg== + dependencies: + is-arrayish "^0.3.1" + simplebar-react@^1.0.0-alpha.6: version "1.2.3" resolved "https://registry.yarnpkg.com/simplebar-react/-/simplebar-react-1.2.3.tgz#bd81fa9827628470e9470d06caef6ece15e1c882" @@ -13769,6 +13998,16 @@ space-separated-tokens@^1.0.0: resolved "https://registry.yarnpkg.com/space-separated-tokens/-/space-separated-tokens-1.1.5.tgz#85f32c3d10d9682007e917414ddc5c26d1aa6899" integrity sha512-q/JSVd1Lptzhf5bkYm4ob4iWPjx0KiRe3sRFBNrVqbJkFaBm5vbbowy1mymoPNLRa52+oadOhJ+K49wsSeSjTA== +spake2@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/spake2/-/spake2-1.0.2.tgz#8b27302402c1f2278d9a20a37e9cbeca24816463" + integrity sha512-KsG1YQ//XWUwDDiYdo5Phlgfi2I8NqQI5VHvqpHb8rrn6ZwpomNeBxlUrd+qo1LVs49N3C+bqs0jBPkVCF4pRA== + dependencies: + bn.js "^5.0.0" + elliptic "^6.5.0" + futoin-hkdf "^1.2.0" + scrypt-js "^2.0.4" + spdx-correct@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9" @@ -14187,6 +14426,25 @@ svgo@^2.7.0: picocolors "^1.0.0" stable "^0.1.8" +swagger-client@^3.8.22: + version "3.17.0" + resolved "https://registry.yarnpkg.com/swagger-client/-/swagger-client-3.17.0.tgz#13e35e8ef7b5f05ab05dfaeb48acaa86b0882c64" + integrity sha512-d8DOEME49wTXm+uT+lBAjJ5D6IDjEHdbkqa7MbcslR2c+oHIhi13ObwleVWGfr89MPkWgBl6RBq9VUHmrBJRbg== + dependencies: + "@babel/runtime-corejs3" "^7.11.2" + btoa "^1.2.1" + cookie "~0.4.1" + cross-fetch "^3.1.4" + deep-extend "~0.6.0" + fast-json-patch "^3.0.0-1" + form-data-encoder "^1.4.3" + formdata-node "^4.0.0" + js-yaml "^4.1.0" + lodash "^4.17.21" + qs "^6.9.4" + traverse "~0.6.6" + url "~0.11.0" + symbol-tree@^3.2.2: version "3.2.4" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" @@ -14439,6 +14697,11 @@ to-arraybuffer@^1.0.0: resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" integrity sha512-okFlQcoGTi4LQBG/PgSYblw9VOyptsz2KJZqc6qtgGdes8VktzUQkj4BI2blit072iS8VODNcMA+tvnS9dnuMA== +to-data-view@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/to-data-view/-/to-data-view-1.1.0.tgz#08d6492b0b8deb9b29bdf1f61c23eadfa8994d00" + integrity sha512-1eAdufMg6mwgmlojAx3QeMnzB/BTVp7Tbndi3U7ftcT2zCZadjxkkmLmd97zmaxWi+sgGcgWrokmpEoy0Dn0vQ== + to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" @@ -14510,6 +14773,11 @@ tr46@~0.0.3: resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== +traverse@~0.6.6: + version "0.6.8" + resolved "https://registry.yarnpkg.com/traverse/-/traverse-0.6.8.tgz#5e5e0c41878b57e4b73ad2f3d1e36a715ea4ab15" + integrity sha512-aXJDbk6SnumuaZSANd21XAo15ucCDE38H4fkqiGsc3MhCK+wOlZvLP9cB/TvpHT0mOyWgC4Z8EwRlzqYSUzdsA== + trim-newlines@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" @@ -14677,6 +14945,11 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0: resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" integrity sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA== +tweetnacl@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596" + integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== + type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" @@ -14996,6 +15269,14 @@ url@^0.11.0: punycode "1.3.2" querystring "0.2.0" +url@~0.11.0: + version "0.11.3" + resolved "https://registry.yarnpkg.com/url/-/url-0.11.3.tgz#6f495f4b935de40ce4a0a52faee8954244f3d3ad" + integrity sha512-6hxOLGfZASQK/cijlZnZJTq8OXAkt/3YGfQX45vvMYXpZoo8NdWZcY73K108Jf759lS1Bv/8wXnHDTSz17dSRw== + dependencies: + punycode "^1.4.1" + qs "^6.11.2" + use-callback-ref@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/use-callback-ref/-/use-callback-ref-1.3.0.tgz#772199899b9c9a50526fedc4993fc7fa1f7e32d5" @@ -15217,6 +15498,11 @@ web-namespaces@^1.0.0: resolved "https://registry.yarnpkg.com/web-namespaces/-/web-namespaces-1.1.4.tgz#bc98a3de60dadd7faefc403d1076d529f5e030ec" integrity sha512-wYxSGajtmoP4WxfejAPIr4l0fVh+jeMXZb08wNc0tMg6xsfZXj3cECqIK0G7ZAqUq0PP8WlMDtaOGVBTAWztNw== +web-streams-polyfill@4.0.0-beta.3: + version "4.0.0-beta.3" + resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz#2898486b74f5156095e473efe989dcf185047a38" + integrity sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug== + webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" From 1106a599785a6770f439d7ca852a0aaf8f84d7d6 Mon Sep 17 00:00:00 2001 From: William Chong Date: Sat, 20 Jan 2024 02:12:09 +0800 Subject: [PATCH 02/21] =?UTF-8?q?=F0=9F=93=9D=20Add=20authcore=20in=20exam?= =?UTF-8?q?ple?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/pages/in/register/index.vue | 8 ++++++++ example/pages/index.vue | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 example/pages/in/register/index.vue diff --git a/example/pages/in/register/index.vue b/example/pages/in/register/index.vue new file mode 100644 index 0000000..c4bfd79 --- /dev/null +++ b/example/pages/in/register/index.vue @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/example/pages/index.vue b/example/pages/index.vue index 7e05390..4835231 100644 --- a/example/pages/index.vue +++ b/example/pages/index.vue @@ -205,7 +205,7 @@ export default { : ''; }, }, - mounted() { + async mounted() { this.connector = new LikeCoinWalletConnector({ chainId: 'likecoin-mainnet-2', chainName: 'LikeCoin', @@ -223,6 +223,7 @@ export default { bech32PrefixConsAddr: 'likevalcons', bech32PrefixConsPub: 'likevalconspub', availableMethods: [ + LikeCoinWalletConnectorMethodType.Authcore, LikeCoinWalletConnectorMethodType.Keplr, [LikeCoinWalletConnectorMethodType.KeplrMobile, { tier: 1, isRecommended: true }], LikeCoinWalletConnectorMethodType.Cosmostation, @@ -252,12 +253,21 @@ export default { connectWalletMobileWarning: 'Mobile Warning', language: 'zh', + authcoreApiHost: 'https://likecoin-integration-test.authcore.io', + authcoreRedirectUrl: 'http://localhost:3000/in/register?method=authcore', + onEvent: ({ type, ...payload}) => { console.log('onEvent', type, payload); }, }); const session = this.connector.restoreSession(); this.handleConnection(session); + const { code, method, ...query } = this.$route.query; + if (method && code) { + this.$router.replace({ query }) + const connection = await this.connector.handleRedirect(method, code); + if (connection) this.handleConnection(connection); + } this.isLoading = false; }, watch: { @@ -293,7 +303,7 @@ export default { }, async connect() { const connection = await this.connector.openConnectWalletModal(); - this.handleConnection(connection); + if (connection) this.handleConnection(connection); }, logout() { this.connector.disconnect(); From 305671436f15533ae96c06a8499f71e534d10461 Mon Sep 17 00:00:00 2001 From: William Chong Date: Sat, 20 Jan 2024 02:33:44 +0800 Subject: [PATCH 03/21] =?UTF-8?q?=E2=9C=A8=20Store=20params=20in=20session?= =?UTF-8?q?=20and=20store=20authcore=20token=20in=20params?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.tsx | 13 ++++++++++--- src/types.ts | 2 ++ src/utils/authcore.ts | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index f2a9338..66d327a 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -355,7 +355,8 @@ export class LikeCoinWalletConnector { switch (methodType) { case LikeCoinWalletConnectorMethodType.Authcore: - initiator = initAuthcore(this.options); + const { accessToken } = params || {}; + initiator = initAuthcore(this.options, accessToken); break; case LikeCoinWalletConnectorMethodType.Keplr: @@ -450,6 +451,7 @@ export class LikeCoinWalletConnector { this.saveSession({ method: methodType, accounts: [...result.accounts], + params: result.params, }); return { @@ -462,7 +464,9 @@ export class LikeCoinWalletConnector { LikeCoinWalletConnectorConnectionResponse > = async () => { const session = this.restoreSession(); - return session?.method ? this.init(session.method) : undefined; + return session?.method + ? this.init(session.method, session.params) + : undefined; }; /** @@ -471,6 +475,7 @@ export class LikeCoinWalletConnector { private saveSession = ({ method, accounts, + params, }: LikeCoinWalletConnectorSession) => { this.sessionAccounts = accounts; this.sessionMethod = method; @@ -483,6 +488,7 @@ export class LikeCoinWalletConnector { ...account, pubkey: serializePublicKey(account.pubkey), })), + params, }) ); } catch (error) { @@ -494,7 +500,7 @@ export class LikeCoinWalletConnector { try { const serializedSession = window.localStorage.getItem(SESSION_KEY); if (serializedSession) { - const { method, accounts = [] } = JSON.parse(serializedSession); + const { method, accounts = [], params } = JSON.parse(serializedSession); if ( Object.values(LikeCoinWalletConnectorMethodType).includes(method) && Array.isArray(accounts) @@ -505,6 +511,7 @@ export class LikeCoinWalletConnector { ...account, pubkey: deserializePublicKey(account.pubkey), })), + params, } as LikeCoinWalletConnectorSession; } } diff --git a/src/types.ts b/src/types.ts index 49cb012..de458dd 100644 --- a/src/types.ts +++ b/src/types.ts @@ -121,6 +121,7 @@ export type OfflineSigner = CosmJSOfflineSigner & ArbitrarySigner; export interface LikeCoinWalletConnectorSession { method: LikeCoinWalletConnectorMethodType; accounts: AccountData[]; + params?: any; } export interface LikeCoinWalletConnectorConnectionResult @@ -135,6 +136,7 @@ export type LikeCoinWalletConnectorConnectionResponse = export interface LikeCoinWalletConnectorInitResult { accounts: AccountData[]; offlineSigner: OfflineSigner; + params?: any; } export type LikeCoinWalletConnectorInitResponse = diff --git a/src/utils/authcore.ts b/src/utils/authcore.ts index e95663f..e96449a 100644 --- a/src/utils/authcore.ts +++ b/src/utils/authcore.ts @@ -99,6 +99,7 @@ export async function initAuthcore( return { accounts, offlineSigner, + params: { accessToken }, }; } From 6cdcf5d6313477862a5aeac9d45ea8d563ab1ade Mon Sep 17 00:00:00 2001 From: William Chong Date: Sat, 20 Jan 2024 02:51:39 +0800 Subject: [PATCH 04/21] =?UTF-8?q?=F0=9F=92=A5=20Change=20authcore=20to=20l?= =?UTF-8?q?iker-id,=20liker-id=20to=20likerland-app?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/pages/index.vue | 6 ++--- src/components/connection-method-icon.tsx | 1 + .../connection-method-selection-dialog.tsx | 10 ++++----- src/components/walletconnect-dialog.tsx | 6 ++--- src/i18n/translations/zh.json | 2 +- src/index.tsx | 22 +++++++++++-------- src/types.ts | 4 ++-- src/utils/liker-land-app.ts | 2 +- 8 files changed, 29 insertions(+), 24 deletions(-) diff --git a/example/pages/index.vue b/example/pages/index.vue index 4835231..b1f14be 100644 --- a/example/pages/index.vue +++ b/example/pages/index.vue @@ -223,11 +223,11 @@ export default { bech32PrefixConsAddr: 'likevalcons', bech32PrefixConsPub: 'likevalconspub', availableMethods: [ - LikeCoinWalletConnectorMethodType.Authcore, + LikeCoinWalletConnectorMethodType.LikerId, LikeCoinWalletConnectorMethodType.Keplr, [LikeCoinWalletConnectorMethodType.KeplrMobile, { tier: 1, isRecommended: true }], LikeCoinWalletConnectorMethodType.Cosmostation, - LikeCoinWalletConnectorMethodType.LikerId, + LikeCoinWalletConnectorMethodType.LikerLandApp, LikeCoinWalletConnectorMethodType.Leap, LikeCoinWalletConnectorMethodType.MetaMaskLeap, LikeCoinWalletConnectorMethodType.CosmostationMobile, @@ -254,7 +254,7 @@ export default { language: 'zh', authcoreApiHost: 'https://likecoin-integration-test.authcore.io', - authcoreRedirectUrl: 'http://localhost:3000/in/register?method=authcore', + authcoreRedirectUrl: 'http://localhost:3000/in/register?method=liker-id', onEvent: ({ type, ...payload}) => { console.log('onEvent', type, payload); diff --git a/src/components/connection-method-icon.tsx b/src/components/connection-method-icon.tsx index 3f25492..2ebc0ea 100644 --- a/src/components/connection-method-icon.tsx +++ b/src/components/connection-method-icon.tsx @@ -21,6 +21,7 @@ function getIconPath(type?: LikeCoinWalletConnectorMethodType) { case LikeCoinWalletConnectorMethodType.KeplrMobile: return 'M6.4 0H25.6C29.1347 0 32 2.86539 32 6.4V25.6C32 29.1347 29.1347 32 25.6 32H6.4C2.86539 32 0 29.1347 0 25.6V6.4C0 2.86539 2.86539 0 6.4 0ZM11.264 17.28V27.2H7.04004V4.8H11.264V14.272L19.776 4.8H25.024V4.928L15.072 15.648L25.856 26.944V27.2H20.64L11.264 17.28Z'; case LikeCoinWalletConnectorMethodType.LikerId: + case LikeCoinWalletConnectorMethodType.LikerLandApp: return 'M7.06354 5.61489C7.19783 5.50746 7.14412 5.35971 7.06354 5.23885C6.60577 4.08134 6.0905 2.94774 5.5194 1.84174C5.50023 1.79395 5.47157 1.75027 5.43548 1.71355C5.39938 1.67684 5.35638 1.64764 5.30893 1.62766C5.26147 1.60768 5.21027 1.59733 5.15878 1.59717C5.10729 1.59701 5.05686 1.60699 5.00928 1.62668C4.62787 1.81255 4.27476 2.05227 3.96149 2.33842C3.61889 2.58257 3.31915 2.88198 3.07501 3.22458C2.98101 3.38572 2.99491 3.56045 3.22319 3.72159C3.69319 4.0573 6.04288 5.35975 6.6203 5.61489C6.65918 5.61489 6.6995 5.6274 6.74121 5.64034C6.82916 5.66763 6.92336 5.69686 7.02355 5.61489H7.06354ZM23.2446 16.9618C22.8954 17.2976 22.5063 17.4454 22.1706 17.1231L22.1437 17.1903C22.0719 17.1261 22.0145 17.0475 21.9752 16.9595C21.9359 16.8716 21.9155 16.7762 21.9155 16.6799C21.9155 16.5836 21.9359 16.4885 21.9752 16.4006C22.0145 16.3126 22.0719 16.234 22.1437 16.1698C24.4587 13.7711 26.4252 11.0588 27.9852 8.1127C28.3831 7.29261 28.6936 6.43272 28.9117 5.54766C29.0325 4.84938 28.7638 4.43323 28.3609 4.33923C28.157 4.3252 27.9554 4.38562 27.7924 4.50905C27.6295 4.63248 27.5168 4.81055 27.4751 5.01065C27.2667 5.65777 27.0154 6.29019 26.723 6.90394C25.2538 10.0252 23.1499 12.806 20.5458 15.0685C20.4803 15.1406 20.4007 15.1983 20.3117 15.2377C20.2227 15.2771 20.1258 15.2974 20.0284 15.2974C19.9311 15.2974 19.8349 15.2771 19.7458 15.2377C19.6568 15.1983 19.5772 15.1406 19.5118 15.0685C19.4449 14.9896 19.3952 14.8974 19.3662 14.7981C19.3372 14.6987 19.3293 14.5944 19.3433 14.4919C19.3572 14.3893 19.3924 14.2907 19.4469 14.2027C19.5013 14.1147 19.5738 14.039 19.6593 13.9808C22.3839 11.661 24.5081 8.71731 25.8503 5.40013C26.0383 4.74213 25.7691 4.37955 25.5408 4.37955C25.3228 4.31645 25.0899 4.33323 24.8832 4.42676C24.6764 4.5203 24.5095 4.6843 24.413 4.88968C23.6202 6.79529 22.4772 8.53535 21.0428 10.0194C18.8819 12.3069 16.4769 14.3512 13.8716 16.116C13.5724 16.3997 13.1961 16.5883 12.7897 16.6576C12.3833 16.7269 11.9654 16.674 11.5891 16.5055C11.2723 16.2664 11.0348 15.9374 10.9079 15.5613C10.7809 15.1852 10.7699 14.7794 10.877 14.3971C10.9167 14.1559 10.9767 13.7992 11.0498 13.3644L11.0498 13.3644C11.2738 12.0324 11.6209 9.96785 11.8842 8.24679C12.0856 6.98451 11.3875 6.82358 11.0383 6.7833C10.6892 6.74301 10.327 6.94422 10.0719 7.56192C9.09766 10.1046 8.26812 12.7005 7.58746 15.3371C7.05339 17.6193 6.99347 19.9871 7.41239 22.2932C7.57281 22.8367 7.57281 23.4149 7.41239 23.9583C7.15999 24.6065 6.86864 25.2387 6.53967 25.8516C6.42892 26.079 6.24228 26.4455 6.04013 26.8425L6.04013 26.8425C5.7766 27.36 5.48674 27.9292 5.30436 28.3091C5.2207 28.4883 5.08779 28.6402 4.92144 28.7471C4.7551 28.8541 4.56251 28.9116 4.36476 28.9134C4.19023 28.913 4.0187 28.8666 3.86775 28.7789C3.64387 28.6467 3.47518 28.4377 3.39369 28.1908C3.3122 27.9438 3.32334 27.6756 3.42451 27.4361C4.06439 26.1467 4.78636 24.8997 5.58631 23.7029C5.68882 23.5291 5.72695 23.3247 5.69384 23.1256C5.15515 20.2719 5.20523 17.3383 5.84137 14.5047C6.45755 12.1214 7.23859 9.78374 8.17823 7.50849C9.0108 5.25251 10.5148 4.97046 11.5085 5.10474C11.855 5.15137 12.1877 5.27011 12.4854 5.45357C12.7832 5.63702 13.0394 5.88096 13.2369 6.16958C13.4343 6.45819 13.5691 6.78521 13.6322 7.12917C13.6954 7.47313 13.6855 7.82653 13.6034 8.16647C13.5195 9.02401 13.1767 11.292 12.9479 12.8058L12.9479 12.8062L12.9477 12.8073C12.847 13.4736 12.7684 13.9936 12.7438 14.1824C12.6901 14.5718 13.1063 14.6254 13.3883 14.424C15.6858 12.8853 17.7953 11.0825 19.6731 9.05263C21.0141 7.68301 22.1166 6.09906 22.9358 4.36611C23.1113 3.84802 23.4525 3.40204 23.9062 3.09637C24.3598 2.79071 24.901 2.64225 25.447 2.67411C25.6554 2.68116 25.8605 2.73006 26.0496 2.81771C26.2388 2.90536 26.4079 3.03015 26.5479 3.18456C26.5849 3.2176 26.6328 3.23571 26.6824 3.23571C26.7319 3.23571 26.7798 3.2176 26.8168 3.18456C27.0988 2.97678 27.4226 2.83183 27.7655 2.76001C28.1084 2.68818 28.4624 2.69109 28.8042 2.7682C29.3961 2.94644 29.897 3.34586 30.2021 3.88353C30.5072 4.42119 30.5933 5.05562 30.4427 5.65519C30.4178 5.75992 30.391 5.88503 30.3623 6.01882L30.3623 6.01884L30.3623 6.01886L30.3623 6.01889L30.3623 6.01892C30.3137 6.24535 30.2598 6.49665 30.2008 6.71609C30.1946 6.7337 30.1921 6.75224 30.1936 6.77084C30.195 6.78943 30.2004 6.80753 30.2093 6.82395C30.2181 6.84037 30.2306 6.85478 30.2453 6.86624C30.2601 6.8777 30.2764 6.88595 30.2945 6.8905C30.5817 6.95005 30.8536 7.06951 31.0918 7.24064C31.3301 7.41177 31.5293 7.63102 31.6774 7.88419C31.8255 8.13737 31.919 8.41885 31.9514 8.71036C31.9839 9.00187 31.955 9.29666 31.8662 9.57619C31.5687 10.7454 31.0882 11.8606 30.4427 12.8799C30.4342 12.8991 30.43 12.9198 30.4303 12.9408C30.4305 12.9619 30.4351 12.9828 30.444 13.0018C30.4529 13.0209 30.4654 13.038 30.4814 13.0517C30.4974 13.0653 30.5163 13.0753 30.5365 13.0812C31.651 13.39 32.2958 15.1761 31.0604 17.2576C30.1236 18.8291 29.0398 20.3081 27.8239 21.6752C25.36 24.337 22.3568 26.443 19.0148 27.8525C17.9387 28.3438 17.0323 29.1428 16.4097 30.1487C16.1178 30.5793 15.8534 31.0278 15.6176 31.4915C15.5381 31.6824 15.4035 31.8456 15.2314 31.9603C15.0594 32.075 14.8573 32.1361 14.6505 32.1361C14.4977 32.1374 14.3464 32.1056 14.2073 32.0423C13.9554 31.913 13.7648 31.6894 13.6768 31.4204C13.5888 31.1513 13.611 30.8585 13.7378 30.6054C13.7915 30.4711 13.9925 30.1217 14.6236 29.0474C15.4816 27.8511 16.6593 26.9203 18.0214 26.3618C22.4528 24.1192 24.7487 22.6556 27.0449 20.0908C28.2775 18.7174 29.3496 17.2084 30.2408 15.5924C30.3616 15.1224 30.2948 14.7328 29.8919 14.6522C29.7291 14.6278 29.5627 14.655 29.4159 14.7296C29.2691 14.8042 29.1493 14.9226 29.073 15.0685C27.9854 16.5779 26.7723 17.9931 25.447 19.2987C25.0308 19.715 24.5878 19.7417 24.3193 19.4866C24.251 19.4273 24.1961 19.3541 24.1586 19.2718C24.1211 19.1896 24.1016 19.1003 24.1016 19.0099C24.1016 18.9195 24.1211 18.8302 24.1586 18.7479C24.1961 18.6657 24.251 18.5924 24.3193 18.5332C26.687 16.1883 28.6473 13.4654 30.1201 10.4761C30.5901 9.58984 30.5901 8.78394 30.1201 8.59594C30.0269 8.56036 29.9273 8.5444 29.8277 8.54906C29.728 8.55372 29.6306 8.57904 29.5411 8.62315C29.4517 8.66727 29.3721 8.72922 29.3077 8.80543C29.2433 8.88165 29.1953 8.97047 29.1667 9.06607C27.6099 11.9865 25.6123 14.6495 23.2446 16.9618ZM15.1205 10.7716C15.0032 10.7724 14.8869 10.7475 14.7802 10.6988C14.6735 10.6501 14.5791 10.5788 14.5028 10.4896C14.3578 10.315 14.2838 10.092 14.2963 9.86542C14.3087 9.6388 14.4064 9.4251 14.5697 9.26744C15.9655 8.04427 17.1698 6.6185 18.1419 5.0376C18.3894 4.4776 18.8064 4.00943 19.3339 3.69869C19.8615 3.38795 20.4729 3.25023 21.0826 3.30528C21.304 3.34168 21.5024 3.46329 21.6354 3.64394C21.7684 3.82459 21.8257 4.04993 21.7947 4.27209C21.7678 4.4946 21.6536 4.69751 21.4774 4.83598C21.3011 4.97445 21.077 5.03724 20.8545 5.01072C20.2084 4.92028 19.7613 5.53835 19.537 5.84839L19.5116 5.88344C18.4689 7.62955 17.1593 9.20208 15.6306 10.5434C15.4817 10.6833 15.2848 10.7602 15.0805 10.7581L15.1205 10.7716ZM0.873109 25.0457C0.745561 25.0456 0.619178 25.0181 0.503302 24.9648C0.387426 24.9115 0.284786 24.8337 0.201686 24.7369C0.0552626 24.56 -0.0157835 24.3326 0.00432494 24.1039C0.0244334 23.8751 0.134181 23.6637 0.309219 23.515C1.31766 22.7257 2.38608 22.0162 3.50503 21.3932C3.71227 21.2941 3.94999 21.2793 4.16793 21.3519C4.38588 21.4246 4.56718 21.5791 4.67347 21.7827C4.72404 21.8841 4.75354 21.9943 4.76133 22.1073C4.76912 22.2203 4.7549 22.3337 4.71871 22.441C4.68252 22.5484 4.62547 22.6476 4.55085 22.7328C4.47623 22.818 4.3856 22.8877 4.28399 22.9377C3.28782 23.5067 2.33163 24.1438 1.42323 24.8444C1.26842 24.9731 1.07437 25.0441 0.873109 25.0457ZM5.54515 6.93519C5.65181 6.96941 5.78748 7.01293 5.78748 7.1728C5.81409 7.34576 5.68265 7.43963 5.5888 7.50664L5.58619 7.50851C5.08934 7.85765 2.80658 9.14662 2.30972 9.36147C2.26756 9.38927 2.21999 9.40767 2.17006 9.41524C2.12013 9.42281 2.06908 9.41945 2.02057 9.40541C1.97206 9.39136 1.92694 9.36701 1.88877 9.33394C1.85061 9.30086 1.8204 9.25996 1.7996 9.21395C1.62374 8.81839 1.51452 8.39612 1.477 7.96486C1.37532 7.54776 1.34379 7.11673 1.38324 6.68923C1.4101 6.4878 1.53072 6.35352 1.81271 6.35352C2.34985 6.38037 4.90157 6.76969 5.49242 6.91741C5.50849 6.92343 5.52634 6.92916 5.54509 6.93517L5.54513 6.93518L5.54515 6.93519ZM25.4199 27.0869C25.2519 27.0869 25.1962 27.2364 25.1564 27.3434L25.1518 27.3557C24.7643 28.5471 24.4372 29.7571 24.1715 30.9814C24.1575 31.0299 24.1535 31.0808 24.1604 31.1309C24.1672 31.1809 24.1849 31.2288 24.2115 31.2718C24.2381 31.3148 24.2728 31.3518 24.3144 31.3803C24.3561 31.4089 24.4038 31.4285 24.4535 31.4377C24.8764 31.5002 25.3058 31.5002 25.7288 31.4377C26.1576 31.4382 26.5836 31.3703 26.991 31.2364C27.0395 31.2203 27.0844 31.1942 27.1221 31.1597C27.1598 31.1252 27.1897 31.083 27.21 31.0361C27.2302 30.9892 27.2401 30.9384 27.2395 30.8873C27.2388 30.8362 27.2275 30.7858 27.206 30.7394C27.0449 30.2157 26.0242 27.8122 25.7288 27.2751C25.7288 27.1677 25.6079 27.0332 25.4199 27.0466V27.0869ZM26.9082 26.0687C26.8912 26.0009 26.8967 25.9295 26.9239 25.8651L26.9777 25.8517C27.0582 25.7174 27.2056 25.7172 27.3265 25.7172C27.9308 25.7575 30.509 26.1875 31.0462 26.3352C31.1474 26.3517 31.2383 26.4073 31.2986 26.4903C31.359 26.5733 31.3843 26.6767 31.3688 26.7781C31.2663 27.1852 31.1124 27.5779 30.9118 27.9466C30.7435 28.3284 30.517 28.6818 30.2403 28.994C30.2064 29.0315 30.1653 29.0614 30.119 29.0819C30.0728 29.1024 30.0228 29.113 29.9722 29.113C29.9216 29.113 29.8715 29.1024 29.8253 29.0819C29.779 29.0614 29.7373 29.0315 29.7033 28.994C29.2199 28.6315 27.3936 26.7246 27.0177 26.2411C26.9633 26.1971 26.9251 26.1365 26.9082 26.0687Z'; case LikeCoinWalletConnectorMethodType.Leap: return 'm30.58,24.97c.11-.33.25-.81.41-1.37.32-1.12.68-2.56.87-3.88.1-.66.15-1.28.14-1.81-.01-.54-.09-.93-.23-1.17-.06-.12-.13-.19-.2-.23-.06-.04-.15-.07-.28-.07-.28,0-.72.15-1.38.59-.65.44-1.21.93-1.7,1.44-.2-.46-.47-.9-.79-1.33.25-.66.4-1.36.4-2.07,0-.87-.19-1.71-.55-2.49.38-.67.59-1.45.59-2.29,0-2.54-2.02-4.6-4.51-4.6-1.4,0-2.66.66-3.48,1.68-1.13-.26-2.33-.4-3.58-.4s-2.45.14-3.58.4c-.84-1.02-2.09-1.68-3.48-1.68-2.49,0-4.51,2.06-4.51,4.6,0,.84.22,1.61.59,2.29-.36.78-.55,1.62-.55,2.49,0,.69.14,1.36.37,2-.35.46-.64.93-.85,1.43-.55-.52-1.17-1.01-1.9-1.45h0c-.73-.44-1.23-.6-1.56-.6-.29,0-.45.11-.58.31-.14.24-.23.63-.25,1.16-.01.52.04,1.14.15,1.8.21,1.32.61,2.76.96,3.88.17.56.34,1.03.45,1.37.06.17.11.3.14.39.02.04.03.08.04.1v.03s.01,0,.01,0h0s0,0,0,0l.13.34-.31.18-1.24.73s0,0,0,0c-.01,0-.02.01-.02.01,0,0,0,0,0,0,0,0,0,.02,0,.03,0,.02.01.02.01.03,0,0,0,0,0,0,0,0,0,0,.02,0h7.06c.33,0,.6-.3.56-.64-.01-.1-.03-.2-.04-.3,2.21.88,5.13,1.3,8.37,1.3s6.42-.46,8.64-1.42c-.02.15-.04.29-.05.43-.04.4.24.65.46.65h6.36s0-.01,0-.02c0-.02,0-.04,0-.06,0,0,0-.01-.01-.02,0,0,0,0,0,0l-1.13-.73-.28-.18.11-.32h0s0,0,0,0h0s0-.03,0-.03c0-.02.02-.06.03-.1.03-.09.07-.22.13-.39Zm-6.98-17.72c1.52,0,2.76,1.26,2.76,2.81s-1.23,2.81-2.76,2.81-2.76-1.26-2.76-2.81,1.23-2.81,2.76-2.81Zm-14.73,0c1.52,0,2.76,1.26,2.76,2.81s-1.23,2.81-2.76,2.81-2.76-1.26-2.76-2.81,1.23-2.81,2.76-2.81Zm14.21,2.78c0-.28.22-.51.5-.51s.5.23.5.51-.22.51-.5.51-.5-.23-.5-.51Zm-14.73,0c0-.28.22-.51.5-.51s.5.23.5.51-.22.51-.5.51-.5-.23-.5-.51Z'; diff --git a/src/components/connection-method-selection-dialog.tsx b/src/components/connection-method-selection-dialog.tsx index 2748f8a..dfb0dc5 100644 --- a/src/components/connection-method-selection-dialog.tsx +++ b/src/components/connection-method-selection-dialog.tsx @@ -17,12 +17,12 @@ import { Dialog } from './dialog'; const connectionMethodMap = [ { - type: LikeCoinWalletConnectorMethodType.Authcore, - name: 'Authcore', + type: LikeCoinWalletConnectorMethodType.LikerId, + name: 'Liker ID', tier: 1, isInstalled: true, isMobileOk: true, - url: 'https://niomon.io/', + url: 'https://like.co/in', description: 'connect_wallet_method_description_authcore', }, { @@ -45,8 +45,8 @@ const connectionMethodMap = [ description: 'connect_wallet_method_description_keplr_mobile', }, { - type: LikeCoinWalletConnectorMethodType.LikerId, - name: 'Liker ID', + type: LikeCoinWalletConnectorMethodType.LikerLandApp, + name: 'Liker Land App', tier: 1, isInstalled: false, isMobileOk: true, diff --git a/src/components/walletconnect-dialog.tsx b/src/components/walletconnect-dialog.tsx index 1e15ff6..03dfea4 100644 --- a/src/components/walletconnect-dialog.tsx +++ b/src/components/walletconnect-dialog.tsx @@ -81,7 +81,7 @@ export const WalletConnectQRCodeDialog: FC = ({ return `cosmostation://wc?${uri}`; } - case LikeCoinWalletConnectorMethodType.LikerId: + case LikeCoinWalletConnectorMethodType.LikerLandApp: if (isAndroid) { saveMobileLinkInfo({ name: 'Liker Land App', @@ -118,7 +118,7 @@ export const WalletConnectQRCodeDialog: FC = ({ return 'https://apps.apple.com/app/cosmostation/id1459830339'; } - case LikeCoinWalletConnectorMethodType.LikerId: + case LikeCoinWalletConnectorMethodType.LikerLandApp: return 'https://likecoin.page.link/likerland?utm_campaign=&utm_source=&utm_medium=getapp_page'; default: @@ -138,7 +138,7 @@ export const WalletConnectQRCodeDialog: FC = ({ id: 'wallet_connect_hint_scan_qrcode_cosmostation_mobile', }); - case LikeCoinWalletConnectorMethodType.LikerId: + case LikeCoinWalletConnectorMethodType.LikerLandApp: return intl.formatMessage({ id: 'wallet_connect_hint_scan_qrcode_liker_land_app', }); diff --git a/src/i18n/translations/zh.json b/src/i18n/translations/zh.json index b0ca926..e02e45e 100644 --- a/src/i18n/translations/zh.json +++ b/src/i18n/translations/zh.json @@ -6,7 +6,7 @@ "connect_wallet_method_button_keplr_install_prompt": "安裝 Keplr 以開始使用", "connect_wallet_method_button_liker_land_app_install_prompt": "安裝 Liker Land App", "connect_wallet_method_button_recommended": "推薦", - "connect_wallet_method_description_authcore": "使用 Authcore 電郵/社交登入", + "connect_wallet_method_description_authcore": "使用 Liker ID 電郵/社交登入", "connect_wallet_method_description_cosmostation": "使用 Cosmostation 瀏覽器外掛", "connect_wallet_method_description_cosmostation_mobile": "使用 Cosmostation Mobile Wallet", "connect_wallet_method_description_keplr": "使用 Keplr 瀏覽器外掛", diff --git a/src/index.tsx b/src/index.tsx index 66d327a..6210d27 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -104,6 +104,7 @@ export class LikeCoinWalletConnector { LikeCoinWalletConnectorMethodType.Keplr, LikeCoinWalletConnectorMethodType.KeplrMobile, LikeCoinWalletConnectorMethodType.LikerId, + LikeCoinWalletConnectorMethodType.LikerLandApp, LikeCoinWalletConnectorMethodType.Cosmostation, LikeCoinWalletConnectorMethodType.WalletConnectV2, ], @@ -151,7 +152,7 @@ export class LikeCoinWalletConnector { payload: any ) { switch (method) { - case LikeCoinWalletConnectorMethodType.Authcore: + case LikeCoinWalletConnectorMethodType.LikerId: const { user, idToken, accessToken } = await handleAuthcoreRedirect( this.options, payload @@ -199,7 +200,7 @@ export class LikeCoinWalletConnector { resolve(result); }; if (checkIsInLikerLandAppInAppBrowser()) { - connectWithMethod(LikeCoinWalletConnectorMethodType.LikerId); + connectWithMethod(LikeCoinWalletConnectorMethodType.LikerLandApp); } else if (checkIsInCosmostationMobileInAppBrowser()) { connectWithMethod( LikeCoinWalletConnectorMethodType.CosmostationMobile @@ -303,7 +304,7 @@ export class LikeCoinWalletConnector { await onCosmostationMobileDisconnect(); break; - case LikeCoinWalletConnectorMethodType.LikerId: + case LikeCoinWalletConnectorMethodType.LikerLandApp: await onLikerLandAppDisconnect(); break; @@ -332,7 +333,7 @@ export class LikeCoinWalletConnector { ) => ({ open: uri => { if ( - methodType === LikeCoinWalletConnectorMethodType.LikerId && + methodType === LikeCoinWalletConnectorMethodType.LikerLandApp && params?.goToGetApp ) { window.location.href = `https://liker.land/getapp?action=wc&uri=${encodeURIComponent( @@ -354,7 +355,7 @@ export class LikeCoinWalletConnector { let initiator: Promise; switch (methodType) { - case LikeCoinWalletConnectorMethodType.Authcore: + case LikeCoinWalletConnectorMethodType.LikerId: const { accessToken } = params || {}; initiator = initAuthcore(this.options, accessToken); break; @@ -387,13 +388,16 @@ export class LikeCoinWalletConnector { ); break; - case LikeCoinWalletConnectorMethodType.LikerId: + case LikeCoinWalletConnectorMethodType.LikerLandApp: const { goToGetApp } = params || {}; initiator = initLikerLandApp( this.options, - this.getWCQRCodeDialog(LikeCoinWalletConnectorMethodType.LikerId, { - goToGetApp, - }), + this.getWCQRCodeDialog( + LikeCoinWalletConnectorMethodType.LikerLandApp, + { + goToGetApp, + } + ), this.sessionMethod, this.sessionAccounts ); diff --git a/src/types.ts b/src/types.ts index de458dd..016c1f6 100644 --- a/src/types.ts +++ b/src/types.ts @@ -7,15 +7,15 @@ import { KeplrSignOptions } from '@keplr-wallet/types'; import { SignClientTypes } from '@walletconnect/types'; export enum LikeCoinWalletConnectorMethodType { + LikerId = 'liker-id', Keplr = 'keplr', KeplrMobile = 'keplr-mobile', Cosmostation = 'cosmostation', CosmostationMobile = 'cosmostation-mobile', - LikerId = 'liker-id', + LikerLandApp = 'likerland-app', Leap = 'leap', MetaMaskLeap = 'metamask-leap', WalletConnectV2 = 'walletconnect-v2', - Authcore = 'authcore', } export interface LikeCoinWalletConnectorMethodConfigurable { diff --git a/src/utils/liker-land-app.ts b/src/utils/liker-land-app.ts index 23abd69..3acbce7 100644 --- a/src/utils/liker-land-app.ts +++ b/src/utils/liker-land-app.ts @@ -60,7 +60,7 @@ export async function initLikerLandApp( if ( client && session && - sessionMethod === LikeCoinWalletConnectorMethodType.LikerId && + sessionMethod === LikeCoinWalletConnectorMethodType.LikerLandApp && sessionAccounts.length > 0 ) { accounts = sessionAccounts; From 22821a0dc56822f0b717330d3a35901e1c13f215 Mon Sep 17 00:00:00 2001 From: William Chong Date: Sat, 20 Jan 2024 03:39:25 +0800 Subject: [PATCH 05/21] =?UTF-8?q?=F0=9F=94=96=20Bump=20version=20to=20v0.2?= =?UTF-8?q?6.0-beta.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 99f1eb4..74bece2 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.25.3", + "version": "0.26.0-beta.0", "license": "GPL-3.0-or-later", "main": "dist/index.js", "typings": "dist/index.d.ts", From 40f37ff3705492d898b6d8fd5e7564eb069dba2d Mon Sep 17 00:00:00 2001 From: William Chong Date: Sat, 20 Jan 2024 04:43:36 +0800 Subject: [PATCH 06/21] =?UTF-8?q?=F0=9F=90=9B=20Fix=20@likecoin=20package?= =?UTF-8?q?=20was=20not=20put=20in=20dependency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 74bece2..290f4d8 100644 --- a/package.json +++ b/package.json @@ -51,8 +51,6 @@ "devDependencies": { "@babel/core": "^7.18.5", "@keplr-wallet/types": "^0.11.3", - "@likecoin/authcore-js": "0.3.0-like.0", - "@likecoin/secretd-js": "^0.4.4", "@size-limit/preset-small-lib": "^7.0.8", "@storybook/addon-essentials": "^6.5.9", "@storybook/addon-info": "^5.3.21", @@ -83,6 +81,8 @@ "@cosmjs/proto-signing": "^0.28.13", "@headlessui/react": "1.7.11", "@leapwallet/cosmos-snap-provider": "^0.1.24", + "@likecoin/authcore-js": "0.3.0-like.0", + "@likecoin/secretd-js": "^0.4.4", "@walletconnect/browser-utils": "^1.8.0", "@walletconnect/modal": "^2.4.5", "@walletconnect/sign-client": "^2.8.0", From c80b58372fc710113e4e5888444614fe19ab9631 Mon Sep 17 00:00:00 2001 From: William Chong Date: Sat, 20 Jan 2024 04:44:24 +0800 Subject: [PATCH 07/21] =?UTF-8?q?=F0=9F=94=96=20Bump=20version=20to=20v0.2?= =?UTF-8?q?6.0-beta.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 290f4d8..f321d8c 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.26.0-beta.0", + "version": "0.26.0-beta.1", "license": "GPL-3.0-or-later", "main": "dist/index.js", "typings": "dist/index.d.ts", From 72eef692e6dad61056b2d45c0cc86d5471ff2f34 Mon Sep 17 00:00:00 2001 From: William Chong Date: Sat, 20 Jan 2024 04:52:37 +0800 Subject: [PATCH 08/21] =?UTF-8?q?=F0=9F=92=AC=20Fix=20missing=20en=20strin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/translations/en.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/i18n/translations/en.json b/src/i18n/translations/en.json index 82bd109..9aeee0f 100644 --- a/src/i18n/translations/en.json +++ b/src/i18n/translations/en.json @@ -6,6 +6,7 @@ "connect_wallet_method_button_keplr_install_prompt": "Install Keplr to get started", "connect_wallet_method_button_liker_land_app_install_prompt": "Install Liker Land App", "connect_wallet_method_button_recommended": "Recommended", + "connect_wallet_method_description_authcore": "Use Liker ID with email or social login", "connect_wallet_method_description_cosmostation": "Using Cosmostation browser extension", "connect_wallet_method_description_cosmostation_mobile": "Using Cosmostation Mobile Wallet", "connect_wallet_method_description_keplr": "Using Keplr browser extension", From 6169f203c068b154d271ca3db5bd2e090794e704 Mon Sep 17 00:00:00 2001 From: William Chong Date: Sat, 20 Jan 2024 04:52:57 +0800 Subject: [PATCH 09/21] =?UTF-8?q?=F0=9F=94=96=20Bump=20version=20to=20v0.2?= =?UTF-8?q?6.0-beta.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f321d8c..cbc3fb4 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.26.0-beta.1", + "version": "0.26.0-beta.2", "license": "GPL-3.0-or-later", "main": "dist/index.js", "typings": "dist/index.d.ts", From d505730f214783b2c0976ef39ae2c93b4f668547 Mon Sep 17 00:00:00 2001 From: William Chong Date: Sat, 20 Jan 2024 05:19:21 +0800 Subject: [PATCH 10/21] =?UTF-8?q?=F0=9F=92=A5=20Pass=20redirect=20param=20?= =?UTF-8?q?as=20object?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/pages/index.vue | 2 +- src/index.tsx | 7 ++----- src/utils/authcore.ts | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/example/pages/index.vue b/example/pages/index.vue index b1f14be..9e7f6b4 100644 --- a/example/pages/index.vue +++ b/example/pages/index.vue @@ -265,7 +265,7 @@ export default { const { code, method, ...query } = this.$route.query; if (method && code) { this.$router.replace({ query }) - const connection = await this.connector.handleRedirect(method, code); + const connection = await this.connector.handleRedirect(method, { code }); if (connection) this.handleConnection(connection); } this.isLoading = false; diff --git a/src/index.tsx b/src/index.tsx index 6210d27..a5ae34b 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -147,15 +147,12 @@ export class LikeCoinWalletConnector { this._renderingRoot = createRoot(container); } - async handleRedirect( - method: LikeCoinWalletConnectorMethodType, - payload: any - ) { + async handleRedirect(method: LikeCoinWalletConnectorMethodType, params: any) { switch (method) { case LikeCoinWalletConnectorMethodType.LikerId: const { user, idToken, accessToken } = await handleAuthcoreRedirect( this.options, - payload + params ); const result = await initAuthcore(this.options, accessToken); return { user, idToken, ...result }; diff --git a/src/utils/authcore.ts b/src/utils/authcore.ts index e96449a..5d34290 100644 --- a/src/utils/authcore.ts +++ b/src/utils/authcore.ts @@ -105,7 +105,7 @@ export async function initAuthcore( export async function handleAuthcoreRedirect( options: LikeCoinWalletConnectorOptions, - code: string + { code }: { code: string } ) { const authClient = await new AuthCoreAuthClient({ apiBaseURL: options.authcoreApiHost, From ca3b481549e83935d7a98dc3a895b7fa66777a14 Mon Sep 17 00:00:00 2001 From: William Chong Date: Sat, 20 Jan 2024 05:19:54 +0800 Subject: [PATCH 11/21] =?UTF-8?q?=F0=9F=94=96=20Bump=20version=20to=20v0.2?= =?UTF-8?q?6.0-beta.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cbc3fb4..28deed0 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.26.0-beta.2", + "version": "0.26.0-beta.3", "license": "GPL-3.0-or-later", "main": "dist/index.js", "typings": "dist/index.d.ts", From 8bc566398b51c15c43e12327eb7e901ebc5b4a9e Mon Sep 17 00:00:00 2001 From: William Chong Date: Sat, 20 Jan 2024 17:22:05 +0800 Subject: [PATCH 12/21] =?UTF-8?q?=F0=9F=90=9B=20Fix=20redirect=20handler?= =?UTF-8?q?=20did=20not=20store=20session?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index a5ae34b..9828c7b 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -154,7 +154,7 @@ export class LikeCoinWalletConnector { this.options, params ); - const result = await initAuthcore(this.options, accessToken); + const result = await this.init(method, { accessToken }); return { user, idToken, ...result }; } return null; From cdff474adac9d993bdd0ae273d08c684f9488039 Mon Sep 17 00:00:00 2001 From: William Chong Date: Sat, 20 Jan 2024 17:22:21 +0800 Subject: [PATCH 13/21] =?UTF-8?q?=F0=9F=94=96=20Bump=20version=20to=20v0.2?= =?UTF-8?q?6.0-beta.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 28deed0..f26ca83 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.26.0-beta.3", + "version": "0.26.0-beta.4", "license": "GPL-3.0-or-later", "main": "dist/index.js", "typings": "dist/index.d.ts", From 8e27b00f35927a37e67c57c5825b8c28c1872ac2 Mon Sep 17 00:00:00 2001 From: William Chong Date: Wed, 24 Jan 2024 00:24:40 +0800 Subject: [PATCH 14/21] =?UTF-8?q?=F0=9F=92=AC=20Update=20liker-id=20text?= =?UTF-8?q?=20to=20focus=20on=20email/social=20login?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/connection-method-selection-dialog.tsx | 2 +- src/i18n/translations/en.json | 2 +- src/i18n/translations/zh.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/connection-method-selection-dialog.tsx b/src/components/connection-method-selection-dialog.tsx index dfb0dc5..d643968 100644 --- a/src/components/connection-method-selection-dialog.tsx +++ b/src/components/connection-method-selection-dialog.tsx @@ -18,7 +18,7 @@ import { Dialog } from './dialog'; const connectionMethodMap = [ { type: LikeCoinWalletConnectorMethodType.LikerId, - name: 'Liker ID', + name: 'Email/Social', tier: 1, isInstalled: true, isMobileOk: true, diff --git a/src/i18n/translations/en.json b/src/i18n/translations/en.json index 9aeee0f..daf356f 100644 --- a/src/i18n/translations/en.json +++ b/src/i18n/translations/en.json @@ -6,7 +6,7 @@ "connect_wallet_method_button_keplr_install_prompt": "Install Keplr to get started", "connect_wallet_method_button_liker_land_app_install_prompt": "Install Liker Land App", "connect_wallet_method_button_recommended": "Recommended", - "connect_wallet_method_description_authcore": "Use Liker ID with email or social login", + "connect_wallet_method_description_authcore": "Use Liker ID by email or social login", "connect_wallet_method_description_cosmostation": "Using Cosmostation browser extension", "connect_wallet_method_description_cosmostation_mobile": "Using Cosmostation Mobile Wallet", "connect_wallet_method_description_keplr": "Using Keplr browser extension", diff --git a/src/i18n/translations/zh.json b/src/i18n/translations/zh.json index e02e45e..bc5d86f 100644 --- a/src/i18n/translations/zh.json +++ b/src/i18n/translations/zh.json @@ -6,7 +6,7 @@ "connect_wallet_method_button_keplr_install_prompt": "安裝 Keplr 以開始使用", "connect_wallet_method_button_liker_land_app_install_prompt": "安裝 Liker Land App", "connect_wallet_method_button_recommended": "推薦", - "connect_wallet_method_description_authcore": "使用 Liker ID 電郵/社交登入", + "connect_wallet_method_description_authcore": "使用 Liker ID 以電郵/社交登入", "connect_wallet_method_description_cosmostation": "使用 Cosmostation 瀏覽器外掛", "connect_wallet_method_description_cosmostation_mobile": "使用 Cosmostation Mobile Wallet", "connect_wallet_method_description_keplr": "使用 Keplr 瀏覽器外掛", From 9b13cf6733c2c735d543c3965550c6e660641267 Mon Sep 17 00:00:00 2001 From: "Ng Wing Tat, David" Date: Thu, 25 Jan 2024 09:21:13 +0800 Subject: [PATCH 15/21] =?UTF-8?q?=F0=9F=91=94=20Override=20the=20isInstall?= =?UTF-8?q?ed=20flag=20for=20Liker=20ID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/connection-method-selection-dialog.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/connection-method-selection-dialog.tsx b/src/components/connection-method-selection-dialog.tsx index d643968..7970128 100644 --- a/src/components/connection-method-selection-dialog.tsx +++ b/src/components/connection-method-selection-dialog.tsx @@ -179,6 +179,10 @@ export const ConnectionMethodSelectionDialog: FC Date: Thu, 25 Jan 2024 09:22:44 +0800 Subject: [PATCH 16/21] =?UTF-8?q?=F0=9F=94=96=20Bump=20version=20to=20v0.2?= =?UTF-8?q?6.0-beta.5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f26ca83..ab3494d 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.26.0-beta.4", + "version": "0.26.0-beta.5", "license": "GPL-3.0-or-later", "main": "dist/index.js", "typings": "dist/index.d.ts", From a8c9a9908f2345199ad372d49587dca5c723c837 Mon Sep 17 00:00:00 2001 From: "Ng Wing Tat, David" Date: Thu, 25 Jan 2024 10:20:28 +0800 Subject: [PATCH 17/21] =?UTF-8?q?=F0=9F=8E=A8=20Do=20not=20override=20the?= =?UTF-8?q?=20isInstalled=20flag=20if=20it=20has=20already=20been=20set?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/connection-method-selection-dialog.tsx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/components/connection-method-selection-dialog.tsx b/src/components/connection-method-selection-dialog.tsx index 7970128..03e79d1 100644 --- a/src/components/connection-method-selection-dialog.tsx +++ b/src/components/connection-method-selection-dialog.tsx @@ -179,12 +179,7 @@ export const ConnectionMethodSelectionDialog: FC Date: Thu, 25 Jan 2024 14:23:49 +0800 Subject: [PATCH 18/21] =?UTF-8?q?=F0=9F=92=84=20Use=20=20for=20Au?= =?UTF-8?q?thcore=20dialog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/authcore-dialog.tsx | 28 ++++++++++++++++++++++++++++ src/components/dialog.tsx | 10 +++++++++- src/index.tsx | 15 ++++++++++++++- src/utils/authcore.ts | 22 ++++++++++++---------- 4 files changed, 63 insertions(+), 12 deletions(-) create mode 100644 src/components/authcore-dialog.tsx diff --git a/src/components/authcore-dialog.tsx b/src/components/authcore-dialog.tsx new file mode 100644 index 0000000..888c25d --- /dev/null +++ b/src/components/authcore-dialog.tsx @@ -0,0 +1,28 @@ +import React, { FC, useEffect } from 'react'; + +import { Dialog } from './dialog'; + +const AUTHCORE_DIALOG_ID = 'authcore-dialog'; + +export interface AuthcoreDialogProps { + onMount?: (payload: { containerId: string }) => void; +} + +export const AuthcoreDialog: FC = ({ onMount }) => { + const [isDialogOpen, setDialogOpen] = React.useState(true); + const closeDialog = React.useCallback(() => { + setDialogOpen(false); + }, []); + useEffect(() => { + onMount?.({ containerId: AUTHCORE_DIALOG_ID }); + }, [onMount]); + return ( + +
+
+ ); +}; diff --git a/src/components/dialog.tsx b/src/components/dialog.tsx index 5d3ffee..78037bd 100644 --- a/src/components/dialog.tsx +++ b/src/components/dialog.tsx @@ -1,15 +1,18 @@ import React, { FC, HTMLAttributes } from 'react'; import { Dialog as DialogBase } from '@headlessui/react'; +import classNames from 'classnames'; export interface DialogProps extends HTMLAttributes { isOpen?: boolean; + isNoHorizontalPadding?: boolean; onClose?: () => void; } export const Dialog: FC = ({ isOpen = false, children, + isNoHorizontalPadding = false, onClose = () => {}, }) => { return ( @@ -43,7 +46,12 @@ export const Dialog: FC = ({ -
+
{children}
diff --git a/src/index.tsx b/src/index.tsx index 9828c7b..b658455 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -4,6 +4,7 @@ import { AccountData } from '@cosmjs/proto-signing'; import { IQRCodeModal } from '@walletconnect/legacy-types'; import EventEmitter from 'events'; +import { AuthcoreDialog } from './components/authcore-dialog'; import { ConnectionMethodSelectionDialog } from './components/connection-method-selection-dialog'; import { WalletConnectQRCodeDialog } from './components/walletconnect-dialog'; @@ -354,7 +355,19 @@ export class LikeCoinWalletConnector { switch (methodType) { case LikeCoinWalletConnectorMethodType.LikerId: const { accessToken } = params || {}; - initiator = initAuthcore(this.options, accessToken); + if (!accessToken) { + initiator = new Promise(() => { + this._renderingRoot.render( + { + initAuthcore(this.options, { containerId }); + }} + /> + ); + }); + } else { + initiator = initAuthcore(this.options, { accessToken }); + } break; case LikeCoinWalletConnectorMethodType.Keplr: diff --git a/src/utils/authcore.ts b/src/utils/authcore.ts index 5d34290..5b7e535 100644 --- a/src/utils/authcore.ts +++ b/src/utils/authcore.ts @@ -23,7 +23,13 @@ let keyVaultClient: any | null = null; export async function initAuthcore( options: LikeCoinWalletConnectorOptions, - accessToken?: string + { + accessToken, + containerId, + }: { + accessToken?: string; + containerId?: string; + } = {} ): Promise { const authcoreApiHost = options.authcoreApiHost; @@ -51,17 +57,13 @@ export async function initAuthcore( }; }); } else { - // TODO: Better login dialog - const container = document.createElement('div'); - container.setAttribute('id', 'authcore-dialog'); - container.setAttribute( - 'style', - 'background-color: white; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 9999;' - ); - document.body.appendChild(container); + if (!containerId) { + throw new Error('containerId is required for initAuthcore'); + } + new AuthCoreWidgets.Login({ primaryColour: '#28646e', - container: 'authcore-dialog', + container: containerId, root: `${authcoreApiHost}/widgets`, initialScreen: 'signin', socialLoginPaneStyle: 'top', From 358268554863d0d415a16d9ae6578a75d0f8dd4e Mon Sep 17 00:00:00 2001 From: "Ng Wing Tat, David" Date: Thu, 25 Jan 2024 17:22:39 +0800 Subject: [PATCH 19/21] =?UTF-8?q?=F0=9F=94=96=20Bump=20version=20to=20v0.2?= =?UTF-8?q?6.0-beta.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ab3494d..5a71285 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.26.0-beta.5", + "version": "0.26.0-beta.6", "license": "GPL-3.0-or-later", "main": "dist/index.js", "typings": "dist/index.d.ts", From e98e2c2a523c97437ae91ed05c90bb39f73c8c81 Mon Sep 17 00:00:00 2001 From: "Ng Wing Tat, David" Date: Thu, 25 Jan 2024 18:20:29 +0800 Subject: [PATCH 20/21] =?UTF-8?q?=F0=9F=90=9B=20Fix=20stuck=20after=20clos?= =?UTF-8?q?ing=20Authcore=20dialog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/authcore-dialog.tsx | 9 +++++++-- src/index.tsx | 12 ++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/components/authcore-dialog.tsx b/src/components/authcore-dialog.tsx index 888c25d..14b1567 100644 --- a/src/components/authcore-dialog.tsx +++ b/src/components/authcore-dialog.tsx @@ -6,16 +6,21 @@ const AUTHCORE_DIALOG_ID = 'authcore-dialog'; export interface AuthcoreDialogProps { onMount?: (payload: { containerId: string }) => void; + onClose?: () => void; } -export const AuthcoreDialog: FC = ({ onMount }) => { +export const AuthcoreDialog: FC = ({ + onMount, + onClose, +}) => { const [isDialogOpen, setDialogOpen] = React.useState(true); const closeDialog = React.useCallback(() => { setDialogOpen(false); + onClose?.(); }, []); useEffect(() => { onMount?.({ containerId: AUTHCORE_DIALOG_ID }); - }, [onMount]); + }, [onMount, onClose]); return ( { + initiator = new Promise(resolve => { this._renderingRoot.render( { initAuthcore(this.options, { containerId }); }} + onClose={() => { + this.closeDialog(); + resolve(undefined); + this._events.emit('authcore_auth_closed'); + }} /> ); }); @@ -435,7 +440,10 @@ export class LikeCoinWalletConnector { } const result = await initiator; - if (!result) throw new Error('ACCOUNT_INIT_FAILED'); + if (!result) { + this._events.emit('account_init_stopped', methodType); + return; + } this._accountChangeListener = () => { this.handleAccountChange(methodType); From 1154696ee56b3a2f57d93df0f69f3a7287f10675 Mon Sep 17 00:00:00 2001 From: "Ng Wing Tat, David" Date: Thu, 25 Jan 2024 23:34:27 +0800 Subject: [PATCH 21/21] =?UTF-8?q?=F0=9F=94=96=20Bump=20version=20to=20v0.2?= =?UTF-8?q?6.0-beta.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5a71285..f596957 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.26.0-beta.6", + "version": "0.26.0-beta.7", "license": "GPL-3.0-or-later", "main": "dist/index.js", "typings": "dist/index.d.ts",