-
Notifications
You must be signed in to change notification settings - Fork 0
/
nonrevocation-prover.go
38 lines (32 loc) · 1.14 KB
/
nonrevocation-prover.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
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package idemix
import (
"github.com/hyperledger/fabric-amcl/amcl"
"github.com/hyperledger/fabric-amcl/amcl/FP256BN"
"github.com/pkg/errors"
)
type nonRevokedProver interface {
getFSContribution(rh *FP256BN.BIG, rRh *FP256BN.BIG, cri *CredentialRevocationInformation, rng *amcl.RAND) ([]byte, error)
getNonRevokedProof(chal *FP256BN.BIG) (*NonRevocationProof, error)
}
type nopNonRevokedProver struct{}
func (prover *nopNonRevokedProver) getFSContribution(rh *FP256BN.BIG, rRh *FP256BN.BIG, cri *CredentialRevocationInformation, rng *amcl.RAND) ([]byte, error) {
return nil, nil
}
func (prover *nopNonRevokedProver) getNonRevokedProof(chal *FP256BN.BIG) (*NonRevocationProof, error) {
ret := &NonRevocationProof{}
ret.RevocationAlg = int32(ALG_NO_REVOCATION)
return ret, nil
}
func getNonRevocationProver(algorithm RevocationAlgorithm) (nonRevokedProver, error) {
switch algorithm {
case ALG_NO_REVOCATION:
return &nopNonRevokedProver{}, nil
default:
// unknown revocation algorithm
return nil, errors.Errorf("unknown revocation algorithm %d", algorithm)
}
}