mirror of
https://github.com/status-im/nim-eth-keys.git
synced 2025-02-13 01:36:38 +00:00
* Add safe hex, endianness and bytes conversion tools * comment typo endianess -> endianness * Add libsecp256k1 - private and public keygen and serialization + tests
16 lines
599 B
Nim
16 lines
599 B
Nim
# Copyright (c) 2018 Status Research & Development GmbH
|
|
# Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
|
|
|
|
import ../src/eth_keys,
|
|
./config
|
|
|
|
import unittest
|
|
|
|
suite "Testing private -> public key conversion":
|
|
test "Known private to known public keys (test data from Ethereum eth-keys)":
|
|
for person in [alice, bob, eve]:
|
|
let privkey = initPrivateKey(person.privkey)
|
|
|
|
let computed_pubkey = privkey.public_key.serialize
|
|
|
|
check: computed_pubkey == "04" & person.pubkey # Serialization prefixes uncompressed public keys with 04 |