本文整理汇总了Golang中github.com/keybase/client/go/libkb.GlobalContext.Trace方法的典型用法代码示例。如果您正苦于以下问题:Golang GlobalContext.Trace方法的具体用法?Golang GlobalContext.Trace怎么用?Golang GlobalContext.Trace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/keybase/client/go/libkb.GlobalContext
的用法示例。
在下文中一共展示了GlobalContext.Trace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: getUserCard
func getUserCard(g *libkb.GlobalContext, uid keybase1.UID, useSession bool) (ret *keybase1.UserCard, err error) {
defer g.Trace("getUserCard", func() error { return err })()
arg := libkb.APIArg{
Endpoint: "user/card",
NeedSession: useSession,
Contextified: libkb.NewContextified(g),
Args: libkb.HTTPArgs{"uid": libkb.S{Val: uid.String()}},
}
var card card
if err = g.API.GetDecode(arg, &card); err != nil {
g.Log.Warning("error getting user/card for %s: %s\n", uid, err)
return nil, err
}
g.Log.Debug("user card: %+v", card)
ret = &keybase1.UserCard{
Following: card.FollowSummary.Following,
Followers: card.FollowSummary.Followers,
Uid: uid,
FullName: card.Profile.FullName,
Location: card.Profile.Location,
Bio: card.Profile.Bio,
Website: card.Profile.Website,
Twitter: card.Profile.Twitter,
YouFollowThem: card.YouFollowThem,
TheyFollowYou: card.TheyFollowYou,
}
return ret, nil
}
示例2: UnboxBytes32Any
// UnboxBytes32Any will decrypt any of the KID, ciphertext, nonce
// bundles in arg.Bundles. Key preference order: cached device keys,
// cached paper keys, local device key, user-entered paper key.
// It returns the KID and bundle index along with the plaintext.
func UnboxBytes32Any(g *libkb.GlobalContext, secretUI libkb.SecretUI, arg keybase1.UnboxBytes32AnyArg) (res keybase1.UnboxAnyRes, err error) {
defer g.Trace("UnboxBytes32Any", func() error { return err })
// find a matching secret key for a bundle in arg.Bundles
key, index, err := getMatchingSecretKey(g, secretUI, arg)
if err != nil {
return res, err
}
// decrypt the bundle's ciphertext
plaintext, err := unboxBytes32(key, arg.Bundles[index].Ciphertext, arg.Bundles[index].Nonce, arg.Bundles[index].PublicKey)
if err != nil {
return res, err
}
// return plaintext, kid, and index
res.Plaintext = plaintext
res.Kid = key.GetKID()
res.Index = index
return res, nil
}