{"id":23711380,"url":"https://github.com/springrole/springwallet","last_synced_at":"2026-02-07T21:30:18.074Z","repository":{"id":35055889,"uuid":"180376388","full_name":"SpringRole/springwallet","owner":"SpringRole","description":"Wallet for SpringRole users","archived":false,"fork":false,"pushed_at":"2023-07-19T01:06:04.000Z","size":1592,"stargazers_count":0,"open_issues_count":11,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-02-16T17:55:13.353Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SpringRole.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-09T13:44:31.000Z","updated_at":"2021-04-05T14:31:22.000Z","dependencies_parsed_at":"2023-01-15T13:01:05.418Z","dependency_job_id":null,"html_url":"https://github.com/SpringRole/springwallet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpringRole%2Fspringwallet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpringRole%2Fspringwallet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpringRole%2Fspringwallet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpringRole%2Fspringwallet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SpringRole","download_url":"https://codeload.github.com/SpringRole/springwallet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239800427,"owners_count":19699122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-30T19:49:28.848Z","updated_at":"2026-02-07T21:30:18.009Z","avatar_url":"https://github.com/SpringRole.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SpringWallet\n\n-   [About](#about)\n-   [Usage](#usage)\n-   [Contributing](#contributing)\n\n## About\n\nSpringWallet - A simple wallet for flexible identity management for your frontend application\n\n#### Basic Usage\n\n1.  Install `springwallet` with `npm`.\n\n    ```npm install @springrole/springwallet --save``` or ```yarn add @springrole/springwallet```\n\n2. Import springwallet into your project.\n\n    ```js \n    import { SpringWallet } from '@springrole/springwallet';\n    ```\n3. Generate 12 words random mnemonic\n\n    ```js\n    const mnemonic = SpringWallet.generateMnemonic();\n    ```\n4. Create a new wallet using plain text mnemonic and encrypt it with password\n\n    ```js\n    async function createWallet(plainTextMnemonic, password) {\n        const encryptedMnemonic = await SpringWallet.encryptMnemonic(plainTextMnemonic, password); // encrypting mnemonic\n        const wallet = await SpringWallet.initializeWalletFromMnemonic(plainTextMnemonic); // initializing wallet \n        const address = wallet.getChecksumAddressString(); // wallet address\n        const key = wallet.getPrivateKey().toString('hex'); // private key\n        await SpringWallet.setWalletSession(address, encryptedMnemonic); // saving wallet session in localStorage\n        sessionStorage.setItem('wallet-session', key); // persist wallet private key in sessionStorage\n        return true;\n    }\n    ```\n\n   **Note**:  encrypted mnemonic and address of the wallet will be store in localStorage at key 'wallet-session'\n\n5. Fetch wallet's address and encrypted mnemonic\n\n    ```js\n    const { address, encryptedMnemonic } = SpringWallet.getWalletSession();\n    ```\n6. Decrypt encryptedMnemonic and unlock wallet\n\n    ```js\n    async function unlockWallet(encryptedMnemonic, password) {\n      let plainTextMnemonic;\n      try {\n        plainTextMnemonic = await SpringWallet.decryptMnemonic(encryptedMnemonic, password);\n      } catch {\n        return false;\n      }\n      return SpringWallet.unlockWallet(plainTextMnemonic);\n    }\n    ```\n\n7. Use SpringWallet provider with web3.js\n\n    ```js\n    const springwallet = new SpringWallet({\n        rpcUrl: \"http://localhost:8545\",\n        chainId: \"1337\"\n      });\n    \n    const web3 = new Web3(springwallet.provider);\n    return web3;\n    ```\n    **NOTE** SpringWallet needs to be unlocked before performing any web3 actions, like `getAccounts()`, `getBalance()`\n\n#### Advance Usage\n\n1. Change SpringWallet password\n\n    ```js\n    async function changeWalletPassword(address, encryptedMnemonic, oldPassword, newPassword) {\n      const mnemonicPhrase = await SpringWallet.decryptMnemonic(encryptedMnemonic, oldPassword);\n      const newEncryptedMnemonic = await SpringWallet.encryptMnemonic(mnemonicPhrase, newPassword);\n      return true;\n    }\n    ```\n    **NOTE** This will decrypt mnemonic with old password and reencrypts it using new password which will create new encrypted mnemonic \n    \n2. Reset SpringWallet password, needs the plaintext mnemonic \n\n    ```js\n    async function resetWalletPassword(plainTextMnemonic, newPassword) {\n      const newEncryptedMnemonic = await SpringWallet.encryptMnemonic(plainTextMnemonic, newPassword);\n      const wallet = await SpringWallet.initializeWalletFromMnemonic(plainTextMnemonic);\n      const walletAddress = wallet.getChecksumAddressString();\n      return true;\n    }\n    ```\n    \n## Contributing\n\nTODO\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspringrole%2Fspringwallet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspringrole%2Fspringwallet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspringrole%2Fspringwallet/lists"}