Skip to content

m8b-dev/ether-binder-json-keystore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

JSON Keystore Wallet for Ether Binder

This is separated from Ether Binder library addon, due to extension dependency.

This library requires PECL extension scrypt. To install extension:

pecl install scrypt

Installing:

composer require m8b/ethbnd-keystore

Usage

To read the existing json keystore, get the json and password, and drop it to loadFromKeystore function

$keystore = file_get_contents("path/to/key.json");
$wallet   = \M8B\EtherBinder\Wallet\JSONKeystoreWallet::loadFromKeystore($keystore, "password"); 

To encrypt existing key

$key = \M8B\EtherBinder\Crypto\Key::fromHex("0x....");
$wallet = \M8B\EtherBinder\Wallet\JSONKeystoreWallet::wrap($key);
file_put_contents($wallet->export("password"));

To generate new key and immediately wrap it with json keystore

$wallet = \M8B\EtherBinder\Wallet\JSONKeystoreWallet::generate();

License

Mozilla public license 2.0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages