cryptolib

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: Apache-2.0 Imports: 18 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const IotaCoinType = uint32(4218)

/ IOTA coin type <https://github.com/satoshilabs/slips/blob/master/slip-0044.md>

View Source
const PrivateKeySize = ed25519.PrivateKeySize
View Source
const PublicKeySize = ed25519.PublicKeySize
View Source
const (
	SeedSize = ed25519.SeedSize
)

---

View Source
const ShimmerCoinType = uint32(4219)

/ Shimmer coin type <https://github.com/satoshilabs/slips/blob/master/slip-0044.md>

View Source
const SignatureSize = ed25519.SignatureSize
View Source
const TestnetCoinType = uint32(1)

testnet/alphanet uses COIN_TYPE = 1

Variables

This section is empty.

Functions

func IsVariantKeyPairValid added in v1.0.3

func IsVariantKeyPairValid(variantKeyPair VariantKeyPair) bool

func PointFromBytes added in v1.0.3

func PointFromBytes(data []byte, factory interface{ Point() kyber.Point }) (point kyber.Point, err error)

func PointFromReader added in v1.0.3

func PointFromReader(rr *rwutil.Reader, factory interface{ Point() kyber.Point }) (point kyber.Point)

func PointToWriter added in v1.0.3

func PointToWriter(ww *rwutil.Writer, point kyber.Point)

func ScalarFromBytes added in v1.0.3

func ScalarFromBytes(data []byte, factory interface{ Scalar() kyber.Scalar }) (scalar kyber.Scalar, err error)

func ScalarFromReader added in v1.0.3

func ScalarFromReader(rr *rwutil.Reader, factory interface{ Scalar() kyber.Scalar }) (scalar kyber.Scalar)

func ScalarToWriter added in v1.0.3

func ScalarToWriter(ww *rwutil.Writer, scalar kyber.Scalar)

func SignatureFromBytes

func SignatureFromBytes(bytes []byte) (result [SignatureSize]byte, err error)

Types

type KeyPair

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

func KeyPairFromPrivateKey added in v1.0.3

func KeyPairFromPrivateKey(privateKey *PrivateKey) *KeyPair

func KeyPairFromSeed added in v1.0.3

func KeyPairFromSeed(seed Seed) *KeyPair

func NewKeyPair

func NewKeyPair() *KeyPair

NewKeyPair creates a new key pair with a randomly generated seed

func (*KeyPair) Address

func (k *KeyPair) Address() *iotago.Ed25519Address

func (*KeyPair) AddressKeysForEd25519Address added in v1.0.3

func (k *KeyPair) AddressKeysForEd25519Address(addr *iotago.Ed25519Address) iotago.AddressKeys

func (*KeyPair) AsAddressSigner

func (k *KeyPair) AsAddressSigner() iotago.AddressSigner

func (*KeyPair) GetPrivateKey

func (k *KeyPair) GetPrivateKey() *PrivateKey

func (*KeyPair) GetPublicKey

func (k *KeyPair) GetPublicKey() *PublicKey

func (*KeyPair) IsNil added in v1.0.3

func (k *KeyPair) IsNil() bool

func (*KeyPair) IsValid

func (k *KeyPair) IsValid() bool

func (*KeyPair) Read added in v1.0.3

func (k *KeyPair) Read(r io.Reader) error

func (*KeyPair) Sign added in v1.0.3

func (k *KeyPair) Sign(addr iotago.Address, payload []byte) (iotago.Signature, error)

func (*KeyPair) SignBytes added in v1.0.3

func (k *KeyPair) SignBytes(data []byte) []byte

func (*KeyPair) Verify

func (k *KeyPair) Verify(message, sig []byte) bool

func (*KeyPair) Write added in v1.0.3

func (k *KeyPair) Write(w io.Writer) error

type PrivateKey

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

func NewPrivateKey

func NewPrivateKey() *PrivateKey

func PrivateKeyFromBytes added in v1.0.3

func PrivateKeyFromBytes(privateKeyBytes []byte) (*PrivateKey, error)

func PrivateKeyFromSeed added in v1.0.3

