Skip to content

Commit e66fda5

Browse files
committed
update Readme
1 parent 790f1cd commit e66fda5

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

README.md

+9-11
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ SpringWallet - A simple wallet for flexible identity management for your fronten
1212

1313
1. Install `springwallet` with `npm`.
1414

15-
```npm install springwallet --save``` or ```yarn add springwallet```
15+
```npm install @springrole/springwallet --save``` or ```yarn add @springrole/springwallet```
1616

1717
2. Import springwallet into your project.
1818

1919
```js
20-
import SpringWallet from '@springrole/springwallet';
20+
import { SpringWallet } from '@springrole/springwallet';
2121
```
2222
3. Generate 12 words random mnemonic
2323

@@ -28,7 +28,7 @@ SpringWallet - A simple wallet for flexible identity management for your fronten
2828

2929
```js
3030
async function createWallet(plainTextMnemonic, password) {
31-
const encryptedMnemonic = await encryptMnemonic(plainTextMnemonic, password); // encrypting mnemonic
31+
const encryptedMnemonic = await SpringWallet.encryptMnemonic(plainTextMnemonic, password); // encrypting mnemonic
3232
const wallet = await SpringWallet.initializeWalletFromMnemonic(plainTextMnemonic); // initializing wallet
3333
const address = wallet.getChecksumAddressString(); // wallet address
3434
const key = wallet.getPrivateKey().toString('hex'); // private key
@@ -51,7 +51,7 @@ SpringWallet - A simple wallet for flexible identity management for your fronten
5151
async function unlockWallet(encryptedMnemonic, password) {
5252
let plainTextMnemonic;
5353
try {
54-
plainTextMnemonic = await decryptMnemonic(encryptedMnemonic, password);
54+
plainTextMnemonic = await SpringWallet.decryptMnemonic(encryptedMnemonic, password);
5555
} catch {
5656
return false;
5757
}
@@ -78,10 +78,9 @@ SpringWallet - A simple wallet for flexible identity management for your fronten
7878
7979
```js
8080
async function changeWalletPassword(address, encryptedMnemonic, oldPassword, newPassword) {
81-
const mnemonicPhrase = await decryptMnemonic(encryptedMnemonic, oldPassword);
82-
const newEncryptedMnemonic = await encryptMnemonic(mnemonicPhrase, newPassword);
83-
const status = await updateEncryptedMnemonic(address, newEncryptedMnemonic);
84-
return status;
81+
const mnemonicPhrase = await SpringWallet.decryptMnemonic(encryptedMnemonic, oldPassword);
82+
const newEncryptedMnemonic = await SpringWallet.encryptMnemonic(mnemonicPhrase, newPassword);
83+
return true;
8584
}
8685
```
8786
**NOTE** This will decrypt mnemonic with old password and reencrypts it using new password which will create new encrypted mnemonic
@@ -90,11 +89,10 @@ SpringWallet - A simple wallet for flexible identity management for your fronten
9089
9190
```js
9291
async function resetWalletPassword(plainTextMnemonic, newPassword) {
93-
const newEncryptedMnemonic = await encryptMnemonic(plainTextMnemonic, newPassword);
92+
const newEncryptedMnemonic = await SpringWallet.encryptMnemonic(plainTextMnemonic, newPassword);
9493
const wallet = await SpringWallet.initializeWalletFromMnemonic(plainTextMnemonic);
9594
const walletAddress = wallet.getChecksumAddressString();
96-
const status = await updateEncryptedMnemonic(walletAddress, newEncryptedMnemonic);
97-
return status;
95+
return true;
9896
}
9997
```
10098

0 commit comments

Comments
 (0)