2.22.31 • Published 4 years ago

@chainx/keystore v2.22.31

Weekly downloads
2
License
-
Repository
-
Last release
4 years ago

@chainx/keystore

@chainx/keystore encode private key to json format data with passphrase and decode json data to private key with passphrase.

How to use

import KeyStore from '@chainx/keystore'

const privateKey = '0xa3fd913a9606bb71b04e74ee6afe69b4154782cfc47c9076d041c7a4ab11cf9e'
const passphrase = '123456'

const json = KeyStore.encrypt(privateKey, passphrase)
const decodedPrivateKey = KeyStore.decrypt(json, passphrase) // equal to privateKey

The json format is as follows

{
  "iv": [229, 40, 42, 188, 246, 119, 48, 74, 162, 121, 45, 167, 234, 9, 157, 254],
  "mac": [
    157, 166, 237, 84, 143, 60, 166, 156, 187, 137, 145, 106, 93, 239, 47, 220, 164, 10, 92, 105, 54, 105, 106, 31, 247,
    133, 117, 198, 220, 19, 58, 47
  ],
  "salt": [
    4, 153, 246, 15, 71, 62, 109, 9, 123, 33, 226, 248, 71, 45, 237, 213, 3, 135, 117, 244, 64, 184, 222, 221, 4, 205,
    218, 200, 9, 105, 134, 50
  ],
  "ciphertext": [
    212, 117, 246, 80, 62, 140, 46, 69, 155, 242, 117, 159, 0, 22, 128, 238, 123, 141, 118, 192, 113, 4, 78, 251, 246,
    149, 16, 11, 185, 236, 218, 232
  ],
  "iterations": 10240
}
2.22.31

4 years ago

2.22.2

5 years ago

2.22.0

5 years ago

2.21.2

5 years ago

2.21.0

5 years ago

2.21.0-y.5

5 years ago

2.21.0-y.4

5 years ago

2.21.0-y.3

5 years ago

2.20.2

5 years ago

2.20.0

5 years ago

2.19.1

5 years ago

2.17.0

5 years ago

2.17.0-y.3

5 years ago

2.16.0

5 years ago

2.15.0

5 years ago

2.13.0

5 years ago

2.13.0-beta.0

5 years ago

2.12.0

5 years ago

2.12.0-y.0

5 years ago

2.11.1

5 years ago

2.11.0

5 years ago

2.11.0-alpha.1

5 years ago

2.5.38

5 years ago

2.5.21

5 years ago

2.5.0

5 years ago

1.1.7-alpha.0

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago