types

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DIDPrefix       = "did:hpc:"
	IllegalDIDBytes = "/:"
)

DIDPrefix

Variables

This section is empty.

Functions

func CalProofNodeHash

func CalProofNodeHash(node *ProofNode) []byte

CalProofNodeHash calculate hash for given ProofNode

func CheckDIDHasIllegalBytes added in v1.2.0

func CheckDIDHasIllegalBytes(value []byte) bool

CheckDIDHasIllegalBytes return true if has illegal byte

func Validate

func Validate(key []byte, proof ProofPath) bool

Validate validates poof with given key

func ValidateMerkleProof added in v1.2.2

func ValidateMerkleProof(proof []*MerkleProofNode, targetHash []byte, rootHash []byte) bool

ValidateMerkleProof validate merkleProof using targetTxHash and blockTxRootHash

Types

type DIDAccount added in v1.2.0

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

DIDAccount represent did address

func NewDIDAccount added in v1.2.0

func NewDIDAccount() *DIDAccount

NewDIDAccount create a empty didAccount

func NewDIDAccountFromOrigin added in v1.2.0

func NewDIDAccountFromOrigin(data []byte) (*DIDAccount, error)

NewDIDAccountFromOrigin create didAccount from origin bytes

func (*DIDAccount) Hex added in v1.2.0

func (did *DIDAccount) Hex() string

Hex is the hex string representation of the underlying did address

func (*DIDAccount) MarshalJSON added in v1.2.0

func (did *DIDAccount) MarshalJSON() ([]byte, error)

MarshalJSON marshal the given DIDAccount to json

func (*DIDAccount) Str added in v1.2.0

func (did *DIDAccount) Str() string

Str is the string representation of the underlying didAccount

func (*DIDAccount) UnmarshalJSON added in v1.2.0

func (did *DIDAccount) UnmarshalJSON(data []byte) error

UnmarshalJSON parse DIDAccount from raw json data

type HPCAccount added in v1.2.0

type HPCAccount struct {
	common.Address
	DidAccount *DIDAccount
	IsDID      bool
}

HPCAccount wrap address and DIDAccount

func NewAccountFromAddress added in v1.2.0

func NewAccountFromAddress(address common.Address) *HPCAccount

NewAccountFromAddress create HPCAccount by address

func NewAccountFromDID added in v1.2.0

func NewAccountFromDID(didAccount *DIDAccount) *HPCAccount

NewAccountFromDID create HPCAccount by didAccount

func (*HPCAccount) Bytes added in v1.2.0

func (hpcAccount *HPCAccount) Bytes() []byte

Bytes return the address's bytes

func (*HPCAccount) GetChainID added in v1.2.0

func (hpcAccount *HPCAccount) GetChainID() []byte

GetChainID return the DIDAccount's chainID

func (*HPCAccount) Hex added in v1.2.0

func (hpcAccount *HPCAccount) Hex() string

Hex the hex string representation of the underlying address

func (*HPCAccount) Length added in v1.2.0

func (hpcAccount *HPCAccount) Length() int

Length return the length

func (*HPCAccount) MarshalJSON added in v1.2.0

func (hpcAccount *HPCAccount) MarshalJSON() ([]byte, error)

MarshalJSON marshal the given HPCAccount to json

func (*HPCAccount) UnmarshalJSON added in v1.2.0

func (hpcAccount *HPCAccount) UnmarshalJSON(data []byte) error

UnmarshalJSON parse HPCAccount from raw json data

type Inode

type Inode struct {
	Key   []byte
	Value []byte
	Hash  []byte
}

Inode struct

type Inodes

type Inodes []*Inode

Inodes struct

type MerkleProofNode added in v1.2.2

type MerkleProofNode struct {
	Hash  []byte `json:"hash,omitempty"`
	Index int    `json:"index,omitempty"`
}

MerkleProofNode struct

type MerkleProofPath added in v1.2.2

type MerkleProofPath []*MerkleProofNode

MerkleProofPath struct

type ProofNode

type ProofNode struct {
	IsData bool
	Key    []byte
	Hash   []byte
	Inodes Inodes
	Index  int
}

ProofNode struct

type ProofPath

type ProofPath []*ProofNode

ProofPath struct

Jump to

Keyboard shortcuts

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