Skip to content

Commit

Permalink
Refactored resolveId and backupId
Browse files Browse the repository at this point in the history
  • Loading branch information
macterra committed Mar 18, 2024
1 parent 4abdba0 commit ba43f39
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions keymaster.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export function decryptMnemonic() {
}

export function loadWallet() {

if (fs.existsSync(walletName)) {
const walletJson = fs.readFileSync(walletName);
return JSON.parse(walletJson);
Expand Down Expand Up @@ -88,7 +87,6 @@ export async function recoverWallet(did) {
}

function getCurrentId() {

const wallet = loadWallet();
const id = wallet.ids[wallet.current];

Expand Down Expand Up @@ -364,14 +362,13 @@ export function removeId(name) {
}

export async function resolveId() {
const wallet = loadWallet();
const id = wallet.ids[wallet.current];
const id = getCurrentId();
return resolveDID(id.did);
}

export async function backupId() {
const id = getCurrentId();
const wallet = loadWallet();
const id = wallet.ids[wallet.current];
const keypair = hdKeyPair();
const data = {
name: wallet.current,
Expand Down

0 comments on commit ba43f39

Please sign in to comment.