Skip to content

Commit

Permalink
fix(data-store): decrypt keys before listing in `PrivateKeyStore.list…
Browse files Browse the repository at this point in the history
…Keys()`

fixes #1136
  • Loading branch information
mirceanis committed Feb 24, 2023
1 parent 0a22d9c commit a66169f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/data-store/src/identifier/private-key-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ export class PrivateKeyStore extends AbstractPrivateKeyStore {
}

async listKeys(): Promise<Array<ManagedPrivateKey>> {
const keys = await (await getConnectedDb(this.dbConnection)).getRepository(PrivateKey).find()
let keys = await (await getConnectedDb(this.dbConnection)).getRepository(PrivateKey).find()
if (this.secretBox) {
for (const key of keys) {
key.privateKeyHex = await this.secretBox?.decrypt(key.privateKeyHex) as string
}
}
return keys
}
}

0 comments on commit a66169f

Please sign in to comment.