sdk

package module
v0.0.0-...-4583b55 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

README

zhenid-kernel-sdk

Documentation

Index

Constants

View Source
const (
	CardTypeID     = 1
	CardTypePolice = 2

	CardNameID     = "身份证"
	CardNamePolice = "警官证"
)

Variables

View Source
var (
	ErrED25519Verification = errors.New("ed25519: verification error")
)

Functions

This section is empty.

Types

type Address

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

func AddressFromString

func AddressFromString(s string) (*Address, error)

TODO unimplement

func NewAddress

func NewAddress() (*Address, error)

func (Address) Decrypt

func (a Address) Decrypt(c, s1, s2 []byte) (m []byte, err error)

func (Address) Encrypt

func (a Address) Encrypt(m, s1, s2 []byte) (ct []byte, err error)

func (Address) EncryptWithSeed

func (a Address) EncryptWithSeed(seed io.Reader, m, s1, s2 []byte) (ct []byte, err error)

func (Address) GhostPrivateKey

func (a Address) GhostPrivateKey(mask *crypto.Key, outputIndex uint64) *crypto.Key

func (Address) GhostPublicKey

func (a Address) GhostPublicKey(r *crypto.Key, outputIndex uint64) *crypto.Key

func (Address) MarshalJSON

func (a Address) MarshalJSON() ([]byte, error)

TODO unimplement

func (Address) PrivateEncryptKey

func (a Address) PrivateEncryptKey() *ecies.PrivateKey

func (Address) PrivateSpendKey

func (a Address) PrivateSpendKey() *crypto.Key

func (Address) PrivateViewKey

func (a Address) PrivateViewKey() *crypto.Key

func (Address) PublicEncryptKey

func (a Address) PublicEncryptKey() *ecies.PublicKey

func (Address) PublicSpendKey

func (a Address) PublicSpendKey() *crypto.Key

func (Address) PublicViewKey

func (a Address) PublicViewKey() *crypto.Key

func (*Address) UnmarshalJSON

func (a *Address) UnmarshalJSON(b []byte) error

TODO unimplement

func (Address) VerifyOutputs

func (a Address) VerifyOutputs(outputs []*Output) []int

type Card

type Card struct {
	ID   int    `json:"card_id"`
	Name string `json:"name"`
}

type Input

type Input struct {
	Hash  crypto.Hash `json:"hash,omitempty"`
	Index int         `json:"index,omitempty"`
}

type Key

type Key crypto.Key

func KeyFromString

func KeyFromString(s string) (Key, error)

func NewKey

func NewKey() (Key, error)

func NewKeyWithSeed

func NewKeyWithSeed(seed []byte) (Key, error)

func (Key) Alg

func (k Key) Alg() string

func (Key) Convert

func (k Key) Convert() *crypto.Key

func (Key) MarshalJSON

func (k Key) MarshalJSON() ([]byte, error)

func (Key) PublicKey

func (k Key) PublicKey() Key

func (Key) Sign

func (k Key) Sign(signingString string, key interface{}) (string, error)

func (*Key) UnmarshalJSON

func (k *Key) UnmarshalJSON(b []byte) error

func (Key) Verify

func (k Key) Verify(signingString, signature string, key interface{}) error

type Metadata

type Metadata struct {
	Version    int   `json:"v"`
	CardType   int   `json:"t,omitempty"`
	StartDate  int64 `json:"s,omitempty"`
	ExpireDate int64 `json:"exp,omitempty"`
}

type Organization

type Organization struct {
	Address string `json:"address"`
	Name    string `json:"name"`
}

type Output

type Output struct {
	Type   uint8           `json:"type"`
	Amount decimal.Decimal `json:"amount"`
	Keys   []crypto.Key    `json:"keys,omitempty"`

	// OutputTypeScript fields
	Script common.Script `json:"script,omitempty"`
	Mask   crypto.Key    `json:"mask,omitempty"`
}

func (Output) Verify

func (o Output) Verify(msg, sig []byte) bool

TODO unimplement

type PrivateKey

type PrivateKey ecies.PrivateKey

func ECIESPrivateKeyFromBytes

func ECIESPrivateKeyFromBytes(s []byte) (*PrivateKey, error)

func NewECIESPrivateKey

func NewECIESPrivateKey() (*PrivateKey, error)

func (*PrivateKey) Decrypt

func (pri *PrivateKey) Decrypt(c, s1, s2 []byte) (m []byte, err error)

func (*PrivateKey) ECIESPrivateKey

func (pri *PrivateKey) ECIESPrivateKey() *ecies.PrivateKey

func (*PrivateKey) Marshal

func (pri *PrivateKey) Marshal() ([]byte, error)

func (*PrivateKey) Public

func (pri *PrivateKey) Public() *PublicKey

type PublicKey

type PublicKey ecies.PublicKey

func ECIESPublicKeyFromBytes

func ECIESPublicKeyFromBytes(s []byte) (*PublicKey, error)

func (*PublicKey) Encrypt

func (pub *PublicKey) Encrypt(m, s1, s2 []byte) (ct []byte, err error)

func (*PublicKey) EncryptWithSeed

func (pub *PublicKey) EncryptWithSeed(seed io.Reader, m, s1, s2 []byte) (ct []byte, err error)

func (*PublicKey) Marshal

func (pub *PublicKey) Marshal() ([]byte, error)

type Transaction

type Transaction struct {
	Version uint8       `json:"version"`
	Asset   crypto.Hash `json:"asset"`
	Inputs  []*Input    `json:"inputs"`
	Outputs []*Output   `json:"outputs"`
	Extra   []byte      `json:"extra,omitempty"`
}

func (Transaction) MarshalRaw

func (t Transaction) MarshalRaw() ([]byte, error)

TODO unimplement MarshalRaw marshal raw message for signing transaction

Jump to

Keyboard shortcuts

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