Skip to content

Commit

Permalink
feat: encrypt web wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar committed Dec 13, 2024
1 parent 9c5a684 commit 22ccdd3
Show file tree
Hide file tree
Showing 6 changed files with 906 additions and 127 deletions.
4 changes: 2 additions & 2 deletions packages/keymaster/src/db-wallet-json-enc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function setWallet(wallet) {

export function saveWallet(wallet, overwrite = false) {
if (!passphrase) {
throw new Error('KC_ENCRYPTED_PASSPHRASE not set');
throw new Error('Passphrase not set');
}

const walletJson = JSON.stringify(wallet, null, 4);
Expand All @@ -43,7 +43,7 @@ export function saveWallet(wallet, overwrite = false) {

export function loadWallet() {
if (!passphrase) {
throw new Error('KC_ENCRYPTED_PASSPHRASE not set');
throw new Error('Passphrase not set');
}

const encryptedData = baseWallet.loadWallet();
Expand Down
28 changes: 28 additions & 0 deletions services/gatekeeper/client/craco.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const webpack = require('webpack');

module.exports = {
webpack: {
configure: (webpackConfig) => {
webpackConfig.resolve.fallback = {
...webpackConfig.resolve.fallback,
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
process: require.resolve('process/browser.js'),
};

webpackConfig.resolve.alias = {
...(webpackConfig.resolve.alias || {}),
'process/browser': 'process/browser.js'
};

webpackConfig.plugins = (webpackConfig.plugins || []).concat([
new webpack.ProvidePlugin({
process: 'process/browser.js',
}),
]);

return webpackConfig;
},
},
};

Loading

0 comments on commit 22ccdd3

Please sign in to comment.