本文整理匯總了Golang中github.com/keybase/client/go/protocol.UserPlusKeys.Keys方法的典型用法代碼示例。如果您正苦於以下問題:Golang UserPlusKeys.Keys方法的具體用法?Golang UserPlusKeys.Keys怎麽用?Golang UserPlusKeys.Keys使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/keybase/client/go/protocol.UserPlusKeys
的用法示例。
在下文中一共展示了UserPlusKeys.Keys方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ExportToUserPlusKeys
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
}
示例2: filterKeys
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
}