starkkey

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReportToSigData

func ReportToSigData(reportCtx types.ReportContext, report types.Report) (*big.Int, error)

func ToEncryptedJSON

func ToEncryptedJSON(key Key, password string, scryptParams commonkeystore.ScryptParams) (export []byte, err error)

ToEncryptedJSON returns encrypted JSON representing key

Types

type Key

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

Key represents Starknet key

func FromEncryptedJSON

func FromEncryptedJSON(keyJSON []byte, password string) (Key, error)

FromEncryptedJSON gets key from json and password

func GenerateKey

func GenerateKey(material io.Reader) (k Key, err error)

reimplements parts of https://github.com/NethermindEth/starknet.go/blob/0bdaab716ce24a521304744a8fbd8e01800c241d/curve/curve.go#L702 generate the PK as a pseudo-random number in the interval [1, CurveOrder - 1] using io.Reader, and Key struct

func KeyFor

func KeyFor(raw internal.Raw) Key

func MustNewInsecure

func MustNewInsecure(reader io.Reader) Key

MustNewInsecure return Key if no error

func New

func New() (Key, error)

New creates new Key

func (Key) ID

func (key Key) ID() string

ID gets Key ID

func (Key) PublicKey

func (key Key) PublicKey() PublicKey

PublicKey copies public key object

func (Key) Raw

func (key Key) Raw() internal.Raw

Raw from private key

func (Key) Sign

func (key Key) Sign(hash []byte) ([]byte, error)

func (Key) StarkKeyStr

func (key Key) StarkKeyStr() string

StarkKeyStr is the starknet public key associated to the private key it is the X component of the ECDSA pubkey and used in the deployment of the account contract this func is used in exporting it via CLI and API

type OCR2Key

type OCR2Key struct {
	Key
}

func NewOCR2Key

func NewOCR2Key(material io.Reader) (*OCR2Key, error)

func (*OCR2Key) Marshal

func (sk *OCR2Key) Marshal() ([]byte, error)

func (*OCR2Key) MaxSignatureLength

func (sk *OCR2Key) MaxSignatureLength() int

func (*OCR2Key) PublicKey

func (sk *OCR2Key) PublicKey() types.OnchainPublicKey

func (*OCR2Key) Sign

func (sk *OCR2Key) Sign(reportCtx types.ReportContext, report types.Report) ([]byte, error)

func (*OCR2Key) Sign3

func (sk *OCR2Key) Sign3(digest types.ConfigDigest, seqNr uint64, r types.Report) (signature []byte, err error)

func (*OCR2Key) SignBlob

func (sk *OCR2Key) SignBlob(b []byte) ([]byte, error)

func (*OCR2Key) Unmarshal

func (sk *OCR2Key) Unmarshal(in []byte) error

func (*OCR2Key) Verify

func (sk *OCR2Key) Verify(publicKey types.OnchainPublicKey, reportCtx types.ReportContext, report types.Report, signature []byte) bool

func (*OCR2Key) Verify3

func (sk *OCR2Key) Verify3(publicKey types.OnchainPublicKey, cd types.ConfigDigest, seqNr uint64, r types.Report, signature []byte) bool

func (*OCR2Key) VerifyBlob

func (sk *OCR2Key) VerifyBlob(pubkey types.OnchainPublicKey, b, sig []byte) bool

type PublicKey

type PublicKey struct {
	X, Y *big.Int
}

Jump to

Keyboard shortcuts

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