signer

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EthereumHash

func EthereumHash(data []byte) []byte

Types

type ArweaveSigner

type ArweaveSigner struct {
	PrivateKey *rsa.PrivateKey
	Owner      []byte
}

func NewArweaveSigner

func NewArweaveSigner(privateKeyJWK string) (self *ArweaveSigner, err error)

func (*ArweaveSigner) GetOwner

func (self *ArweaveSigner) GetOwner() ([]byte, error)

func (*ArweaveSigner) GetOwnerLength

func (self *ArweaveSigner) GetOwnerLength() int

func (*ArweaveSigner) GetSignatureLength

func (self *ArweaveSigner) GetSignatureLength() int

func (*ArweaveSigner) GetType

func (self *ArweaveSigner) GetType() SignatureType

func (*ArweaveSigner) Sign

func (self *ArweaveSigner) Sign(data []byte) (signature []byte, err error)

func (*ArweaveSigner) Verify

func (self *ArweaveSigner) Verify(data []byte, signature []byte) (err error)

type EthereumSigner

type EthereumSigner struct {
	PrivateKey *ecdsa.PrivateKey
	Owner      []byte
}

func NewEthereumSigner

func NewEthereumSigner(privateKeyHex string) (self *EthereumSigner, err error)

func (*EthereumSigner) GetOwner

func (self *EthereumSigner) GetOwner() ([]byte, error)

func (*EthereumSigner) GetOwnerLength

func (self *EthereumSigner) GetOwnerLength() int

func (*EthereumSigner) GetSignatureLength

func (self *EthereumSigner) GetSignatureLength() int

func (*EthereumSigner) GetType

func (self *EthereumSigner) GetType() SignatureType

func (*EthereumSigner) Sign

func (self *EthereumSigner) Sign(data []byte) (signature []byte, err error)

func (*EthereumSigner) Verify

func (self *EthereumSigner) Verify(data []byte, signature []byte) (err error)

type SignatureType

type SignatureType int
const (
	SignatureTypeArweave  SignatureType = 1
	SignatureTypeEthereum SignatureType = 3
)

Values are taken from bundlr library https://github.com/Bundlr-Network/arbundles/blob/5413fe576098355f7502a5fa9456f8db6a861492/src/constants.ts#L4

func (SignatureType) Bytes

func (self SignatureType) Bytes() []byte

type Signer

type Signer interface {
	Sign(data []byte) (signature []byte, err error)
	Verify(data []byte, signature []byte) (err error)
	GetOwner() ([]byte, error)
	GetType() SignatureType
	GetSignatureLength() int
	GetOwnerLength() int
}

func GetSigner

func GetSigner(SignatureType SignatureType, owner []byte) (signer Signer, err error)

Signer created ONLY FOR VERIFICATION of the signature. Private key is not initialized.

Jump to

Keyboard shortcuts

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