Skip to content

Commit

Permalink
Added method to append directly a private key to a KeyBag
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthieu Vachon committed Dec 14, 2020
1 parent 96d4aeb commit c16a0d3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 11 additions & 1 deletion signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bufio"
"context"
"crypto/sha256"
"errors"
"fmt"
"os"
"strings"
Expand Down Expand Up @@ -80,7 +81,16 @@ func (b *KeyBag) Add(wifKey string) error {
if err != nil {
return err
}
b.Keys = append(b.Keys, privKey)

return b.Append(privKey)
}

func (b *KeyBag) Append(privateKey *ecc.PrivateKey) error {
if privateKey == nil {
return errors.New("appending a nil private key is forbidden")
}

b.Keys = append(b.Keys, privateKey)
return nil
}

Expand Down
1 change: 0 additions & 1 deletion wallet/wallet.go

This file was deleted.

0 comments on commit c16a0d3

Please sign in to comment.