func (u *User) ExportToUserPlusKeys(idTime keybase1.Time) keybase1.UserPlusKeys { ret := keybase1.UserPlusKeys{ Uid: u.GetUID(), Username: u.GetName(), } ckf := u.GetComputedKeyFamily() if ckf != nil { // DeviceKeys is poorly named, so let's deprecate it. ret.DeviceKeys = ckf.Export() ret.Keys = ret.DeviceKeys } ret.Uvv = u.ExportToVersionVector(idTime) return ret }
func (e *DeviceKeyfinder) filterKeys(upk *keybase1.UserPlusKeys) error { var keys []keybase1.PublicKey hasPGP := false for _, key := range upk.Keys { if len(key.PGPFingerprint) != 0 { hasPGP = true continue } if e.arg.NeedVerifyKeys && !libkb.KIDIsDeviceVerify(key.KID) { continue } if e.arg.NeedEncryptKeys && !libkb.KIDIsDeviceEncrypt(key.KID) { continue } keys = append(keys, key) } if len(keys) == 0 { return libkb.NoNaClEncryptionKeyError{User: upk.Username, HasPGPKey: hasPGP} } upk.Keys = keys return nil }