func PrivateKeyFromSeed(seed Seed) *PrivateKey

func (*PrivateKey) AddressKeys

func (pkT *PrivateKey) AddressKeys(addr iotago.Address) iotago.AddressKeys

func (*PrivateKey) AddressKeysForEd25519Address

func (pkT *PrivateKey) AddressKeysForEd25519Address(addr *iotago.Ed25519Address) iotago.AddressKeys

func (*PrivateKey) AsBytes

func (pkT *PrivateKey) AsBytes() []byte

func (*PrivateKey) AsKyberKeyPair added in v1.0.3

func (pkT *PrivateKey) AsKyberKeyPair() (*key.Pair, error)

func (*PrivateKey) AsStdKey

func (pkT *PrivateKey) AsStdKey() ed25519.PrivateKey

func (*PrivateKey) Clone added in v1.0.3

func (pkT *PrivateKey) Clone() *PrivateKey

func (*PrivateKey) Public

func (pkT *PrivateKey) Public() *PublicKey

func (*PrivateKey) Read added in v1.0.3

func (pkT *PrivateKey) Read(r io.Reader) error

func (*PrivateKey) Sign

func (pkT *PrivateKey) Sign(message []byte) []byte

func (*PrivateKey) String

func (pkT *PrivateKey) String() string

func (*PrivateKey) Write added in v1.0.3

func (pkT *PrivateKey) Write(w io.Writer) error

type PublicKey

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

func NewEmptyPublicKey

func NewEmptyPublicKey() *PublicKey

func PublicKeyFromBytes added in v1.0.3

func PublicKeyFromBytes(publicKeyBytes []byte) (*PublicKey, error)

func PublicKeyFromString added in v1.0.3

func PublicKeyFromString(s string) (publicKey *PublicKey, err error)

func (*PublicKey) AsBytes

func (pkT *PublicKey) AsBytes() []byte

func (*PublicKey) AsEd25519Address

func (pkT *PublicKey) AsEd25519Address() *iotago.Ed25519Address

func (*PublicKey) AsKey

func (pkT *PublicKey) AsKey() PublicKeyKey

func (*PublicKey) AsKyberPoint added in v1.0.3

func (pkT *PublicKey) AsKyberPoint() (kyber.Point, error)

func (*PublicKey) Clone added in v1.0.3

func (pkT *PublicKey) Clone() *PublicKey

func (*PublicKey) Equals

func (pkT *PublicKey) Equals(other *PublicKey) bool

func (*PublicKey) Read added in v1.0.3

func (pkT *PublicKey) Read(r io.Reader) error

func (*PublicKey) String

func (pkT *PublicKey) String() string

func (*PublicKey) Verify

func (pkT *PublicKey) Verify(message, sig []byte) bool

func (*PublicKey) Write added in v1.0.3

func (pkT *PublicKey) Write(w io.Writer) error

type PublicKeyKey

type PublicKeyKey [PublicKeySize]byte

type Seed

type Seed [SeedSize]byte

func NewSeed

func NewSeed() (ret Seed)

func SeedFromBytes added in v1.0.3

func SeedFromBytes(data []byte) (ret Seed)

func SubSeed added in v1.0.3

func SubSeed(walletSeed []byte, accountIndex uint32, useLegacyDerivation ...bool) Seed

SubSeed returns a Seed (ed25519 Seed) from a master seed (that has arbitrary length) note that the accountIndex is actually an uint31

type VariantKeyPair added in v1.0.3

type VariantKeyPair interface {
	// IsNil is a mandatory nil check. This includes the referenced keypair implementation pointer. `kp == nil` is not enough.
	IsNil() bool

	GetPublicKey() *PublicKey
	Address() *iotago.Ed25519Address
	AsAddressSigner() iotago.AddressSigner
	AddressKeysForEd25519Address(addr *iotago.Ed25519Address) iotago.AddressKeys
	SignBytes(data []byte) []byte
	Sign(addr iotago.Address, msg []byte) (signature iotago.Signature, err error)
}

VariantKeyPair originates from cryptolib.KeyPair

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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