Documentation
¶
Overview ¶
Package anoncreds is corresponding Go package for libindy's anoncreds namespace. We suggest that you read indy SDK documentation for more information. Unfortunately the documentation during the writing of this package was minimal to nothing. We suggest you do the same as we did, read the rust code if more detailed information is needed.
Index ¶
- func IssuerCreateAndStoreCredentialDef(wallet int, did, schema, tag, sigType, config string) ctx.Channel
- func IssuerCreateCredential(wallet int, credOffer, credReq, credValues, revRegID string, blobHandle int) ctx.Channel
- func IssuerCreateCredentialOffer(wallet int, credDefID string) ctx.Channel
- func IssuerCreateSchema(did, name, version, attrNames string) ctx.Channel
- func ProverCloseCredentialsSearchForProofReq(searchHandle int) ctx.Channel
- func ProverCreateCredentialReq(wallet int, prover, credOffer, credDef, master string) ctx.Channel
- func ProverCreateMasterSecret(wallet int, id string) ctx.Channel
- func ProverCreateProof(wallet int, proofReq, reqCred, masterSec, schemas, credDef, revStates string) ctx.Channel
- func ProverFetchCredentialsForProofReq(searchHandle int, itemRef string, count int) ctx.Channel
- func ProverSearchCredentialsForProofReq(wallet int, proofReqJSON, extraQueryJSON string) ctx.Channel
- func ProverStoreCredential(wallet int, credID, credReqMeta, cred, credDef, revRegDef string) ctx.Channel
- func VerifierVerifyProof(proofReqJSON, proofJSON, schemasJSON, credDefsJSON, revRegDefsJSON, ... string) ctx.Channel
- type AttrInfo
- type CredDefAttr
- type CredDefCfg
- type CredentialInfo
- type Credentials
- type Filter
- type IdentifiersObj
- type NonRevocInterval
- type PredicateInfo
- type Proof
- type ProofRequest
- type RequestedAttrObject
- type RequestedCredentials
- type RequestedPredObject
- type RequestedProof
- type RevealedAttr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IssuerCreateAndStoreCredentialDef ¶
func IssuerCreateAndStoreCredentialDef(wallet int, did, schema, tag, sigType, config string) ctx.Channel
IssuerCreateAndStoreCredentialDef creates and stores a credential definition entity that encapsulates credentials issuer DID, credential schema, secrets used for signing credentials and secrets used for credentials revocation.
issuer_did: a DID of the issuer signing cred_def transaction to the Ledger
Credential definition entity contains private and public parts. NOTE! Private part will be stored in the wallet. Public part will be returned as JSON intended to be shared with all anoncreds workflow actors usually by publishing CRED_DEF transaction to Indy distributed ledger.
It is IMPORTANT for current version GET Schema from Ledger with correct seq_no to save compatibility with Ledger.
func IssuerCreateCredential ¶
func IssuerCreateCredential(wallet int, credOffer, credReq, credValues, revRegID string, blobHandle int) ctx.Channel
IssuerCreateCredential creates credential at issuer side. Two last arguments are optional. blobHandle should be -1 if not given. Returns: cred_json: Credential json containing signed credential values. cred_revoc_id: local id, which can be used for revocation of this credential. revoc_reg_delta_json: revocation registry delta.
func IssuerCreateCredentialOffer ¶
IssuerCreateCredentialOffer creates on credential offer for part of indy specific issuing protocol. It's called before an issuer send its result as on offer credential.
func IssuerCreateSchema ¶
IssuerCreateSchema creates credential schema entity that describes credential attributes list and allows credentials interoperability. Schema is public and intended to be shared with all anoncreds workflow actors usually by publishing SCHEMA transaction to Indy distributed ledger.
It is IMPORTANT for current version POST Schema in Ledger and after that GET it from Ledger with correct seq_no to save compatibility with Ledger. After that can call indy_issuer_create_and_store_credential_def to build corresponding Credential Definition.
func ProverCloseCredentialsSearchForProofReq ¶
ProverCloseCredentialsSearchForProofReq closes the search identified by search handle.
func ProverCreateCredentialReq ¶
ProverCreateCredentialReq creates a credential request for the given credential offer.
The method creates a blinded master secret for a master secret identified by a provided name. The master secret identified by the name must be already stored in the secure wallet (see prover_create_master_secret) The blinded master secret is a part of the credential request.
func ProverCreateMasterSecret ¶
ProverCreateMasterSecret creates a master secret with a given id and stores it in the wallet. The id must be unique.
func ProverCreateProof ¶
func ProverCreateProof(wallet int, proofReq, reqCred, masterSec, schemas, credDef, revStates string) ctx.Channel
ProverCreateProof creates a proof according to the given proof request either a corresponding credential with optionally revealed attributes or self-attested attribute must be provided for each requested attribute (see ProverGetCredentialsForPoolReq). A proof request may request multiple credentials from different schemas and different issuers. All required schemas, public keys and revocation registries must be provided. The proof request also contains nonce. The proof contains either proof or self-attested attribute value for each requested attribute.
func ProverFetchCredentialsForProofReq ¶
ProverFetchCredentialsForProofReq fetches next credentials for the requested item using proof request search handle
searchHandle: Search handle created by ProverSearchCredentialsForProofReq itemRef: Referent of attribute/predicate in the proof request count: Count of credentials to fetch
func ProverSearchCredentialsForProofReq ¶
func ProverSearchCredentialsForProofReq(wallet int, proofReqJSON, extraQueryJSON string) ctx.Channel
ProverSearchCredentialsForProofReq searches for credentials matching the given proof request. Instead of immediately returning of fetched credentials this call returns searchHandle that can be used later to fetch records by small batches with ProverFetchCredentialsForProofReq.
func ProverStoreCredential ¶
func ProverStoreCredential(wallet int, credID, credReqMeta, cred, credDef, revRegDef string) ctx.Channel
ProverStoreCredential stores credentials, where parameters are as follow: credId: (opt, auto), ID by which credential will be stored in wallet. credReqMeta: json: a metadata created by ProverCreateCredentialReq. cred: credential json received from issuer. credDef: credential definition json related to <credDefId> in <cred> revRegDef: (opt) json related <rev_reg_def_id> in <cred json>
func VerifierVerifyProof ¶
func VerifierVerifyProof(proofReqJSON, proofJSON, schemasJSON, credDefsJSON, revRegDefsJSON, revRegsJSON string) ctx.Channel
VerifierVerifyProof verifies a proof (of multiple credential). All required schemas, public keys and revocation registries must be provided.
Types ¶
type AttrInfo ¶
type AttrInfo struct { Name string `json:"name"` Restrictions []Filter `json:"restrictions,omitempty"` NonRevoked *NonRevocInterval `json:"non_revoked,omitempty"` }
AttrInfo is wrapper struct for libindy's corresponding JSON type.
type CredDefAttr ¶
CredDefAttr is wrapper struct for libindy's corresponding JSON type.
func (*CredDefAttr) SetEncoded ¶
func (a *CredDefAttr) SetEncoded(s string) string
SetEncoded sets encoded value to attribute. This is obsolete with Aries.
func (*CredDefAttr) SetRaw ¶
func (a *CredDefAttr) SetRaw(s string) string
SetRaw sets raw value to attribute. This is obsolete with Aries.
func (*CredDefAttr) SetRawAries ¶
func (a *CredDefAttr) SetRawAries(s string) string
SetRawAries sets the raw value of the attribute and writes the encoded value of it in same algorithm as Aries indy implementations
type CredDefCfg ¶
type CredDefCfg struct {
SupportRevocation bool `json:"support_revocation"`
}
CredDefCfg is wrapper struct for libindy's corresponding JSON type.
type CredentialInfo ¶
type CredentialInfo struct { Referent string `json:"referent"` Attrs map[string]string `json:"attrs"` SchemaID string `json:"schema_id"` CredDefID string `json:"cred_def_id"` RevRegID int `json:"rev_reg_id,omitempty"` CredRevID int `json:"cred_rev_id,omitempty"` }
CredentialInfo is wrapper struct for libindy's corresponding JSON type.
type Credentials ¶
type Credentials struct { CredInfo CredentialInfo `json:"cred_info"` Interval *NonRevocInterval `json:"interval,omitempty"` }
Credentials is wrapper struct for libindy's corresponding JSON type.
type Filter ¶
type Filter struct { SchemaID string `json:"schema_id,omitempty"` SchemaIssuerDID string `json:"schema_issuer_did,omitempty"` SchemaName string `json:"schema_name,omitempty"` IssuerDID string `json:"issuer_did,omitempty"` CredDefID string `json:"cred_def_id,omitempty"` }
Filter is wrapper struct for libindy's corresponding JSON type.
type IdentifiersObj ¶
type IdentifiersObj struct { SchemaID string `json:"schema_id"` CredDefID string `json:"cred_def_id"` RevRegID string `json:"rev_reg_id,omitempty"` Timestamp string `json:"timestamp,omitempty"` }
IdentifiersObj is wrapper struct for libindy's corresponding JSON type.
type NonRevocInterval ¶
NonRevocInterval is wrapper struct for libindy's corresponding JSON type.
type PredicateInfo ¶
type PredicateInfo struct { Name string `json:"name"` PType string `json:"p_type"` PValue int `json:"p_value"` Restrictions []Filter `json:"restrictions,omitempty"` NonRevoked NonRevocInterval `json:"non_revoked,omitempty"` }
PredicateInfo is wrapper struct for libindy's corresponding JSON type.
type Proof ¶
type Proof struct { RequestedProof RequestedProof `json:"requested_proof"` Proof map[string]interface{} `json:"proof"` Identifiers []IdentifiersObj `json:"identifiers"` }
Proof is wrapper struct for libindy's corresponding JSON type.
type ProofRequest ¶
type ProofRequest struct { Name string `json:"name"` Version string `json:"version"` Nonce string `json:"nonce"` RequestedAttributes map[string]AttrInfo `json:"requested_attributes"` RequestedPredicates map[string]PredicateInfo `json:"requested_predicates"` NonRevoked *NonRevocInterval `json:"non_revoked,omitempty"` }
ProofRequest is wrapper struct for libindy's corresponding JSON type.
type RequestedAttrObject ¶
type RequestedAttrObject struct { CredID string `json:"cred_id"` Timestamp *int `json:"timestamp"` Revealed bool `json:"revealed"` }
RequestedAttrObject is wrapper struct for libindy's corresponding JSON type.
type RequestedCredentials ¶
type RequestedCredentials struct { SelfAttestedAttributes map[string]string `json:"self_attested_attributes"` RequestedAttributes map[string]RequestedAttrObject `json:"requested_attributes"` RequestedPredicates map[string]RequestedPredObject `json:"requested_predicates"` }
RequestedCredentials is wrapper struct for libindy's corresponding JSON type.
type RequestedPredObject ¶
type RequestedPredObject struct { CredID string `json:"cred_id"` Timestamp *int `json:"timestamp,omitempty"` }
RequestedPredObject is wrapper struct for libindy's corresponding JSON type.
type RequestedProof ¶
type RequestedProof struct { RevealedAttrs map[string]RevealedAttr `json:"revealed_attrs"` UnrevealedAttrs map[string]interface{} `json:"unrevealed_attrs"` SelfAttestedAttrs map[string]interface{} `json:"self_attested_attrs"` Predicates map[string]interface{} `json:"predicates"` }
RequestedProof is wrapper struct for libindy's corresponding JSON type.
type RevealedAttr ¶
type RevealedAttr struct { SubProofIndex int `json:"sub_proof_index"` Raw string `json:"raw"` Encoded string `json:"encoded"` }
RevealedAttr is wrapper struct for libindy's corresponding JSON type.