当前位置: 首页>>代码示例>>Golang>>正文


Golang SigID.ToMediumID方法代码示例

本文整理汇总了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
}
开发者ID:keybase,项目名称:kbfs-beta,代码行数:28,代码来源:proof_support_hackernews.go

示例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
}
开发者ID:polluks,项目名称:client,代码行数:16,代码来源:services.go

示例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"}
}
开发者ID:polluks,项目名称:client,代码行数:20,代码来源:services.go


注:本文中的github.com/keybase/client/go/protocol.SigID.ToMediumID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。