Versions in this module Expand all Collapse all v0 v0.2.0 Aug 22, 2023 Changes in this version + const SlotNameIndexA + const SlotNameIndexB + const SlotNameValueA + const SlotNameValueB + var AuthSchemaHash = SchemaHash + var DIDMethodByte = map[DIDMethod]byte + var DIDMethodNetwork = map[DIDMethod]map[DIDNetworkFlag]byte + var ErrBlockchainNotSupportedForDID = errors.New("not supported blockchain") + var ErrDIDMethodNotSupported = errors.New("not supported did method") + var ErrDataOverflow = errors.New("data does not fits SNARK size") + var ErrIncorrectDID = errors.New("incorrect DID") + var ErrIncorrectIDPosition = errors.New("incorrect ID position") + var ErrIncorrectMerklizedPosition = errors.New("incorrect Merklized position") + var ErrInvalidSubjectPosition = errors.New("invalid subject position") + var ErrMethodUnknown = errors.New("unknown DID method") + var ErrNetworkNotSupportedForDID = errors.New("not supported network") + var ErrNoID = errors.New("ID is not set") + var ErrNoMerklizedRoot = errors.New("Merklized root is not set") + var ErrUnsupportedID = errors.New("unsupported ID") + var TypeDefault = [2]byte + func BuildDIDType(method DIDMethod, blockchain Blockchain, network NetworkID) ([2]byte, error) + func CalculateChecksum(typ [2]byte, genesis [genesisLn]byte) [2]byte + func CheckChecksum(id ID) bool + func CheckGenesisStateID(id, state *big.Int) (bool, error) + func DecomposeID(id ID) (typ [2]byte, genesis [genesisLn]byte, checksum [2]byte, err error) + func ElemBytesToInts(elements []ElemBytes) []*big.Int + func EthAddressFromID(id ID) ([20]byte, error) + func GenesisFromEthAddress(addr [20]byte) [genesisLn]byte + func IdenState(clr, rer, ror *big.Int) (*big.Int, error) + func NewDID(typ [2]byte, genesis [genesisLn]byte) (*w3c.DID, error) + func NewDIDFromIdenState(typ [2]byte, state *big.Int) (*w3c.DID, error) + func ParseDIDFromID(id ID) (*w3c.DID, error) + type Blockchain string + const Ethereum + const IoFinnet + const NoChain + const ReadOnly + const UnknownChain + func BlockchainFromID(id ID) (Blockchain, error) + func FindBlockchainForDIDMethodByValue(method DIDMethod, _v byte) (Blockchain, error) + type Claim struct + func NewClaim(sh SchemaHash, options ...Option) (*Claim, error) + func (c *Claim) Clone() *Claim + func (c *Claim) FromHex(hexStr string) error + func (c *Claim) GetExpirationDate() (time.Time, bool) + func (c *Claim) GetFlagUpdatable() bool + func (c *Claim) GetID() (ID, error) + func (c *Claim) GetIDPosition() (IDPosition, error) + func (c *Claim) GetMerklizedPosition() (MerklizedRootPosition, error) + func (c *Claim) GetMerklizedRoot() (*big.Int, error) + func (c *Claim) GetRevocationNonce() uint64 + func (c *Claim) GetSchemaHash() SchemaHash + func (c *Claim) GetVersion() uint32 + func (c *Claim) HIndex() (*big.Int, error) + func (c *Claim) HValue() (*big.Int, error) + func (c *Claim) HiHv() (*big.Int, *big.Int, error) + func (c *Claim) RawSlots() (index [4]ElemBytes, value [4]ElemBytes) + func (c *Claim) RawSlotsAsInts() []*big.Int + func (c *Claim) ResetExpirationDate() + func (c *Claim) ResetID() + func (c *Claim) SetExpirationDate(dt time.Time) + func (c *Claim) SetFlagUpdatable(val bool) + func (c *Claim) SetIndexData(slotA, slotB ElemBytes) error + func (c *Claim) SetIndexDataBytes(slotA, slotB []byte) error + func (c *Claim) SetIndexDataInts(slotA, slotB *big.Int) error + func (c *Claim) SetIndexID(id ID) + func (c *Claim) SetIndexMerklizedRoot(r *big.Int) error + func (c *Claim) SetRevocationNonce(nonce uint64) + func (c *Claim) SetSchemaHash(sh SchemaHash) + func (c *Claim) SetValueData(slotA, slotB ElemBytes) error + func (c *Claim) SetValueDataBytes(slotA, slotB []byte) error + func (c *Claim) SetValueDataInts(slotA, slotB *big.Int) error + func (c *Claim) SetValueID(id ID) + func (c *Claim) SetValueMerklizedRoot(r *big.Int) error + func (c *Claim) SetVersion(ver uint32) + func (c *Claim) UnmarshalBinary(data []byte) error + func (c *Claim) UnmarshalJSON(in []byte) error + func (c Claim) Hex() (string, error) + func (c Claim) MarshalBinary() ([]byte, error) + func (c Claim) MarshalJSON() ([]byte, error) + type DIDMethod string + const DIDMethodIden3 + const DIDMethodIoFinnetID + const DIDMethodOther + func FindDIDMethodByValue(b byte) (DIDMethod, error) + func MethodFromID(id ID) (DIDMethod, error) + type DIDNetworkFlag struct + Blockchain Blockchain + NetworkID NetworkID + type ElemBytes [32]byte + func NewElemBytesFromInt(i *big.Int) (ElemBytes, error) + func (el *ElemBytes) SetInt(value *big.Int) error + func (el ElemBytes) Hex() string + func (el ElemBytes) ToInt() *big.Int + type ErrSlotOverflow struct + Field SlotName + func (e ErrSlotOverflow) Error() string + type ID [idLength]byte + func IDFromBytes(b []byte) (ID, error) + func IDFromDID(did w3c.DID) (ID, error) + func IDFromInt(i *big.Int) (ID, error) + func IDFromString(s string) (ID, error) + func NewID(typ [2]byte, genesis [genesisLn]byte) ID + func NewIDFromIdenState(typ [2]byte, state *big.Int) (*ID, error) + func ProfileID(id ID, nonce *big.Int) (ID, error) + func (id *ID) BigInt() *big.Int + func (id *ID) Bytes() []byte + func (id *ID) Equal(id2 *ID) bool + func (id *ID) Equals(id2 *ID) bool + func (id *ID) String() string + func (id *ID) Type() [2]byte + func (id *ID) UnmarshalText(b []byte) error + func (id ID) MarshalText() ([]byte, error) + type IDPosition uint8 + const IDPositionIndex + const IDPositionNone + const IDPositionValue + type MerklizedRootPosition uint8 + const MerklizedRootPositionIndex + const MerklizedRootPositionNone + const MerklizedRootPositionValue + type NetworkID string + const IoBlockchain + const Main + const NoNetwork + const Test + const UnknownNetwork + func FindNetworkIDForDIDMethodByValue(method DIDMethod, _v byte) (NetworkID, error) + func NetworkIDFromID(id ID) (NetworkID, error) + type Option func(*Claim) error + func WithExpirationDate(dt time.Time) Option + func WithFlagMerklized(p MerklizedRootPosition) Option + func WithFlagUpdatable(val bool) Option + func WithID(id ID, pos IDPosition) Option + func WithIndexData(slotA, slotB ElemBytes) Option + func WithIndexDataBytes(slotA, slotB []byte) Option + func WithIndexDataInts(slotA, slotB *big.Int) Option + func WithIndexID(id ID) Option + func WithIndexMerklizedRoot(r *big.Int) Option + func WithMerklizedRoot(r *big.Int, pos MerklizedRootPosition) Option + func WithRevocationNonce(nonce uint64) Option + func WithValueData(slotA, slotB ElemBytes) Option + func WithValueDataBytes(slotA, slotB []byte) Option + func WithValueDataInts(slotA, slotB *big.Int) Option + func WithValueID(id ID) Option + func WithValueMerklizedRoot(r *big.Int) Option + func WithVersion(ver uint32) Option + type SchemaHash [schemaHashLn]byte + func NewSchemaHashFromHex(s string) (SchemaHash, error) + func NewSchemaHashFromInt(i *big.Int) SchemaHash + func (sh SchemaHash) BigInt() *big.Int + func (sh SchemaHash) MarshalText() ([]byte, error) + type SlotName string