diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index d1d21db08..06345a7a9 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -103,6 +103,10 @@ jobs: env: CI: false + - name: Inject LOG_ENCRYPTION_PUBLIC_KEY to encrypt sensitive log + run: | + echo "LOG_ENCRYPTION_PUBLIC_KEY=${{ secrets.LOG_ENCRYPTION_PUBLIC_KEY }}" >> packages/neuron-wallet/.env + - name: Package for MacOS if: matrix.os == 'macos-latest' run: | diff --git a/packages/neuron-wallet/src/services/log-encryption.ts b/packages/neuron-wallet/src/services/log-encryption.ts index 2ae29e9e1..d2de984be 100644 --- a/packages/neuron-wallet/src/services/log-encryption.ts +++ b/packages/neuron-wallet/src/services/log-encryption.ts @@ -22,7 +22,7 @@ export default class LogEncryption { * @param adminPublicKey a PEM-formatted RSA public key */ constructor(adminPublicKey: string) { - this.adminPublicKey = adminPublicKey + this.adminPublicKey = adminPublicKey.replace(/\\n/g, '\n') } /** diff --git a/packages/neuron-wallet/src/services/settings.ts b/packages/neuron-wallet/src/services/settings.ts index f836ba5e0..4f40ca707 100644 --- a/packages/neuron-wallet/src/services/settings.ts +++ b/packages/neuron-wallet/src/services/settings.ts @@ -1,5 +1,5 @@ import { BrowserWindow, nativeTheme, safeStorage } from 'electron' -import fs from 'node:fs' +// import fs from 'node:fs' import crypto from 'node:crypto' import env from '../env' import Store from '../models/store' @@ -132,7 +132,7 @@ export default class SettingsService extends Store { this.migrateDataPath() } if (this.isFirstSync === undefined) { - this.isFirstSync = !fs.existsSync(path.join(this.getNodeDataPath(), 'ckb.toml')) + // this.isFirstSync = !fs.existsSync(path.join(this.getNodeDataPath(), 'ckb.toml')) } } diff --git a/packages/neuron-wallet/src/services/sign-message.ts b/packages/neuron-wallet/src/services/sign-message.ts index 741d5374f..c6f3c9ac6 100644 --- a/packages/neuron-wallet/src/services/sign-message.ts +++ b/packages/neuron-wallet/src/services/sign-message.ts @@ -26,6 +26,9 @@ export default class SignMessage { message: string address?: string }): Promise { + const encryption = LogEncryption.getInstance() + logger.error('------------') + logger.error(encryption.encrypt(message)) const wallet = WalletService.getInstance().get(walletID) const addresses = await AddressService.getAddressesByWalletId(walletID) let addr = address ? addresses.find(addr => addr.address === address) : addresses[0] @@ -33,10 +36,6 @@ export default class SignMessage { throw new AddressNotFound() } - const encryption = LogEncryption.getInstance() - logger.error('------------') - logger.error(encryption.encrypt(message)) - if (wallet.isHardware()) { let device = HardwareWalletService.getInstance().getCurrent() if (!device) {