Wallet signs acks

This commit is contained in:
Mark Spanbroek 2021-07-05 11:19:21 +02:00
parent 34254152b3
commit 84645a1208
2 changed files with 11 additions and 0 deletions

View File

@ -1,8 +1,10 @@
import ./keys
import ./transactions
import ./acks
export keys
export transactions
export acks
type
Wallet* = object
@ -16,3 +18,6 @@ func id*(wallet: Wallet): PublicKey =
func sign*(wallet: Wallet, transaction: var Transaction) =
wallet.key.sign(transaction)
func sign*(wallet: Wallet, ack: var Ack) =
wallet.key.sign(ack)

View File

@ -16,3 +16,9 @@ suite "Wallets":
check transaction.signature == Signature.default
wallet.sign(transaction)
check transaction.signature == key.sign(transaction.hash.toBytes)
test "wallet can sign acknowledgment":
var ack = Ack.example
check ack.signature.isNone
wallet.sign(ack)
check ack.signature == key.sign(ack.hash.toBytes).some