Documentation
¶
Index ¶
- Constants
- func CalProofNodeHash(node *ProofNode) []byte
- func CheckDIDHasIllegalBytes(value []byte) bool
- func Validate(key []byte, proof ProofPath) bool
- func ValidateMerkleProof(proof []*MerkleProofNode, targetHash []byte, rootHash []byte) bool
- type DIDAccount
- type HPCAccount
- func (hpcAccount *HPCAccount) Bytes() []byte
- func (hpcAccount *HPCAccount) GetChainID() []byte
- func (hpcAccount *HPCAccount) Hex() string
- func (hpcAccount *HPCAccount) Length() int
- func (hpcAccount *HPCAccount) MarshalJSON() ([]byte, error)
- func (hpcAccount *HPCAccount) UnmarshalJSON(data []byte) error
- type Inode
- type Inodes
- type MerkleProofNode
- type MerkleProofPath
- type ProofNode
- type ProofPath
Constants ¶
const ( DIDPrefix = "did:hpc:" IllegalDIDBytes = "/:" )
DIDPrefix
Variables ¶
This section is empty.
Functions ¶
func CalProofNodeHash ¶
CalProofNodeHash calculate hash for given ProofNode
func CheckDIDHasIllegalBytes ¶ added in v1.2.0
CheckDIDHasIllegalBytes return true if has illegal byte
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 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