You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
503 B

10 years ago
10 years ago
  1. package account
  2. import (
  3. . "github.com/tendermint/tendermint/common"
  4. )
  5. type PrivAccount struct {
  6. Address []byte
  7. PubKey PubKey
  8. PrivKey PrivKey
  9. }
  10. // Generates a new account with private key.
  11. func GenPrivAccount() *PrivAccount {
  12. privKey := PrivKeyEd25519(CRandBytes(32))
  13. return &PrivAccount{
  14. Address: privKey.PubKey().Address(),
  15. PubKey: privKey.PubKey(),
  16. PrivKey: privKey,
  17. }
  18. }
  19. func (privAccount *PrivAccount) Sign(o Signable) Signature {
  20. return privAccount.PrivKey.Sign(SignBytes(o))
  21. }