github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/service/audit.go (about) 1 package service 2 3 import ( 4 "github.com/keybase/client/go/libkb" 5 keybase1 "github.com/keybase/client/go/protocol/keybase1" 6 "github.com/keybase/client/go/teams" 7 "github.com/keybase/go-framed-msgpack-rpc/rpc" 8 9 "golang.org/x/net/context" 10 ) 11 12 type AuditHandler struct { 13 libkb.Contextified 14 *BaseHandler 15 } 16 17 func NewAuditHandler(xp rpc.Transporter, g *libkb.GlobalContext) *AuditHandler { 18 handler := &AuditHandler{ 19 Contextified: libkb.NewContextified(g), 20 BaseHandler: NewBaseHandler(g, xp), 21 } 22 return handler 23 } 24 25 var _ keybase1.AuditInterface = (*AuditHandler)(nil) 26 27 func (h *AuditHandler) IsInJail(ctx context.Context, arg keybase1.IsInJailArg) (ret bool, err error) { 28 mctx := libkb.NewMetaContext(ctx, h.G()) 29 defer mctx.Trace("AuditHandler#IsInJail", &err)() 30 return h.G().GetTeamBoxAuditor().IsInJail(mctx, arg.TeamID) 31 } 32 33 func (h *AuditHandler) BoxAuditTeam(ctx context.Context, arg keybase1.BoxAuditTeamArg) (res *keybase1.BoxAuditAttempt, err error) { 34 mctx := libkb.NewMetaContext(ctx, h.G()) 35 defer mctx.Trace("AuditHandler#BoxAuditTeam", &err)() 36 return h.G().GetTeamBoxAuditor().BoxAuditTeam(mctx, arg.TeamID) 37 } 38 39 func (h *AuditHandler) AttemptBoxAudit(ctx context.Context, arg keybase1.AttemptBoxAuditArg) (res keybase1.BoxAuditAttempt, err error) { 40 mctx := libkb.NewMetaContext(ctx, h.G()) 41 defer mctx.Trace("AuditHandler#AttemptBoxAudit", &err)() 42 return h.G().GetTeamBoxAuditor().Attempt(mctx, arg.TeamID, arg.RotateBeforeAudit), nil 43 } 44 45 func (h *AuditHandler) KnownTeamIDs(ctx context.Context, sessionID int) (res []keybase1.TeamID, err error) { 46 mctx := libkb.NewMetaContext(ctx, h.G()) 47 defer mctx.Trace("AuditHandler#KnownTeamIDs", &err)() 48 return teams.KnownTeamIDs(mctx) 49 }