示例#1
0
// checkUserByPGPFingerprint looks up a fingerprint on keybase.io.  If it
// finds a username for keyid, it loads that user.
func (e *LoginProvision) checkUserByPGPFingerprint(ctx *Context, fp *libkb.PGPFingerprint) error {
	// see if public key on keybase
	username, uid, err := libkb.PGPLookupFingerprint(e.G(), fp)
	if err != nil {
		e.G().Log.Debug("error finding user for fp %s: %s", fp, err)
		return err
	}
	e.G().Log.Debug("found user (%s, %s) for key %s", username, uid, fp)

	// if so, will have username from that
	e.arg.Username = username
	e.user, err = e.loadUser(ctx)
	if err != nil {
		return err
	}

	return nil
}
示例#2
0
// checkUserByPGPFingerprint looks up a fingerprint on keybase.io.  If it
// finds a username for keyid, it loads that user.
func (e *LoginProvision) checkUserByPGPFingerprint(ctx *Context, fp *libkb.PGPFingerprint) error {
	// see if public key on keybase
	username, uid, err := libkb.PGPLookupFingerprint(e.G(), fp)
	if err != nil {
		e.G().Log.Debug("error finding user for fp %s: %s", fp, err)
		if nfe, ok := err.(libkb.NotFoundError); ok {
			nfe.Msg = fmt.Sprintf("No keybase user found for PGP fingerprint %s; please try a different GPG key or another provisioning method", fp)
			err = nfe
		}
		return err
	}

	e.G().Log.Debug("found user (%q, %q) for key %s", username, uid, fp)

	// if so, will have username from that
	e.username = username
	e.user, err = e.loadUser(ctx)
	if err != nil {
		return err
	}

	return nil
}