identity

package
v0.0.0-...-8cd5e98 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Define sizes for each component of RawAddress
	VerSize         = 4  // Size in bytes for the version field (uint32)
	TimestampSize   = 8  // Size in bytes for the timestamp field (int64)
	ChainCodeLength = 32 // Example length of the chain code in bytes
	PubKeyLength    = 64 // Example length of the public key in bytes, adjust based on your key format
	PrivKeyLength   = 64 // Example length of the private key in bytes, adjust based on your key format
	SeedLength      = 32 // Length of the seed in bytes

	// ExpectedTotalLength Calculate the expected total length of RawAddress when serialized
	ExpectedTotalLength = VerSize + TimestampSize + ChainCodeLength + PubKeyLength + PrivKeyLength + SeedLength
)

Variables

View Source
var BytePrefix []byte = []byte("0x100010001000")
View Source
var WitnessPrefix []byte = []byte("0x1101")
View Source
var ZkpPrefix []byte = []byte("0xab1d")

Functions

func HashKeyAddress

func HashKeyAddress(r *RawAddress) []byte

func NewSeed

func NewSeed(bit int) []byte

Types

type Account

type Account struct {
	ID   string
	Addr Address
	// contains filtered or unexported fields
}

type Address

type Address struct {
	cryptography.Decapsulatable
	// contains filtered or unexported fields
}

func NewAddress

func NewAddress(cfg *utils.NetConfig, pubKey []byte, privKey []byte) *Address

func (Address) Bytes

func (addr Address) Bytes() []byte

func (Address) FromBytes

func (addr Address) FromBytes(data []byte) (interface{}, error)

func (Address) Hex

func (addr Address) Hex() string

func (Address) Raw

func (addr Address) Raw() (interface{}, error)

func (Address) String

func (addr Address) String() string

func (Address) Unmarshal

func (addr Address) Unmarshal(key []byte, data []byte, dst *RawAddress)

type RawAddress

type RawAddress struct {
	cryptography.Encapsulatable
	// contains filtered or unexported fields
}

func (*RawAddress) Init

func (r *RawAddress) Init(chainCode []byte, ver uint32, pubKey []byte, privKey []byte, timestamp int64)

func (*RawAddress) Marshal

func (r *RawAddress) Marshal(key []byte, dst []byte)

func (*RawAddress) ToBytes

func (r *RawAddress) ToBytes() []byte

Jump to

Keyboard shortcuts

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