Skip to content

iden3/go-circuits

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.