Version: v0.0.8 Latest Latest

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

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




This section is empty.


View Source
var (

	// TypeBJP0 specifies the BJ-P0
	// - first 2 bytes: `00000000 00000000`
	// - curve of k_op: babyjubjub
	// - hash function: `Poseidon` with 4+4 elements
	TypeBJP0 = [2]byte{0x00, 0x00}


func CalculateChecksum

func CalculateChecksum(typ [2]byte, genesis [27]byte) [2]byte

CalculateChecksum, returns the checksum for a given type and genesis_root, where checksum: hash( [type | root_genesis ] )

func CheckChecksum

func CheckChecksum(id ID) bool

CheckChecksum returns a bool indicating if the ID.Checksum is consistent with the rest of the ID data

func DecomposeID

func DecomposeID(id ID) ([2]byte, [27]byte, [2]byte, error)

DecomposeID returns type, genesis and checksum from an ID

func IdenState

func IdenState(clr *merkletree.Hash, rer *merkletree.Hash, ror *merkletree.Hash) *merkletree.Hash

IdenState calculates the Identity State from the Claims Tree Root, Revocation Tree Root and Roots Tree Root.


type ID

type ID [31]byte

ID is a byte array with [ type | root_genesis | checksum ] [2 bytes | 27 bytes | 2 bytes ] where the root_genesis are the first 28 bytes from the hash root_genesis

func IDFromBytes

func IDFromBytes(b []byte) (ID, error)

IDFromBytes returns the ID from a given byte array

func IDFromString

func IDFromString(s string) (ID, error)

IDFromString returns the ID from a given string

func IdGenesisFromIdenState

func IdGenesisFromIdenState(hash *merkletree.Hash) *ID

IdGenesisFromIdenState calculates the genesis Id from an Identity State.

func NewID

func NewID(typ [2]byte, genesis [27]byte) ID

NewID creates a new ID from a type and genesis

func (*ID) BigInt added in v0.0.8

func (id *ID) BigInt() *big.Int

func (*ID) Bytes

func (id *ID) Bytes() []byte

Bytes returns the bytes from the ID

func (*ID) Equal

func (id1 *ID) Equal(id2 *ID) bool

func (*ID) Equals

func (id1 *ID) Equals(id2 *ID) bool

func (ID) MarshalText

func (id ID) MarshalText() ([]byte, error)

func (*ID) String

func (id *ID) String() string

String returns a base58 from the ID

func (*ID) UnmarshalText

func (id *ID) UnmarshalText(b []byte) error

Source Files


Path Synopsis

Jump to

Keyboard shortcuts

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