Skip to content
This repository was archived by the owner on Oct 19, 2024. It is now read-only.

Support for encrypted JSON keystore #138

Merged
merged 3 commits into from
Jan 11, 2021

Conversation

roynalnaruto
Copy link
Collaborator

Motivation

This PR adds support for encrypted JSON keystore in the Wallet module in ethers-signers.

Solution

Dependencies added:

  1. eth-keystore-rs

API

  • Create and store a new encrypted JSON keystore
pub fn new_keystore<P, R, S>(dir: P, rng: &mut R, password: S) -> Result<Wallet, WalletError>
where
  P: AsRef<Path>,
  R: Rng + CryptoRng,
  S: AsRef<[u8]>,
  • Decrypt an existing encrypted JSON keystore
pub fn decrypt_keystore<P, S>(keypath: P, password: S) -> Result<Wallet, WalletError>
where
  P: AsRef<Path>,
  S: AsRef<[u8]>,

Tests

Since the eth-keystore-rs crate has its own tests, I've only tested the scenario where the signature generated by a random new keystore should match the signature generated when the same keystore is decrypted.

@roynalnaruto roynalnaruto requested a review from gakonst January 10, 2021 11:42
@gakonst gakonst merged commit b1461cc into gakonst:master Jan 11, 2021
meetmangukiya pushed a commit to meetmangukiya/ethers-rs that referenced this pull request Mar 21, 2022
* feat(cli): add DAPP_TEST_TIMESTAMP and TEST_NUMBER

* feat(dapp): allow specifying sender for all txs

* feat(cli): allow specifying the sender for all calls

* chore: cargo fmt
@roynalnaruto roynalnaruto deleted the feat/encrypted-json-keystore branch April 16, 2022 15:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants