Categorygithub.com/rarimo/go-circuits
modulepackage
1.0.1
Repository: https://github.com/rarimo/go-circuits.git
Documentation: pkg.go.dev

# README

go-circuits

Go Reference Go Report Card

General description:

The library goal is to create a wrapper for private and public inputs for identity circuits

Repository of circuits implementation: https://github.com/iden3/circuits

Set of functionality for circuits inputs preparation, and public signals schema retrieving

How to use :

  • All circuits implement InputsMarshaller and PubSignalsUnmarshal Interfaces

    type InputsMarshaller interface {
        InputsMarshal() ([]byte, error)
    }
    
    
    type PubSignalsUnmarshaller interface {
        PubSignalsUnmarshal(data []byte) error
    }
    
  • Example of usage:

At the moment you have to fill all needed attributes for a specific Inputs, take a look in test for each specific Input

  inputs := AuthInputs{
        ID: identifier,
        AuthClaim: Claim{
            Claim:       claim,
            Proof:       claimEntryMTP,
            TreeState:   treeState,
            NonRevProof: &ClaimNonRevStatus{treeState, claimNonRevMTP},
        },
        Signature: signature,
        Challenge: challenge,
    }

    circuitInputJSON, err := inputs.InputsMarshal() // marshal JSON inputs for specific circuit in proper format
  • It’s easy to extend Circuits mapping through registering custom Circuit Wrapper implementation

    RegisterCircuit(CustomCircuitID, Data{
        Input:  CustomInputs{},
        Output: &CustomPubSignals{},
    })
    

    Querying :

    The library defines the Query structure for atomic circuits and contains the mapping between query operation and its number. This library is not responsible for resolving SlotIndex for the claim field.

    // Query represents basic request to claim slot verification
    type Query struct {
        SlotIndex int
        Value     *big.Int
        Operator  int
    }
    
    
    // QueryOperators represents operators for atomic circuits
    var QueryOperators = map[string]int{
        "$noop": NOOP,
        "$eq":   EQ,
        "$lt":   LT,
        "$gt":   GT,
        "$in":   IN,
        "$nin":  NIN,
        "$ne":   NE,
    }
    

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

© 2023 0kims Association

This project is licensed under either of

at your option.

# Packages

No description provided by the author

# Functions

CircomSiblingsFromSiblings returns the full siblings compatible with circom.
FactoryComparer depends on input data will return right comparer.
GetCircuit return circuit Data.
No description provided by the author
No description provided by the author
NewScalar create `Scalar` comparer.
NewVector create Vector.
PoseidonHashValue returns the solidity and circom implementation of poseidon hash.
PrepareCircuitArrayValues padding values to size.
PrepareSiblings prepare siblings for zk zk.
No description provided by the author
RegisterCircuit is factory for circuit init.
UnmarshalCircuitOutput unmarshal bytes to specific circuit Output type associated with id.

# Constants

AtomicQueryMTPCircuitID is a type for credentialAtomicQueryMTP.circom.
AtomicQueryMTPV2CircuitID is a type for credentialAtomicQueryMTPV2.circom.
AtomicQueryMTPV2OnChainCircuitID is a type for credentialAtomicQueryMTPV2OnChain.circom.
AtomicQuerySigCircuitID is a type for credentialAttrQuerySig.circom.
AtomicQuerySigV2CircuitID is a type for credentialAttrQuerySigV2.circom.
AtomicQuerySigV2OnChainCircuitID is a type for credentialAttrQuerySigV2OnChain.circom.
AtomicQueryV3CircuitID is a type for credentialAtomicQueryV3.circom.
AtomicQueryV3OnChainCircuitID is a type for credentialAtomicQueryV3OnChain.circom.
AuthCircuitID is a type that must be used for auth.circom.
AuthCircuitID is a type that must be used for authV2.circom.
BatchSize defined by poseidon hash implementation in Solidity.
List of available operators.
No description provided by the author
List of available operators.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
List of available operators.
List of available operators.
No description provided by the author
List of available operators.
JsonLDAtomicQueryMTPCircuitID is a type for credentialJsonLDAtomicQueryMTP.circom.
LinkedMultiQuery10CircuitID is a type for linkedMultiQuery10.circom.
No description provided by the author
List of available operators.
List of available operators.
List of available operators.
List of available operators.
No operation, skip query verification in circuit.
List of available operators.
List of available operators.
StateTransitionCircuitID is a type that must be used for stateTransition.circom.
SybilMTPCircuitID is a type for sybilMTP.circom.
SybilSigCircuitID is a type for sybilSig.circom.

