Skip to content

Commit

Permalink
Refactored encryption parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
macterra committed Jan 2, 2025
1 parent a6ded54 commit e82ee00
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
14 changes: 10 additions & 4 deletions services/gatekeeper/client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,18 @@ function App() {
keymaster={keymaster}
title={'Keymaster Browser Wallet Demo'}
challengeDID={challengeDID}
encryptWallet={openEncryptModal}
decryptWallet={decryptWallet}
isWalletEncrypted={isEncrypted}
isCryptoAvailable={isCryptoAvailable}
encryption={
isCryptoAvailable
? {
encryptWallet: openEncryptModal,
decryptWallet: decryptWallet,
isWalletEncrypted: isEncrypted,
}
: undefined
}
/>
)}

</>
);
}
Expand Down
16 changes: 8 additions & 8 deletions services/gatekeeper/client/src/KeymasterUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Table, TableBody, TableRow, TableCell, TextField, Typography } from '@m
import axios from 'axios';
import './App.css';

function KeymasterUI({ keymaster, title, challengeDID, encryptWallet, decryptWallet, isWalletEncrypted, isCryptoAvailable }) {
function KeymasterUI({ keymaster, title, challengeDID, encryption }) {

const [tab, setTab] = useState(null);
const [currentId, setCurrentId] = useState('');
Expand Down Expand Up @@ -887,9 +887,9 @@ function KeymasterUI({ keymaster, title, challengeDID, encryptWallet, decryptWal
}
}

async function handleDecryptWallet() {
await decryptWallet();
}
// async function handleDecryptWallet() {
// await decryptWallet();
// }

return (
<div className="App">
Expand Down Expand Up @@ -1849,16 +1849,16 @@ function KeymasterUI({ keymaster, title, challengeDID, encryptWallet, decryptWal
</Grid>
</Grid>
<p />
{isCryptoAvailable && (
{encryption && (
<>
<Grid container direction="row" justifyContent="flex-start" alignItems="center" spacing={3}>
<Grid item>
{ isWalletEncrypted ? (
<Button variant="contained" color="primary" onClick={handleDecryptWallet}>
{ encryption.isWalletEncrypted ? (
<Button variant="contained" color="primary" onClick={encryption.decryptWallet}>
Decrypt Wallet
</Button>
) : (
<Button variant="contained" color="primary" onClick={encryptWallet}>
<Button variant="contained" color="primary" onClick={encryption.encryptWallet}>
Encrypt Wallet
</Button>
)}
Expand Down

0 comments on commit e82ee00

Please sign in to comment.