Beispiel #1
0
// NewConfigLocalWithCrypto initializes a local crypto config w/a crypto interface that can be used for non-PKI crypto.
func NewConfigLocalWithCrypto() *ConfigLocal {
	config := NewConfigLocal()
	config.SetLoggerMaker(func(m string) logger.Logger {
		return logger.NewNull()
	})
	signingKey := MakeLocalUserSigningKeyOrBust("nobody")
	cryptPrivateKey := MakeLocalUserCryptPrivateKeyOrBust("nobody")
	crypto := NewCryptoLocal(config, signingKey, cryptPrivateKey)
	config.SetCrypto(crypto)
	return config
}
Beispiel #2
0
func (h *IdentifyHandler) identify(sessionID int, iarg engine.IDEngineArg, doInteractive bool) (res *engine.IDRes, err error) {
	logui := h.getLogUI(sessionID)
	if iarg.TrackStatement {
		logui = logger.NewNull()
	}
	ctx := engine.Context{
		LogUI:      logui,
		IdentifyUI: h.NewRemoteIdentifyUI(sessionID, h.G()),
	}
	eng := engine.NewIDEngine(&iarg, h.G())
	err = engine.RunEngine(eng, &ctx)
	res = eng.Result()
	return
}
Beispiel #3
0
func (h *IdentifyHandler) makeContext(sessionID int, arg keybase1.IdentifyArg) (ret *engine.Context, err error) {
	var iui libkb.IdentifyUI

	h.G().Log.Debug("+ makeContext(%d, %v)", sessionID, arg)
	defer func() {
		h.G().Log.Debug("- makeContext -> %v", err)
	}()

	if arg.UseDelegateUI {
		h.G().Log.Debug("+ trying to delegate our UI")
		if h.G().UIRouter == nil {
			h.G().Log.Warning("Can't delegate to a UI in standalone mode")
		} else {
			iui, err = h.G().UIRouter.GetIdentifyUI()
			if err != nil {
				return nil, err
			}
		}
		h.G().Log.Debug("- delegated UI with success=(%v)", (iui != nil))
	}

	// If we failed to delegate, we can still fallback and just log to the terminal.
	if iui == nil {
		h.G().Log.Debug("| using a remote UI as normal")
		iui = h.NewRemoteIdentifyUI(sessionID, h.G())
	}

	if iui == nil {
		err = libkb.NoUIError{Which: "Identify"}
		return nil, err
	}

	logui := h.getLogUI(sessionID)
	if arg.TrackStatement {
		logui = logger.NewNull()
	}

	ctx := engine.Context{
		LogUI:      logui,
		IdentifyUI: iui,
		SessionID:  sessionID,
	}
	return &ctx, nil
}
Beispiel #4
0
// MakeCryptoCommonNoConfig returns a default CryptoCommon
// object. This is meant to be used for code that doesn't use Config
// (like server code).
func MakeCryptoCommonNoConfig() CryptoCommon {
	log := logger.NewNull()
	return CryptoCommon{NewCodecMsgpack(), log, log.CloneWithAddedDepth(1)}
}
Beispiel #5
0
// NewService constructs a launchd service.
func NewService(label string) Service {
	return Service{
		label: label,
		log:   logger.NewNull(),
	}
}