Example #1
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
}
func (e *Identify2WithUID) createIdentifyState() (err error) {
	e.state = libkb.NewIdentifyState(nil, e.them)

	tcl, err := e.getTrackChainLink()
	if err != nil {
		return err
	}
	if tcl != nil {
		e.useTracking = true
		e.state.SetTrackLookup(tcl)
	}

	return nil
}
Example #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
}