stark

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Overview

Package stark implements utilities for generating imx.L2Signer

Index

Constants

View Source
const (
	DefaultSeedMessage = "Only sign this request if you’ve initiated an action with Immutable X."
	ApplicationName    = "immutablex"
	LayerName          = "starkex"
	Index              = "1"
)

Variables

This section is empty.

Functions

func GenerateKey

func GenerateKey() (string, error)

GenerateKey generates a random key that can be used to create StarkSigner. On creation save this key for future usage as this key will be required to reuse your stark signer. @return Randomly generated private key.

func GenerateLegacyKey added in v1.0.0

func GenerateLegacyKey(signer imx.L1Signer) (string, error)

GenerateLegacyKey Generates a deterministic Stark private key from the provided signer. @return Deterministically generated private key in hex.

Types

type Signer

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

StarkSigner implements L2Signer interface.

func NewSigner

func NewSigner(privateKeyInHex string) (*Signer, error)

NewSigner created a new stark signer with the given private stark key.

func (*Signer) GetPublicKey added in v1.0.0

func (base *Signer) GetPublicKey() string

GetPublicKey returns the stark public key of the StarkSigner as a 64 digit hex string prefixed with 0x.

func (*Signer) PublicKey added in v1.0.0

func (base *Signer) PublicKey() *big.Int

PublicKey returns the stark public key of the StarkSigner as a big.Int.

func (*Signer) SignMessage

func (base *Signer) SignMessage(message string) (string, error)

func (*Signer) VerifySignature

func (base *Signer) VerifySignature(hash *big.Int, signature, signersPublicKey string) error

VerifySignature validates the given signature is signed by the requiredSigner or not.

Jump to

Keyboard shortcuts

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