Skip to content

Commit

Permalink
ci: inject LOG_ENCRYPTION_PUBLIC_KEY from github env
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY committed Aug 11, 2024
1 parent b2a73ed commit 7f81885
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-wallet/src/services/log-encryption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/neuron-wallet/src/services/settings.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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'))
}
}

Expand Down
7 changes: 3 additions & 4 deletions packages/neuron-wallet/src/services/sign-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,16 @@ export default class SignMessage {
message: string
address?: string
}): Promise<string> {
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]
if (!addr) {
throw new AddressNotFound()
}

const encryption = LogEncryption.getInstance()
logger.error('------------')
logger.error(encryption.encrypt(message))

if (wallet.isHardware()) {
let device = HardwareWalletService.getInstance().getCurrent()
if (!device) {
Expand Down

1 comment on commit 7f81885

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Packaging for test is done in 10339737081

Please sign in to comment.