### Go Example: Registering Custom Circuits Source: https://github.com/iden3/go-circuits/blob/main/README.md Shows how to extend the library's circuit mapping by registering a custom circuit wrapper. This allows for the integration of user-defined circuit implementations. ```go RegisterCircuit(CustomCircuitID, Data{ Input: CustomInputs{}, Output: &CustomPubSignals{}, }) ``` -------------------------------- ### Go Example: Preparing Circuit Inputs Source: https://github.com/iden3/go-circuits/blob/main/README.md Demonstrates how to prepare and marshal inputs for a specific circuit using the `InputsMarshal` method. This involves creating an input struct and converting it to JSON bytes. ```go 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 ``` -------------------------------- ### Order Public Signals Source: https://github.com/iden3/go-circuits/blob/main/cmd/orderSignals/README.md Builds and runs the orderSignals tool to output public signals in a specified order. Requires a sym file and a list of signals. ```shell go build && ./orderSignals -sym ~/src/circuits/build/credentialJsonLDAtomicQueryMTP/circuit.sym -signals challenge,userID,userState,claimSchema,issuerID,claimPathKey,operator,value,timestamp ``` -------------------------------- ### APIDOC: go-circuits Query Structure and Operators Source: https://github.com/iden3/go-circuits/blob/main/README.md API documentation for the `Query` structure and associated `QueryOperators` map used for atomic circuit operations and claim slot verification. ```APIDOC Query: Fields: SlotIndex (int): The index of the slot to query within a claim. Value (*big.Int): The value to compare against in the query. Operator (int): An integer representing the comparison operator (e.g., equality, inequality). QueryOperators: Description: A map associating string representations of operators with their integer equivalents. Mappings: "$noop": NOOP (No operation) "$eq": EQ (Equal to) "$lt": LT (Less than) "$gt": GT (Greater than) "$in": IN (In set) "$nin": NIN (Not in set) "$ne": NE (Not equal to) Usage: Used to specify the type of comparison for claim slot verification. ``` -------------------------------- ### APIDOC: go-circuits Library Interfaces Source: https://github.com/iden3/go-circuits/blob/main/README.md API documentation for the core interfaces in the go-circuits library. These interfaces define the contract for handling circuit inputs and public signals. ```APIDOC InputsMarshaller: Methods: InputsMarshal() ([]byte, error): Marshals the input data into a byte slice, typically JSON, suitable for circuit processing. Returns an error if marshalling fails. PubSignalsUnmarshaller: Methods: PubSignalsUnmarshal(data []byte) error: Unmarshals public signals from a byte slice into the implementing struct. Returns an error if unmarshalling fails. ``` -------------------------------- ### APIDOC: go-circuits Circuit Registration Source: https://github.com/iden3/go-circuits/blob/main/README.md API documentation for registering custom circuit implementations within the go-circuits library. This allows for extending the library's functionality with custom circuit logic. ```APIDOC RegisterCircuit(circuitID string, data Data): Description: Registers a custom circuit wrapper with a unique identifier. Parameters: circuitID (string): A unique identifier for the custom circuit. data (Data): A struct containing the Input and Output types for the circuit. Input: The type implementing InputsMarshaller for circuit inputs. Output: The type implementing PubSignalsUnmarshaller for circuit outputs. Usage: Allows the library to recognize and utilize custom circuit implementations. ``` -------------------------------- ### Go Query Structure and Operators for Claim Verification Source: https://github.com/iden3/go-circuits/blob/main/README.md Defines the `Query` structure used for atomic circuits and the `QueryOperators` map, which associates string representations with integer codes for various query operations like equality, less than, and greater than. ```go // 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, } ``` -------------------------------- ### Go Interfaces for Circuit Inputs and Public Signals Source: https://github.com/iden3/go-circuits/blob/main/README.md Defines the `InputsMarshaller` and `PubSignalsUnmarshaller` interfaces for handling circuit inputs and public signals. These interfaces are crucial for preparing data for identity circuits. ```go type InputsMarshaller interface { InputsMarshal() ([]byte, error) } type PubSignalsUnmarshaller interface { PubSignalsUnmarshal(data []byte) error } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.