github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/service/scanproofs.go (about)

     1  // Copyright 2016 Keybase, Inc. All rights reserved. Use of
     2  // this source code is governed by the included BSD license.
     3  
     4  package service
     5  
     6  import (
     7  	"github.com/keybase/client/go/engine"
     8  	"github.com/keybase/client/go/libkb"
     9  	keybase1 "github.com/keybase/client/go/protocol/keybase1"
    10  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
    11  	"golang.org/x/net/context"
    12  )
    13  
    14  type ScanProofsHandler struct {
    15  	*BaseHandler
    16  	libkb.Contextified
    17  }
    18  
    19  func NewScanProofsHandler(xp rpc.Transporter, g *libkb.GlobalContext) *ScanProofsHandler {
    20  	return &ScanProofsHandler{
    21  		BaseHandler:  NewBaseHandler(g, xp),
    22  		Contextified: libkb.NewContextified(g),
    23  	}
    24  }
    25  
    26  // ScanProofs creates a ScanProofsEngine and runs it.
    27  func (h *ScanProofsHandler) ScanProofs(ctx context.Context, arg keybase1.ScanProofsArg) error {
    28  	uis := libkb.UIs{
    29  		LogUI:     h.getLogUI(arg.SessionID),
    30  		SessionID: arg.SessionID,
    31  	}
    32  	eng := engine.NewScanProofsEngine(arg.Infile, arg.Indices, arg.Sigid, arg.Ratelimit, arg.Cachefile, arg.Ignorefile, h.G())
    33  	m := libkb.NewMetaContext(ctx, h.G()).WithUIs(uis)
    34  	return engine.RunEngine2(m, eng)
    35  }