signer

package
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 11 Imported by: 1

Documentation

Overview

Package signer creates crypto safe signature with different inputs

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidPrivateKey error when private key is invalid
	ErrInvalidPrivateKey = errors.New("invalid private key")
	// ErrInvalidPPK error when PPK is invalid
	ErrInvalidPPK = errors.New("invalid ppk")
)

Functions

This section is empty.

Types

type Account

type Account struct {
	Address    string
	PublicKey  string
	PrivateKey string
}

Account holds an account's data

type PPK added in v0.10.5

type PPK struct {
	Kdf        string `json:"kdf"`
	Salt       string `json:"salt"`
	SecParam   string `json:"secparam"`
	Hint       string `json:"hint"`
	Ciphertext string `json:"ciphertext"`
}

PPK struct handler for Portable Private Key file Do not change this struct to stay compatible

func NewPPK added in v0.10.5

func NewPPK(privateKey, password, hint string) (*PPK, error)

NewPPK returns an instance of PPK for given input

func (*PPK) Validate added in v0.10.5

func (ppk *PPK) Validate() bool

Validate returns bool representing if PPK instance is valid or not

type Signer

type Signer struct {
	// contains filtered or unexported fields
}

Signer struct handler

func NewRandomSigner

func NewRandomSigner() (*Signer, error)

NewRandomSigner returns a Signer with random keys

func NewSignerFromPPK added in v0.10.5

func NewSignerFromPPK(password string, ppk *PPK) (*Signer, error)

NewSignerFromPPK returns Signer from PPK and its password

func NewSignerFromPrivateKey

func NewSignerFromPrivateKey(privateKey string) (*Signer, error)

NewSignerFromPrivateKey returns Signer from private key

func (*Signer) GetAccount

func (s *Signer) GetAccount() *Account

GetAccount returns Account struct holding all key values

func (*Signer) GetAddress

func (s *Signer) GetAddress() string

GetAddress returns address value

func (*Signer) GetPrivateKey

func (s *Signer) GetPrivateKey() string

GetPrivateKey returns private key value

func (*Signer) GetPublicKey

func (s *Signer) GetPublicKey() string

GetPublicKey returns public key value

func (*Signer) Sign

func (s *Signer) Sign(payload []byte) (string, error)

Sign returns a signed request as encoded hex string

func (*Signer) SignBytes

func (s *Signer) SignBytes(payload []byte) ([]byte, error)

SignBytes returns a signed request as raw bytes

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL