本文整理汇总了Golang中github.com/keybase/client/go/protocol.UID.Equal方法的典型用法代码示例。如果您正苦于以下问题:Golang UID.Equal方法的具体用法?Golang UID.Equal怎么用?Golang UID.Equal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/keybase/client/go/protocol.UID
的用法示例。
在下文中一共展示了UID.Equal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: identifySender
func (e *SaltpackSenderIdentify) identifySender(ctx *Context) (err error) {
defer e.G().Trace("SaltpackDecrypt::identifySender", func() error { return err })()
var lin bool
var uid keybase1.UID
if lin, uid, err = IsLoggedIn(e, ctx); err == nil && lin && uid.Equal(e.res.Uid) {
e.G().Log.Debug("| Sender is self")
e.res.SenderType = keybase1.SaltpackSenderType_SELF
return nil
}
iarg := keybase1.Identify2Arg{
Uid: e.res.Uid,
UseDelegateUI: !e.arg.interactive,
AlwaysBlock: e.arg.interactive,
ForceRemoteCheck: e.arg.forceRemoteCheck,
NoErrorOnTrackFailure: true,
Reason: e.arg.reason,
UserAssertion: e.arg.userAssertion,
}
eng := NewIdentify2WithUID(e.G(), &iarg)
if err = RunEngine(eng, ctx); err != nil {
return err
}
switch eng.getTrackType() {
case identify2NoTrack:
e.res.SenderType = keybase1.SaltpackSenderType_NOT_TRACKED
case identify2TrackOK:
e.res.SenderType = keybase1.SaltpackSenderType_TRACKING_OK
default:
e.res.SenderType = keybase1.SaltpackSenderType_TRACKING_BROKE
}
return nil
}
示例2: LoadFromServer
func (sc *SigChain) LoadFromServer(t *MerkleTriple, selfUID keybase1.UID) (dirtyTail *MerkleTriple, err error) {
low := sc.GetLastLoadedSeqno()
sc.loadedFromLinkOne = (low == Seqno(0) || low == Seqno(-1))
sc.G().Log.Debug("+ Load SigChain from server (uid=%s, low=%d)", sc.uid, low)
defer func() { sc.G().Log.Debug("- Loaded SigChain -> %s", ErrToOk(err)) }()
res, err := G.API.Get(APIArg{
Endpoint: "sig/get",
NeedSession: false,
Args: HTTPArgs{
"uid": UIDArg(sc.uid),
"low": I{int(low)},
},
})
if err != nil {
return
}
v := res.Body.AtKey("sigs")
var lim int
if lim, err = v.Len(); err != nil {
return
}
foundTail := false
sc.G().Log.Debug("| Got back %d new entries", lim)
var links []*ChainLink
var tail *ChainLink
for i := 0; i < lim; i++ {
var link *ChainLink
if link, err = ImportLinkFromServer(sc.G(), sc, v.AtIndex(i), selfUID); err != nil {
return
}
if link.GetSeqno() <= low {
continue
}
if selfUID.Equal(link.GetUID()) {
sc.G().Log.Debug("| Setting isOwnNewLinkFromServer=true for seqno %d", link.GetSeqno())
link.isOwnNewLinkFromServer = true
}
links = append(links, link)
if !foundTail && t != nil {
if foundTail, err = link.checkAgainstMerkleTree(t); err != nil {
return
}
}
tail = link
}
if t != nil && !foundTail {
err = NewServerChainError("Failed to reach (%s, %d) in server response",
t.LinkID, int(t.Seqno))
return
}
if tail != nil {
dirtyTail = tail.ToMerkleTriple()
// If we've stored a `last` and it's less than the one
// we just loaded, then nuke it.
if sc.localChainTail != nil && sc.localChainTail.Less(*dirtyTail) {
sc.G().Log.Debug("| Clear cached last (%d < %d)", sc.localChainTail.Seqno, dirtyTail.Seqno)
sc.localChainTail = nil
sc.localCki = nil
}
}
sc.chainLinks = append(sc.chainLinks, links...)
return
}