# Variables

ErrorCircuitIDNotFound returns if CircuitID is not registered.
QueryOperators represents operators for atomic circuits.

# Structs

AtomicQueryMTPInputs ZK private inputs for credentialAtomicQueryMTP.circom Deprecated: use AtomicQueryMTPV2Inputs instead.
AtomicQueryMTPPubSignals public signals Deprecated: use AtomicQueryMTPV2PubSignals instead.
AtomicQueryMTPV2Inputs ZK private inputs for credentialAtomicQueryMTPV2.circom.
AtomicQueryMTPV2OnChainInputs ZK private inputs for credentialAtomicQueryMTPV2OnChain.circom.
AtomicQueryMTPPubSignals public signals.
AtomicQueryMTPV2OnChainVotingInputs ZK private inputs for credentialAtomicQueryMTPV2OnChainVoting.circom.
AtomicQueryMTPPubSignals public signals.
AtomicQueryMTPPubSignals public signals.
AtomicQuerySigInputs ZK private inputs for credentialAtomicQuerySig.circom Deprecated: use AtomicQuerySigV2Inputs instead.
AtomicQuerySigPubSignals public inputs Deprecated: use AtomicQuerySigV2PubSignals instead.
AtomicQuerySigInputs ZK private inputs for credentialAtomicQuerySig.circom.
AtomicQuerySigV2OnChainInputs ZK private inputs for credentialAtomicQuerySig.circom.
AtomicQuerySigV2OnChainPubSignals public inputs.
AtomicQuerySigV2PubSignals public inputs.
AtomicQueryV3Inputs ZK private inputs for credentialAtomicQuerySig.circom.
AtomicQueryV3OnChainInputs ZK private inputs for credentialAtomicQueryV3OnChain.circom.
AtomicQueryV3OnChainPubSignals public inputs.
AtomicQueryV3PubSignals public inputs.
AuthInputs type represent auth.circom private inputs Deprecated: use AuthV2Inputs instead.
AuthPubSignals auth.circom public signals Deprecated: use AuthV2PubSignals instead.
AuthV2Inputs type represent authV2.circom inputs.
AuthV2PubSignals auth.circom public signals.
BaseConfig base circuit's config, provides default configuration for default circuits.
BJJSignatureProof is a proof of issuer AuthClaim signature over a claim.
No description provided by the author
No description provided by the author
No description provided by the author
Data circuit type.
GISTProof global identity state tree proof represents the state of the global identities tree published on the blockchain.
LinkedMultiQueryInputs type represent linkedMultiQuery10.circom inputs.
LinkedMultiQueryPubSignals linkedMultiQuery10.circom public signals.
No description provided by the author
No description provided by the author
Query represents basic request to claim field with MTP and without.
Scalar uses for compare two scalar value.
StateTransitionInputs ZK private inputs for stateTransition.circom.
StateTransitionPubSignals stateTransition.circom public inputs.
Deprecated: trusted setup is not done for that circuits.
Deprecated: trusted setup is not done for that circuits.
Deprecated: trusted setup is not done for that circuits.
Deprecated: trusted setup is not done for that circuits.
TreeState represents the identity state.
ValueProof represents a Merkle Proof for a value stored as MT.
Vector uses for find/not find x scalar type in y vector type.

# Interfaces

Comparer value.
InputsMarshaller interface implemented by types that can marshal circuit `input` structures.
KeyLoader interface, if key should be fetched from file system, CDN, IPFS etc, this interface may be implemented for key loading from a specific place.
PubSignals interface implemented by types that can be registered in circuit registry.
PubSignalsMapper interface implemented by types that can unmarshal circuit `output` to map.
PubSignalsUnmarshaller interface implemented by types that can unmarshal circuit `output` structures.

# Type aliases

CircuitID is alias for circuit identifier.
No description provided by the author