55 "context"
66 "crypto/x509"
77 "errors"
8- "math/rand/v2"
98 "os"
109 "time"
1110
@@ -34,17 +33,6 @@ func NewStorageAuthorityReadOnly(clk clock.Clock) *StorageAuthorityReadOnly {
3433 return & StorageAuthorityReadOnly {clk }
3534}
3635
37- // StorageAuthority is a mock of sapb.StorageAuthorityClient
38- type StorageAuthority struct {
39- StorageAuthorityReadOnly
40- }
41-
42- // NewStorageAuthority creates a new mock storage authority
43- // with the given clock.
44- func NewStorageAuthority (clk clock.Clock ) * StorageAuthority {
45- return & StorageAuthority {StorageAuthorityReadOnly {clk }}
46- }
47-
4836const (
4937 test1KeyPublicJSON = `{"kty":"RSA","n":"yNWVhtYEKJR21y9xsHV-PD_bYwbXSeNuFal46xYxVfRL5mqha7vttvjB_vc7Xg2RvgCxHPCqoxgMPTzHrZT75LjCwIW2K_klBYN8oYvTwwmeSkAz6ut7ZxPv-nZaT5TJhGk0NT2kh_zSpdriEJ_3vW-mqxYbbBmpvHqsa1_zx9fSuHYctAZJWzxzUZXykbWMWQZpEiE0J4ajj51fInEzVn7VxV-mzfMyboQjujPh7aNJxAWSq4oQEJJDgWwSh9leyoJoPpONHxh5nEE5AjE01FkGICSxjpZsF-w8hOTI3XXohUdu29Se26k2B0PolDSuj0GIQU6-W9TdLXSjBb2SpQ","e":"AQAB"}`
5038 test2KeyPublicJSON = `{"kty":"RSA","n":"qnARLrT7Xz4gRcKyLdydmCr-ey9OuPImX4X40thk3on26FkMznR3fRjs66eLK7mmPcBZ6uOJseURU6wAaZNmemoYx1dMvqvWWIyiQleHSD7Q8vBrhR6uIoO4jAzJZR-ChzZuSDt7iHN-3xUVspu5XGwXU_MVJZshTwp4TaFx5elHIT_ObnTvTOU3Xhish07AbgZKmWsVbXh5s-CrIicU4OexJPgunWZ_YJJueOKmTvnLlTV4MzKR2oZlBKZ27S0-SfdV_QDx_ydle5oMAyKVtlAV35cyPMIsYNwgUGBCdY_2Uzi5eX0lTc7MPRwz6qR1kip-i59VcGcUQgqHV6Fyqw","e":"AQAB"}`
@@ -221,51 +209,21 @@ func (sa *StorageAuthorityReadOnly) SerialsForIncident(ctx context.Context, _ *s
221209 return & ServerStreamClient [sapb.IncidentSerial ]{}, nil
222210}
223211
224- // SerialsForIncident is a mock
225- func (sa * StorageAuthority ) SerialsForIncident (ctx context.Context , _ * sapb.SerialsForIncidentRequest , _ ... grpc.CallOption ) (sapb.StorageAuthority_SerialsForIncidentClient , error ) {
226- return & ServerStreamClient [sapb.IncidentSerial ]{}, nil
227- }
228-
229212// CheckIdentifiersPaused is a mock
230213func (sa * StorageAuthorityReadOnly ) CheckIdentifiersPaused (_ context.Context , _ * sapb.PauseRequest , _ ... grpc.CallOption ) (* sapb.Identifiers , error ) {
231214 return nil , nil
232215}
233216
234- // CheckIdentifiersPaused is a mock
235- func (sa * StorageAuthority ) CheckIdentifiersPaused (_ context.Context , _ * sapb.PauseRequest , _ ... grpc.CallOption ) (* sapb.Identifiers , error ) {
236- return nil , nil
237- }
238-
239217// GetPausedIdentifiers is a mock
240218func (sa * StorageAuthorityReadOnly ) GetPausedIdentifiers (_ context.Context , _ * sapb.RegistrationID , _ ... grpc.CallOption ) (* sapb.Identifiers , error ) {
241219 return nil , nil
242220}
243221
244- // GetPausedIdentifiers is a mock
245- func (sa * StorageAuthority ) GetPausedIdentifiers (_ context.Context , _ * sapb.RegistrationID , _ ... grpc.CallOption ) (* sapb.Identifiers , error ) {
246- return nil , nil
247- }
248-
249222// GetRevokedCertsByShard is a mock
250223func (sa * StorageAuthorityReadOnly ) GetRevokedCertsByShard (ctx context.Context , _ * sapb.GetRevokedCertsByShardRequest , _ ... grpc.CallOption ) (grpc.ServerStreamingClient [corepb.CRLEntry ], error ) {
251224 return & ServerStreamClient [corepb.CRLEntry ]{}, nil
252225}
253226
254- // AddRateLimitOverride is a mock
255- func (sa * StorageAuthority ) AddRateLimitOverride (_ context.Context , req * sapb.AddRateLimitOverrideRequest , _ ... grpc.CallOption ) (* sapb.AddRateLimitOverrideResponse , error ) {
256- return nil , nil
257- }
258-
259- // DisableRateLimitOverride is a mock
260- func (sa * StorageAuthority ) DisableRateLimitOverride (ctx context.Context , req * sapb.DisableRateLimitOverrideRequest ) (* emptypb.Empty , error ) {
261- return nil , nil
262- }
263-
264- // EnableRateLimitOverride is a mock
265- func (sa * StorageAuthority ) EnableRateLimitOverride (ctx context.Context , req * sapb.EnableRateLimitOverrideRequest ) (* emptypb.Empty , error ) {
266- return nil , nil
267- }
268-
269227// GetRateLimitOverride is a mock
270228func (sa * StorageAuthorityReadOnly ) GetRateLimitOverride (_ context.Context , req * sapb.GetRateLimitOverrideRequest , _ ... grpc.CallOption ) (* sapb.RateLimitOverrideResponse , error ) {
271229 return nil , nil
@@ -276,31 +234,6 @@ func (sa *StorageAuthorityReadOnly) GetEnabledRateLimitOverrides(_ context.Conte
276234 return nil , nil
277235}
278236
279- // AddPrecertificate is a mock
280- func (sa * StorageAuthority ) AddPrecertificate (ctx context.Context , req * sapb.AddCertificateRequest , _ ... grpc.CallOption ) (* emptypb.Empty , error ) {
281- return nil , nil
282- }
283-
284- // AddSerial is a mock
285- func (sa * StorageAuthority ) AddSerial (ctx context.Context , req * sapb.AddSerialRequest , _ ... grpc.CallOption ) (* emptypb.Empty , error ) {
286- return nil , nil
287- }
288-
289- // AddCertificate is a mock
290- func (sa * StorageAuthority ) AddCertificate (_ context.Context , _ * sapb.AddCertificateRequest , _ ... grpc.CallOption ) (* emptypb.Empty , error ) {
291- return nil , nil
292- }
293-
294- // NewRegistration is a mock
295- func (sa * StorageAuthority ) NewRegistration (_ context.Context , _ * corepb.Registration , _ ... grpc.CallOption ) (* corepb.Registration , error ) {
296- return & corepb.Registration {}, nil
297- }
298-
299- // UpdateRegistration is a mock
300- func (sa * StorageAuthority ) UpdateRegistration (_ context.Context , _ * corepb.Registration , _ ... grpc.CallOption ) (* emptypb.Empty , error ) {
301- return & emptypb.Empty {}, nil
302- }
303-
304237// FQDNSetTimestampsForWindow is a mock
305238func (sa * StorageAuthorityReadOnly ) FQDNSetTimestampsForWindow (_ context.Context , _ * sapb.CountFQDNSetsRequest , _ ... grpc.CallOption ) (* sapb.Timestamps , error ) {
306239 return & sapb.Timestamps {}, nil
@@ -311,45 +244,6 @@ func (sa *StorageAuthorityReadOnly) FQDNSetExists(_ context.Context, _ *sapb.FQD
311244 return & sapb.Exists {Exists : false }, nil
312245}
313246
314- // DeactivateRegistration is a mock
315- func (sa * StorageAuthority ) DeactivateRegistration (_ context.Context , _ * sapb.RegistrationID , _ ... grpc.CallOption ) (* emptypb.Empty , error ) {
316- return & emptypb.Empty {}, nil
317- }
318-
319- // NewOrderAndAuthzs is a mock
320- func (sa * StorageAuthority ) NewOrderAndAuthzs (_ context.Context , req * sapb.NewOrderAndAuthzsRequest , _ ... grpc.CallOption ) (* corepb.Order , error ) {
321- response := & corepb.Order {
322- // Fields from the input new order request.
323- RegistrationID : req .NewOrder .RegistrationID ,
324- Expires : req .NewOrder .Expires ,
325- Identifiers : req .NewOrder .Identifiers ,
326- V2Authorizations : req .NewOrder .V2Authorizations ,
327- // Mock new fields generated by the database transaction.
328- Id : rand .Int64 (),
329- Created : timestamppb .Now (),
330- // A new order is never processing because it can't have been finalized yet.
331- BeganProcessing : false ,
332- Status : string (core .StatusPending ),
333- CertificateProfileName : req .NewOrder .CertificateProfileName ,
334- }
335- return response , nil
336- }
337-
338- // SetOrderProcessing is a mock
339- func (sa * StorageAuthority ) SetOrderProcessing (_ context.Context , req * sapb.OrderRequest , _ ... grpc.CallOption ) (* emptypb.Empty , error ) {
340- return & emptypb.Empty {}, nil
341- }
342-
343- // SetOrderError is a mock
344- func (sa * StorageAuthority ) SetOrderError (_ context.Context , req * sapb.SetOrderErrorRequest , _ ... grpc.CallOption ) (* emptypb.Empty , error ) {
345- return & emptypb.Empty {}, nil
346- }
347-
348- // FinalizeOrder is a mock
349- func (sa * StorageAuthority ) FinalizeOrder (_ context.Context , req * sapb.FinalizeOrderRequest , _ ... grpc.CallOption ) (* emptypb.Empty , error ) {
350- return & emptypb.Empty {}, nil
351- }
352-
353247// GetOrder is a mock
354248func (sa * StorageAuthorityReadOnly ) GetOrder (_ context.Context , req * sapb.OrderRequest , _ ... grpc.CallOption ) (* corepb.Order , error ) {
355249 if req .Id == 2 {
@@ -416,14 +310,6 @@ func (sa *StorageAuthorityReadOnly) GetOrderForNames(_ context.Context, _ *sapb.
416310 return nil , nil
417311}
418312
419- func (sa * StorageAuthority ) FinalizeAuthorization2 (ctx context.Context , req * sapb.FinalizeAuthorizationRequest , _ ... grpc.CallOption ) (* emptypb.Empty , error ) {
420- return & emptypb.Empty {}, nil
421- }
422-
423- func (sa * StorageAuthority ) DeactivateAuthorization2 (ctx context.Context , req * sapb.AuthorizationID2 , _ ... grpc.CallOption ) (* emptypb.Empty , error ) {
424- return nil , nil
425- }
426-
427313func (sa * StorageAuthorityReadOnly ) CountPendingAuthorizations2 (ctx context.Context , req * sapb.RegistrationID , _ ... grpc.CallOption ) (* sapb.Count , error ) {
428314 return & sapb.Count {}, nil
429315}
@@ -476,36 +362,11 @@ func (sa *StorageAuthorityReadOnly) GetSerialsByKey(ctx context.Context, _ *sapb
476362 return & ServerStreamClient [sapb.Serial ]{}, nil
477363}
478364
479- // GetSerialsByKey is a mock
480- func (sa * StorageAuthority ) GetSerialsByKey (ctx context.Context , _ * sapb.SPKIHash , _ ... grpc.CallOption ) (sapb.StorageAuthority_GetSerialsByKeyClient , error ) {
481- return & ServerStreamClient [sapb.Serial ]{}, nil
482- }
483-
484365// GetSerialsByAccount is a mock
485366func (sa * StorageAuthorityReadOnly ) GetSerialsByAccount (ctx context.Context , _ * sapb.RegistrationID , _ ... grpc.CallOption ) (sapb.StorageAuthorityReadOnly_GetSerialsByAccountClient , error ) {
486367 return & ServerStreamClient [sapb.Serial ]{}, nil
487368}
488369
489- // GetSerialsByAccount is a mock
490- func (sa * StorageAuthority ) GetSerialsByAccount (ctx context.Context , _ * sapb.RegistrationID , _ ... grpc.CallOption ) (sapb.StorageAuthority_GetSerialsByAccountClient , error ) {
491- return & ServerStreamClient [sapb.Serial ]{}, nil
492- }
493-
494- // RevokeCertificate is a mock
495- func (sa * StorageAuthority ) RevokeCertificate (ctx context.Context , req * sapb.RevokeCertificateRequest , _ ... grpc.CallOption ) (* emptypb.Empty , error ) {
496- return nil , nil
497- }
498-
499- // UpdateRevokedCertificate is a mock
500- func (sa * StorageAuthority ) UpdateRevokedCertificate (ctx context.Context , req * sapb.RevokeCertificateRequest , _ ... grpc.CallOption ) (* emptypb.Empty , error ) {
501- return nil , nil
502- }
503-
504- // AddBlockedKey is a mock
505- func (sa * StorageAuthority ) AddBlockedKey (ctx context.Context , req * sapb.AddBlockedKeyRequest , _ ... grpc.CallOption ) (* emptypb.Empty , error ) {
506- return & emptypb.Empty {}, nil
507- }
508-
509370// KeyBlocked is a mock
510371func (sa * StorageAuthorityReadOnly ) KeyBlocked (ctx context.Context , req * sapb.SPKIHash , _ ... grpc.CallOption ) (* sapb.Exists , error ) {
511372 return & sapb.Exists {Exists : false }, nil
@@ -516,16 +377,6 @@ func (sa *StorageAuthorityReadOnly) IncidentsForSerial(ctx context.Context, req
516377 return & sapb.Incidents {}, nil
517378}
518379
519- // LeaseCRLShard is a mock.
520- func (sa * StorageAuthority ) LeaseCRLShard (ctx context.Context , req * sapb.LeaseCRLShardRequest , _ ... grpc.CallOption ) (* sapb.LeaseCRLShardResponse , error ) {
521- return nil , errors .New ("unimplemented" )
522- }
523-
524- // UpdateCRLShard is a mock.
525- func (sa * StorageAuthority ) UpdateCRLShard (ctx context.Context , req * sapb.UpdateCRLShardRequest , _ ... grpc.CallOption ) (* emptypb.Empty , error ) {
526- return nil , errors .New ("unimplemented" )
527- }
528-
529380// ReplacementOrderExists is a mock.
530381func (sa * StorageAuthorityReadOnly ) ReplacementOrderExists (ctx context.Context , req * sapb.Serial , _ ... grpc.CallOption ) (* sapb.Exists , error ) {
531382 return nil , nil
0 commit comments