-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtypes.go
62 lines (54 loc) · 2.65 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package circuits
import (
core "github.com/iden3/go-iden3-core/v2"
"github.com/iden3/go-iden3-crypto/babyjub"
"github.com/iden3/go-merkletree-sql/v2"
)
type ClaimWithSigAndMTPProof struct {
IssuerID *core.ID `json:"issuerID"`
Claim *core.Claim `json:"claim"`
NonRevProof MTProof `json:"nonRevProof"` // Claim non revocation proof
SignatureProof *BJJSignatureProof `json:"signatureProof"`
IncProof *MTProof `json:"incProof"` // proof of inclusion `Claim` to the issuer claims tree
}
type ClaimWithSigProof struct {
IssuerID *core.ID `json:"issuerID"`
Claim *core.Claim `json:"claim"`
NonRevProof MTProof `json:"nonRevProof"` // Claim non revocation proof
SignatureProof BJJSignatureProof `json:"signatureProof"`
}
type ClaimWithMTPProof struct {
IssuerID *core.ID `json:"issuerId"`
Claim *core.Claim `json:"claim"`
IncProof MTProof `json:"incProof"` // proof of inclusion `Claim` to the issuer claims tree
NonRevProof MTProof `json:"nonRevProof"` // proof of non revocation of the `Claim` in the issuer revocation tree
}
// BJJSignatureProof is a proof of issuer AuthClaim signature over a claim
type BJJSignatureProof struct {
// Signature Signing the claim with the private key of the issuer associated with the issuerAuthClaim
Signature *babyjub.Signature `json:"signature"`
IssuerAuthClaim *core.Claim `json:"issuerAuthClaim"` // issuer AuthClaim
// IssuerAuthIncProof proof of inclusion of issuer AuthClaim to
// the issuer claims tree
IssuerAuthIncProof MTProof `json:"issuerAuthIncProof"`
// IssuerAuthNonRevProof proof of non revocation of issuer
// AuthClaim in the issuer the latest state
IssuerAuthNonRevProof MTProof `json:"issuerAuthNonRevProof"`
}
type MTProof struct {
Proof *merkletree.Proof `json:"proof"` // Proof of inclusion to the Merkle Tree
TreeState TreeState `json:"treeState"` // Identity state
}
// TreeState represents the identity state
type TreeState struct {
State *merkletree.Hash `json:"state"` // identity state
ClaimsRoot *merkletree.Hash `json:"claimsRoot"` // claims tree root
RevocationRoot *merkletree.Hash `json:"revocationRoot"` // revocation tree root
RootOfRoots *merkletree.Hash `json:"rootOfRoots"` // root of roots tree root
}
// GISTProof global identity state tree proof represents the state of the global identities tree published on the
// blockchain
type GISTProof struct {
Root *merkletree.Hash `json:"root"` // GIST root
Proof *merkletree.Proof `json:"proof"` // proof of inclusion or non inclusion of the identity to the GIST
}