# README
go-iden3-core
Low level API to create and manipulate iden3 claims and identifiers.
Protocol specification
The protocol specification is available in the protocol
Tutorials
Tutorials are available in the tutorials
Testing
go test ./...
Contributing
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as below, without any additional terms or conditions.
License
go-iden3-core is part of the iden3 project copyright 2018 0kims Association
This project is licensed under either of
at your option.
# Packages
Package w3c is a set of tools to work with Decentralized Identifiers (DIDs) as described in the DID spec https://w3c.github.io/did-core/ Got from https://github.com/build-trust/did.
# Functions
No description provided by the author
BuildDIDType builds bytes type from chain and network.
CalculateChecksum returns the checksum for a given type and genesis_root, where checksum:
hash( [type | root_genesis ] ).
ChainIDfromDID returns chain name from w3c.DID.
ChainIDfromID(id ID) returns chain name from ID.
CheckChecksum returns a bool indicating if the ID.Checksum is consistent with the rest of the ID data.
CheckGenesisStateID check if the state is genesis for the id.
DecomposeID returns type, genesis and checksum from an ID.
ElemBytesToInts converts slice of ElemBytes to slice of *big.Int.
No description provided by the author
FindBlockchainForDIDMethodByValue finds blockchain type by byte value.
FindDIDMethodByValue finds did method by its byte value.
FindNetworkIDForDIDMethodByValue finds network by byte value.
No description provided by the author
GetBlockchain returns blockchain by name.
GetChainID returns chainID for blockchain and network.
GetDIDMethod returns DID method by name.
GetNetwork returns network by name.
IdenState calculates the Identity State from the Claims Tree Root, Revocation Tree Root and Roots Tree Root.
IDFromBytes returns the ID from a given byte array.
No description provided by the author
IDFromInt returns the ID from a given big.Int.
IDFromString returns the ID from a given string.
No description provided by the author
NetworkByChainID returns blockchain and networkID for registered chain ID.
No description provided by the author
NewClaim creates new Claim with specified SchemaHash and any number of options.
NewClaimFromBigInts creates new Claim from bigInts.
NewDID creates a new *w3c.DID from the type and the genesis.
NewDIDFromIdenState calculates the genesis ID from an Identity State and returns it as a DID.
NewElemBytesFromInt creates new ElemBytes from *big.Int.
NewID creates a new ID from a type and genesis.
NewIDFromIdenState calculates the genesis ID from an Identity State.
NewSchemaHashFromHex creates new SchemaHash from hex string.
NewSchemaHashFromInt creates new SchemaHash from big.Int.
ParseDIDFromID returns DID from ID.
ProfileID calculates the Profile ID from the Identity and profile nonce.
RegisterBlockchain registers new blockchain.
RegisterChainID registers chainID for blockchain and network.
RegisterDIDMethod registers new DID method with byte flag.
RegisterDIDMethodNetwork registers new DID method network.
RegisterNetwork registers new network.
WithChainID registers new chain ID method with byte flag.
WithDIDMethodByte registers new DID method with byte flag.
WithExpirationDate sets claim's expiration date to `dt`.
WithFlagMerklized sets claim's flag `merklize`.
WithFlagUpdatable sets claim's flag `updatable`.
WithID sets ID to claim's index or value depending on `pos`.
WithIndexData sets data to index slots A & B.
WithIndexDataBytes sets data to index slots A & B.
WithIndexDataInts sets data to index slots A & B.
WithIndexID sets ID to claim's index.
WithIndexMerklizedRoot sets root to index i_2 Returns ErrSlotOverflow if root value are too big.
WithMerklizedRoot sets root to value v_2 or index i_2 Returns ErrSlotOverflow if root value are too big.
WithRevocationNonce sets claim's revocation nonce.
WithValueData sets data to value slots A & B.
WithValueDataBytes sets data to value slots A & B.
WithValueDataInts sets data to value slots A & B.
WithValueID sets ID to claim's value.
WithValueMerklizedRoot sets root to value v_2 Returns ErrSlotOverflow if root value are too big.
WithVersion sets claim's version.
# Constants
Amoy is Polygon amoy test network.
Cardona is Polygon zkEVM Cardona test network.
DIDMethodIden3.
DIDMethodOther any other method not listed before.
DIDMethodPolygonID.
Ethereum is ethereum blockchain network.
Goerli is Ethereum goerli test network.
IDPositionIndex means ID value is in index slots.
IDPositionNone means ID value not located in claim.
IDPositionValue means ID value is in value slots.
Linea is Linea blockchain network.
Main is main network.
MerklizedRootPositionIndex means root data value is in index slots.
MerklizedRootPositionNone means root data value not located in claim.
MerklizedRootPositionValue means root data value is in value slots.
Mumbai is Polygon mumbai test network.
NoChain can be used for identity to build readonly flag.
NoNetwork should be used for readonly identity to build readonly flag.
Polygon is polygon blockchain network.
Privado is Privado blockchain network.
ReadOnly should be used for readonly identity to build readonly flag.
Sepolia is Ethereum Sepolia test network.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Test is test network.
UnknownChain is used when it's not possible to retrieve blockchain type from identifier.
UnknownNetwork is used when it's not possible to retrieve network from identifier.
Zkevm is zkEVM network in Polygon and potentially other blockchains.
# Variables
AuthSchemaHash predefined value of auth schema, used for auth claim during identity creation.
DIDMethodByte did method flag representation.
DIDMethodNetwork is map for did methods and their blockchain networks.
ErrBlockchainNotSupportedForDID unsupported network for did.
No description provided by the author
ErrDataOverflow means that given *big.Int value does not fit in Field Q e.g.
ErrDIDMethodNotSupported unsupported did method.
ErrIncorrectDID return if DID method is known, but format of DID is incorrect.
ErrIncorrectIDPosition means that passed position is not one of predefined: IDPositionIndex or IDPositionValue.
ErrIncorrectMerklizedPosition means that passed position is not one of predefined: MerklizedRootPositionIndex or MerklizedRootPositionValue.
ErrInvalidSubjectPosition returns when subject position flags sets in invalid value.
ErrMethodUnknown return if DID method is unknown.
ErrNetworkNotSupportedForDID unsupported network for did.
ErrNoID returns when ID not found in the Claim.
ErrNoMerklizedRoot returns when Merklized Root is not found in the Claim.
ErrUnsupportedID ID with unsupported type.
TypeDefault specifies the regular identity - first 2 bytes: `00000000 00000000`.
# Structs
No description provided by the author
DIDMethodNetworkParams is a structure to represent DID method network options.
DIDNetworkFlag is a structure to represent DID blockchain and network id.
ErrSlotOverflow means some ElemBytes overflows Q Field.
# Type aliases
Blockchain id of the network "eth", "polygon", etc.
ChainID is alias for int32 that represents ChainID.
DIDMethod represents did methods.
ElemBytes length is 32 bytes.
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.
No description provided by the author
No description provided by the author
NetworkID is method specific network identifier.
Option provides the ability to set different Claim's fields on construction.
RegistrationOptions is a type for DID method network options.
SchemaHash is a 16-bytes hash of file's content, that describes claim structure.
No description provided by the author