Skip to content

Commit

Permalink
emit after lock/unlock
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuck LeDuc Díaz committed Apr 20, 2020
1 parent 09d652c commit fc318d7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@lorena-ssi/lorena-sdk",
"version": "1.0.13",
"version": "1.0.14",
"description": "Lorena SDK",
"author": "Alex Puig <alex@caelumlabs.com>",
"license": "MIT",
Expand Down
22 changes: 14 additions & 8 deletions src/index.js
Expand Up @@ -72,22 +72,28 @@ export default class Lorena extends EventEmitter {
* Locks (saves and encrypts) the wallet
*
* @param {string} password Wallet password
* @returns {object} Wallet info.
* @returns {boolean} success
*/
lock (password) {
this.emit('lock', password)
return this.wallet.lock(password)
async lock (password) {
const result = this.wallet.lock(password)
if (result) {
this.emit('lock', password)
}
return result
}

/**
* UnLocks (open and decrypts) the wallet
*
* @param {string} password Wallet password
* @returns {object} Wallet info.
* @returns {boolean} success
*/
unlock (password) {
this.emit('unlock', password)
return this.wallet.unlock(password)
async unlock (password) {
const result = this.wallet.unlock(password)
if (result) {
this.emit('unlock', password)
}
return result
}

/**
Expand Down

0 comments on commit fc318d7

Please sign in to comment.