本文整理汇总了Golang中github.com/keybase/client/go/protocol.SigID.ToMediumID方法的典型用法代码示例。如果您正苦于以下问题:Golang SigID.ToMediumID方法的具体用法?Golang SigID.ToMediumID怎么用?Golang SigID.ToMediumID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/keybase/client/go/protocol.SigID
的用法示例。
在下文中一共展示了SigID.ToMediumID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: CheckStatus
func (h *HackerNewsChecker) CheckStatus(hint SigHint) ProofError {
res, err := G.XAPI.GetText(APIArg{
Endpoint: hint.apiURL,
NeedSession: false,
})
if err != nil {
return XapiError(err, hint.apiURL)
}
var sigID keybase1.SigID
_, sigID, err = OpenSig(h.proof.GetArmoredSig())
var ret ProofError
if err != nil {
return NewProofError(keybase1.ProofStatus_BAD_SIGNATURE,
"Bad signature: %s", err)
}
wanted := sigID.ToMediumID()
G.Log.Debug("| HackerNews profile: %s", res.Body)
G.Log.Debug("| Wanted signature hash: %s", wanted)
if !strings.Contains(res.Body, wanted) {
ret = NewProofError(keybase1.ProofStatus_TEXT_NOT_FOUND,
"Posted text does not include signature '%s'", wanted)
}
return ret
}
示例2: BaseCheckProofForURL
func (t BaseServiceType) BaseCheckProofForURL(text string, id keybase1.SigID) (err error) {
urlRxx := regexp.MustCompile(`https://(\S+)`)
target := id.ToMediumID()
urls := urlRxx.FindAllString(text, -1)
G.Log.Debug("Found urls %v", urls)
found := false
for _, u := range urls {
if strings.HasSuffix(u, target) {
found = true
}
}
if !found {
err = NotFoundError{"Didn't find a URL with suffix '" + target + "'"}
}
return
}
示例3: BaseCheckProofTextShort
func (t BaseServiceType) BaseCheckProofTextShort(text string, id keybase1.SigID, med bool) error {
blocks := FindBase64Snippets(text)
var target string
if med {
target = id.ToMediumID()
} else {
target = id.ToShortID()
}
for _, b := range blocks {
if len(b) < len(target) {
continue
}
if b != target {
return WrongSigError{b}
}
// found match:
return nil
}
return NotFoundError{"Couldn't find signature ID " + target + " in text"}
}