Пример #1
0
func (e *Identify2WithUID) runIdentifyUI(ctx *Context) (err error) {
	e.G().Log.Debug("+ runIdentifyUI(%s)", e.them.GetName())

	// RemoteReceived, start with the baseProofSet that has PGP
	// fingerprints and the user's UID and username.
	e.remotesReceived = e.them.BaseProofSet()

	ctx.IdentifyUI.Start(e.them.GetName(), e.arg.Reason)
	for _, k := range e.identifyKeys {
		ctx.IdentifyUI.DisplayKey(k)
	}
	ctx.IdentifyUI.ReportLastTrack(libkb.ExportTrackSummary(e.state.TrackLookup(), e.them.GetName()))
	ctx.IdentifyUI.LaunchNetworkChecks(e.state.ExportToUncheckedIdentity(), e.them.Export())

	waiter := displayUserCardAsync(e.G(), ctx, e.them.GetUID(), (e.me != nil))
	e.them.IDTable().Identify(e.state, e.arg.ForceRemoteCheck, ctx.IdentifyUI, e)

	waiter()

	e.insertTrackToken(ctx)
	ctx.IdentifyUI.Finish()

	err = e.checkRemoteAssertions([]keybase1.ProofState{keybase1.ProofState_OK})
	e.maybeCacheResult()

	if err == nil && !e.arg.NoErrorOnTrackFailure {
		// We only care about tracking errors in this case; hence GetErrorLax
		_, err = e.state.Result().GetErrorLax()
	}

	e.G().Log.Debug("- runIdentifyUI(%s) -> %v", e.them.GetName(), err)
	return err
}
Пример #2
0
func (e *Identify) run(ctx *Context) (*libkb.IdentifyOutcome, error) {
	res := libkb.NewIdentifyOutcome()
	res.Username = e.user.GetName()
	is := libkb.NewIdentifyState(res, e.user)

	if e.me != nil && e.user.Equal(e.me) && !e.arg.AllowSelf {
		return nil, libkb.SelfTrackError{}
	}

	if e.arg.WithTracking {
		if e.me == nil {
			return nil, libkb.LoginRequiredError{Context: "identify with tracking"}
		}

		tlink, err := e.me.TrackChainLinkFor(e.user.GetName(), e.user.GetUID())
		if err != nil {
			return nil, err
		}
		if tlink != nil {
			is.SetTrackLookup(tlink)
			if ttcl, _ := e.me.TmpTrackChainLinkFor(e.user.GetName(), e.user.GetUID()); ttcl != nil {
				is.SetTmpTrackLookup(ttcl)
			}
		}
	}

	if !e.user.HasActiveKey() {
		return nil, libkb.NoActiveKeyError{Username: e.user.GetName()}
	}

	ctx.IdentifyUI.ReportLastTrack(libkb.ExportTrackSummary(is.TrackLookup(), e.user.GetName()))

	e.G().Log.Debug("+ Identify(%s)", e.user.GetName())

	is.Precompute(ctx.IdentifyUI.DisplayKey)

	ctx.IdentifyUI.LaunchNetworkChecks(res.ExportToUncheckedIdentity(), e.user.Export())
	waiter := e.displayUserCardAsync(ctx)

	if err := e.user.IDTable().Identify(is, e.arg.ForceRemoteCheck, ctx.IdentifyUI, nil); err != nil {
		return nil, err
	}

	if err := <-waiter; err != nil {
		return nil, err
	}

	base := e.user.BaseProofSet()
	res.AddProofsToSet(base, []keybase1.ProofState{keybase1.ProofState_OK})
	if !e.userExpr.MatchSet(*base) {
		return nil, fmt.Errorf("User %s didn't match given assertion", e.user.GetName())
	}

	e.G().Log.Debug("- Identify(%s)", e.user.GetName())

	return res, nil
}
Пример #3
0
func (e *Identify) run(ctx *Context) (*libkb.IdentifyOutcome, error) {
	res := libkb.NewIdentifyOutcome(e.arg.WithTracking)
	res.Username = e.user.GetName()
	is := libkb.NewIdentifyState(res, e.user)

	if e.me != nil && e.user.Equal(e.me) && !e.arg.AllowSelf {
		return nil, libkb.SelfTrackError{}
	}

	if e.arg.WithTracking {
		if e.me == nil {
			return nil, libkb.LoginRequiredError{Context: "identify with tracking"}
		}

		tlink, err := e.me.TrackChainLinkFor(e.user.GetName(), e.user.GetUID())
		if err != nil {
			return nil, err
		}
		if tlink != nil {
			is.CreateTrackLookup(tlink)
			res.TrackUsed = is.TrackLookup()
		}
	}

	if !e.user.HasActiveKey() {
		return nil, libkb.NoActiveKeyError{Username: e.user.GetName()}
	}

	ctx.IdentifyUI.ReportLastTrack(libkb.ExportTrackSummary(is.TrackLookup(), e.user.GetName()))

	e.G().Log.Debug("+ Identify(%s)", e.user.GetName())

	is.ComputeKeyDiffs(ctx.IdentifyUI.DisplayKey)
	is.InitResultList()
	is.ComputeTrackDiffs()
	is.ComputeRevokedProofs()

	ctx.IdentifyUI.LaunchNetworkChecks(res.ExportToUncheckedIdentity(), e.user.Export())
	e.user.IDTable().Identify(is, e.arg.ForceRemoteCheck, ctx.IdentifyUI)

	base := e.user.BaseProofSet()
	res.AddProofsToSet(base)
	if !e.userExpr.MatchSet(*base) {
		return nil, fmt.Errorf("User %s didn't match given assertion", e.user.GetName())
	}

	e.G().Log.Debug("- Identify(%s)", e.user.GetName())

	return res, nil
}