本文整理匯總了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"}
}