github.com/hellobchain/third_party@v0.0.0-20230331131523-deb0478a2e52/hyperledger/fabric/bccsp/idemix/handlers/mock/revocation.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mock 3 4 import ( 5 "github.com/hellobchain/newcryptosm/ecdsa" 6 "sync" 7 8 "github.com/hellobchain/third_party/hyperledger/fabric/bccsp" 9 "github.com/hellobchain/third_party/hyperledger/fabric/bccsp/idemix/handlers" 10 ) 11 12 type Revocation struct { 13 NewKeyStub func() (*ecdsa.PrivateKey, error) 14 newKeyMutex sync.RWMutex 15 newKeyArgsForCall []struct{} 16 newKeyReturns struct { 17 result1 *ecdsa.PrivateKey 18 result2 error 19 } 20 newKeyReturnsOnCall map[int]struct { 21 result1 *ecdsa.PrivateKey 22 result2 error 23 } 24 SignStub func(key *ecdsa.PrivateKey, unrevokedHandles [][]byte, epoch int, alg bccsp.RevocationAlgorithm) ([]byte, error) 25 signMutex sync.RWMutex 26 signArgsForCall []struct { 27 key *ecdsa.PrivateKey 28 unrevokedHandles [][]byte 29 epoch int 30 alg bccsp.RevocationAlgorithm 31 } 32 signReturns struct { 33 result1 []byte 34 result2 error 35 } 36 signReturnsOnCall map[int]struct { 37 result1 []byte 38 result2 error 39 } 40 VerifyStub func(pk *ecdsa.PublicKey, cri []byte, epoch int, alg bccsp.RevocationAlgorithm) error 41 verifyMutex sync.RWMutex 42 verifyArgsForCall []struct { 43 pk *ecdsa.PublicKey 44 cri []byte 45 epoch int 46 alg bccsp.RevocationAlgorithm 47 } 48 verifyReturns struct { 49 result1 error 50 } 51 verifyReturnsOnCall map[int]struct { 52 result1 error 53 } 54 invocations map[string][][]interface{} 55 invocationsMutex sync.RWMutex 56 } 57 58 func (fake *Revocation) NewKey() (*ecdsa.PrivateKey, error) { 59 fake.newKeyMutex.Lock() 60 ret, specificReturn := fake.newKeyReturnsOnCall[len(fake.newKeyArgsForCall)] 61 fake.newKeyArgsForCall = append(fake.newKeyArgsForCall, struct{}{}) 62 fake.recordInvocation("NewKey", []interface{}{}) 63 fake.newKeyMutex.Unlock() 64 if fake.NewKeyStub != nil { 65 return fake.NewKeyStub() 66 } 67 if specificReturn { 68 return ret.result1, ret.result2 69 } 70 return fake.newKeyReturns.result1, fake.newKeyReturns.result2 71 } 72 73 func (fake *Revocation) NewKeyCallCount() int { 74 fake.newKeyMutex.RLock() 75 defer fake.newKeyMutex.RUnlock() 76 return len(fake.newKeyArgsForCall) 77 } 78 79 func (fake *Revocation) NewKeyReturns(result1 *ecdsa.PrivateKey, result2 error) { 80 fake.NewKeyStub = nil 81 fake.newKeyReturns = struct { 82 result1 *ecdsa.PrivateKey 83 result2 error 84 }{result1, result2} 85 } 86 87 func (fake *Revocation) NewKeyReturnsOnCall(i int, result1 *ecdsa.PrivateKey, result2 error) { 88 fake.NewKeyStub = nil 89 if fake.newKeyReturnsOnCall == nil { 90 fake.newKeyReturnsOnCall = make(map[int]struct { 91 result1 *ecdsa.PrivateKey 92 result2 error 93 }) 94 } 95 fake.newKeyReturnsOnCall[i] = struct { 96 result1 *ecdsa.PrivateKey 97 result2 error 98 }{result1, result2} 99 } 100 101 func (fake *Revocation) Sign(key *ecdsa.PrivateKey, unrevokedHandles [][]byte, epoch int, alg bccsp.RevocationAlgorithm) ([]byte, error) { 102 var unrevokedHandlesCopy [][]byte 103 if unrevokedHandles != nil { 104 unrevokedHandlesCopy = make([][]byte, len(unrevokedHandles)) 105 copy(unrevokedHandlesCopy, unrevokedHandles) 106 } 107 fake.signMutex.Lock() 108 ret, specificReturn := fake.signReturnsOnCall[len(fake.signArgsForCall)] 109 fake.signArgsForCall = append(fake.signArgsForCall, struct { 110 key *ecdsa.PrivateKey 111 unrevokedHandles [][]byte 112 epoch int 113 alg bccsp.RevocationAlgorithm 114 }{key, unrevokedHandlesCopy, epoch, alg}) 115 fake.recordInvocation("Sign", []interface{}{key, unrevokedHandlesCopy, epoch, alg}) 116 fake.signMutex.Unlock() 117 if fake.SignStub != nil { 118 return fake.SignStub(key, unrevokedHandles, epoch, alg) 119 } 120 if specificReturn { 121 return ret.result1, ret.result2 122 } 123 return fake.signReturns.result1, fake.signReturns.result2 124 } 125 126 func (fake *Revocation) SignCallCount() int { 127 fake.signMutex.RLock() 128 defer fake.signMutex.RUnlock() 129 return len(fake.signArgsForCall) 130 } 131 132 func (fake *Revocation) SignArgsForCall(i int) (*ecdsa.PrivateKey, [][]byte, int, bccsp.RevocationAlgorithm) { 133 fake.signMutex.RLock() 134 defer fake.signMutex.RUnlock() 135 return fake.signArgsForCall[i].key, fake.signArgsForCall[i].unrevokedHandles, fake.signArgsForCall[i].epoch, fake.signArgsForCall[i].alg 136 } 137 138 func (fake *Revocation) SignReturns(result1 []byte, result2 error) { 139 fake.SignStub = nil 140 fake.signReturns = struct { 141 result1 []byte 142 result2 error 143 }{result1, result2} 144 } 145 146 func (fake *Revocation) SignReturnsOnCall(i int, result1 []byte, result2 error) { 147 fake.SignStub = nil 148 if fake.signReturnsOnCall == nil { 149 fake.signReturnsOnCall = make(map[int]struct { 150 result1 []byte 151 result2 error 152 }) 153 } 154 fake.signReturnsOnCall[i] = struct { 155 result1 []byte 156 result2 error 157 }{result1, result2} 158 } 159 160 func (fake *Revocation) Verify(pk *ecdsa.PublicKey, cri []byte, epoch int, alg bccsp.RevocationAlgorithm) error { 161 var criCopy []byte 162 if cri != nil { 163 criCopy = make([]byte, len(cri)) 164 copy(criCopy, cri) 165 } 166 fake.verifyMutex.Lock() 167 ret, specificReturn := fake.verifyReturnsOnCall[len(fake.verifyArgsForCall)] 168 fake.verifyArgsForCall = append(fake.verifyArgsForCall, struct { 169 pk *ecdsa.PublicKey 170 cri []byte 171 epoch int 172 alg bccsp.RevocationAlgorithm 173 }{pk, criCopy, epoch, alg}) 174 fake.recordInvocation("Verify", []interface{}{pk, criCopy, epoch, alg}) 175 fake.verifyMutex.Unlock() 176 if fake.VerifyStub != nil { 177 return fake.VerifyStub(pk, cri, epoch, alg) 178 } 179 if specificReturn { 180 return ret.result1 181 } 182 return fake.verifyReturns.result1 183 } 184 185 func (fake *Revocation) VerifyCallCount() int { 186 fake.verifyMutex.RLock() 187 defer fake.verifyMutex.RUnlock() 188 return len(fake.verifyArgsForCall) 189 } 190 191 func (fake *Revocation) VerifyArgsForCall(i int) (*ecdsa.PublicKey, []byte, int, bccsp.RevocationAlgorithm) { 192 fake.verifyMutex.RLock() 193 defer fake.verifyMutex.RUnlock() 194 return fake.verifyArgsForCall[i].pk, fake.verifyArgsForCall[i].cri, fake.verifyArgsForCall[i].epoch, fake.verifyArgsForCall[i].alg 195 } 196 197 func (fake *Revocation) VerifyReturns(result1 error) { 198 fake.VerifyStub = nil 199 fake.verifyReturns = struct { 200 result1 error 201 }{result1} 202 } 203 204 func (fake *Revocation) VerifyReturnsOnCall(i int, result1 error) { 205 fake.VerifyStub = nil 206 if fake.verifyReturnsOnCall == nil { 207 fake.verifyReturnsOnCall = make(map[int]struct { 208 result1 error 209 }) 210 } 211 fake.verifyReturnsOnCall[i] = struct { 212 result1 error 213 }{result1} 214 } 215 216 func (fake *Revocation) Invocations() map[string][][]interface{} { 217 fake.invocationsMutex.RLock() 218 defer fake.invocationsMutex.RUnlock() 219 fake.newKeyMutex.RLock() 220 defer fake.newKeyMutex.RUnlock() 221 fake.signMutex.RLock() 222 defer fake.signMutex.RUnlock() 223 fake.verifyMutex.RLock() 224 defer fake.verifyMutex.RUnlock() 225 copiedInvocations := map[string][][]interface{}{} 226 for key, value := range fake.invocations { 227 copiedInvocations[key] = value 228 } 229 return copiedInvocations 230 } 231 232 func (fake *Revocation) recordInvocation(key string, args []interface{}) { 233 fake.invocationsMutex.Lock() 234 defer fake.invocationsMutex.Unlock() 235 if fake.invocations == nil { 236 fake.invocations = map[string][][]interface{}{} 237 } 238 if fake.invocations[key] == nil { 239 fake.invocations[key] = [][]interface{}{} 240 } 241 fake.invocations[key] = append(fake.invocations[key], args) 242 } 243 244 var _ handlers.Revocation = new(Revocation)