本文整理汇总了Golang中github.com/keybase/client/go/protocol.DeviceID类的典型用法代码示例。如果您正苦于以下问题:Golang DeviceID类的具体用法?Golang DeviceID怎么用?Golang DeviceID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DeviceID类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: RevokeKeysProof
func (u *User) RevokeKeysProof(key GenericKey, kidsToRevoke []keybase1.KID, deviceToDisable keybase1.DeviceID) (*jsonw.Wrapper, error) {
ret, err := ProofMetadata{
Me: u,
LinkType: RevokeType,
SigningKey: key,
}.ToJSON(u.G())
if err != nil {
return nil, err
}
body := ret.AtKey("body")
revokeSection := jsonw.NewDictionary()
revokeSection.SetKey("kids", jsonw.NewWrapper(kidsToRevoke))
body.SetKey("revoke", revokeSection)
if deviceToDisable.Exists() {
device, err := u.GetDevice(deviceToDisable)
if err != nil {
return nil, err
}
deviceSection := jsonw.NewDictionary()
deviceSection.SetKey("id", jsonw.NewString(deviceToDisable.String()))
deviceSection.SetKey("type", jsonw.NewString(device.Type))
deviceSection.SetKey("status", jsonw.NewInt(DeviceStatusDefunct))
body.SetKey("device", deviceSection)
}
return ret, nil
}
示例2: PostDeviceLKS
func PostDeviceLKS(sr SessionReader, deviceID keybase1.DeviceID, deviceType string, serverHalf []byte,
ppGen PassphraseGeneration,
clientHalfRecovery string, clientHalfRecoveryKID keybase1.KID) error {
if len(serverHalf) == 0 {
return fmt.Errorf("PostDeviceLKS: called with empty serverHalf")
}
if ppGen < 1 {
G.Log.Warning("PostDeviceLKS: ppGen < 1 (%d)", ppGen)
debug.PrintStack()
}
arg := APIArg{
Endpoint: "device/update",
NeedSession: true,
Args: HTTPArgs{
"device_id": S{Val: deviceID.String()},
"type": S{Val: deviceType},
"lks_server_half": S{Val: hex.EncodeToString(serverHalf)},
"ppgen": I{Val: int(ppGen)},
"lks_client_half": S{Val: clientHalfRecovery},
"kid": S{Val: clientHalfRecoveryKID.String()},
},
SessionR: sr,
}
_, err := G.API.Post(arg)
return err
}
示例3: SetLoggedIn
func (s *Session) SetLoggedIn(sessionID, csrfToken string, username NormalizedUsername, uid keybase1.UID, deviceID keybase1.DeviceID) error {
s.valid = true
s.uid = uid
s.username = &username
s.token = sessionID
if s.file == nil {
G.Log.Warning("s.file == nil")
if err := s.Load(); err != nil {
return err
}
}
if s.GetDictionary() == nil {
G.Log.Warning("s.GetDict() == nil")
}
s.GetDictionary().SetKey("session", jsonw.NewString(sessionID))
s.SetCsrf(csrfToken)
s.deviceID = deviceID
if s.file == nil {
return errors.New("no session file")
}
s.GetDictionary().SetKey("device_provisioned", jsonw.NewString(deviceID.String()))
return s.save()
}
示例4: SetDeviceProvisioned
func (s *Session) SetDeviceProvisioned(devid keybase1.DeviceID) error {
s.G().Log.Debug("Local Session: setting provisioned device id: %s", devid)
s.deviceID = devid
if s.file == nil {
return errors.New("no session file")
}
s.GetDictionary().SetKey("device_provisioned", jsonw.NewString(devid.String()))
return s.save()
}
示例5: SetDevice
func (u *UserConfig) SetDevice(d keybase1.DeviceID) {
u.importedDeviceID = d
var s *string
if d.Exists() {
tmp := d.String()
s = &tmp
}
u.Device = s
return
}
示例6: SaveStateTmp
// SaveStateTmp saves the logins state to memory, and to a
// temporary config file.
func (a *Account) SaveStateTmp(sessionID, csrf string, username NormalizedUsername, uid keybase1.UID, deviceID keybase1.DeviceID) (filename string, err error) {
saver := func(cw ConfigWriter) error {
var serr error
filename, serr = cw.SaveTmp(deviceID.String())
return serr
}
if err := a.saveState(sessionID, csrf, username, uid, deviceID, saver); err != nil {
return "", err
}
return filename, nil
}
示例7: NewUserConfig
func NewUserConfig(id keybase1.UID, name NormalizedUsername, salt []byte, dev keybase1.DeviceID) *UserConfig {
ret := &UserConfig{
ID: id.String(),
Name: name,
Salt: hex.EncodeToString(salt),
Device: nil,
importedID: id,
importedSalt: salt,
importedDeviceID: dev,
}
if dev.Exists() {
tmp := dev.String()
ret.Device = &tmp
}
return ret
}