本文整理汇总了Golang中github.com/keybase/go-jsonw.NewInt函数的典型用法代码示例。如果您正苦于以下问题:Golang NewInt函数的具体用法?Golang NewInt怎么用?Golang NewInt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewInt函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ToTrackingStatementBasics
func (u *User) ToTrackingStatementBasics(errp *error) *jsonw.Wrapper {
ret := jsonw.NewDictionary()
ret.SetKey("username", jsonw.NewString(u.name))
if lastIDChange, err := u.basics.AtKey("last_id_change").GetInt(); err == nil {
ret.SetKey("last_id_change", jsonw.NewInt(lastIDChange))
}
if idVersion, err := u.basics.AtKey("id_version").GetInt(); err == nil {
ret.SetKey("id_version", jsonw.NewInt(idVersion))
}
return ret
}
开发者ID:polluks,项目名称:client,代码行数:11,代码来源:kbsig.go
示例2: remoteProofToTrackingStatement
func remoteProofToTrackingStatement(s RemoteProofChainLink, base *jsonw.Wrapper) error {
typS := s.TableKey()
i, found := RemoteServiceTypes[typS]
if !found {
return fmt.Errorf("No service type found for %q in proof %d", typS, s.GetSeqno())
}
base.AtKey("remote_key_proof").SetKey("proof_type", jsonw.NewInt(int(i)))
base.AtKey("remote_key_proof").SetKey("check_data_json", s.CheckDataJSON())
base.SetKey("sig_type", jsonw.NewInt(SigTypeRemoteProof))
return nil
}
开发者ID:polluks,项目名称:client,代码行数:12,代码来源:kbsig.go
示例3: RevokeKeysProof
func (u *User) RevokeKeysProof(key GenericKey, kidsToRevoke []keybase1.KID, deviceToDisable keybase1.DeviceID) (*jsonw.Wrapper, error) {
ret, err := ProofMetadata{
Me: u,
LinkType: RevokeType,
SigningKey: key,
}.ToJSON(u.G())
if err != nil {
return nil, err
}
body := ret.AtKey("body")
revokeSection := jsonw.NewDictionary()
revokeSection.SetKey("kids", jsonw.NewWrapper(kidsToRevoke))
body.SetKey("revoke", revokeSection)
if deviceToDisable.Exists() {
device, err := u.GetDevice(deviceToDisable)
if err != nil {
return nil, err
}
deviceSection := jsonw.NewDictionary()
deviceSection.SetKey("id", jsonw.NewString(deviceToDisable.String()))
deviceSection.SetKey("type", jsonw.NewString(device.Type))
deviceSection.SetKey("status", jsonw.NewInt(DeviceStatusDefunct))
body.SetKey("device", deviceSection)
}
return ret, nil
}
开发者ID:polluks,项目名称:client,代码行数:26,代码来源:kbsig.go
示例4: UpdatePassphraseProof
func (u *User) UpdatePassphraseProof(key GenericKey, pwh string, ppGen PassphraseGeneration) (*jsonw.Wrapper, error) {
ret, err := ProofMetadata{
Me: u,
LinkType: UpdatePassphraseType,
SigningKey: key,
}.ToJSON(u.G())
if err != nil {
return nil, err
}
body := ret.AtKey("body")
pp := jsonw.NewDictionary()
pp.SetKey("hash", jsonw.NewString(pwh))
pp.SetKey("version", jsonw.NewInt(int(triplesec.Version)))
pp.SetKey("passphrase_generation", jsonw.NewInt(int(ppGen)))
body.SetKey("update_passphrase_hash", pp)
return ret, nil
}
开发者ID:polluks,项目名称:client,代码行数:17,代码来源:kbsig.go
示例5: ToSigJSON
func (mr *MerkleRoot) ToSigJSON() (ret *jsonw.Wrapper) {
ret = jsonw.NewDictionary()
ret.SetKey("seqno", jsonw.NewInt(int(mr.seqno)))
ret.SetKey("ctime", jsonw.NewInt64(mr.ctime))
ret.SetKey("hash", jsonw.NewString(mr.rootHash.String()))
return
}
开发者ID:paul-pearce,项目名称:client-beta,代码行数:9,代码来源:merkle_client.go
示例6: Pack
func (cr CheckResult) Pack() *jsonw.Wrapper {
p := jsonw.NewDictionary()
if cr.Status != nil {
s := jsonw.NewDictionary()
s.SetKey("code", jsonw.NewInt(int(cr.Status.GetProofStatus())))
s.SetKey("desc", jsonw.NewString(cr.Status.GetDesc()))
p.SetKey("status", s)
}
p.SetKey("time", jsonw.NewInt64(cr.Time.Unix()))
return p
}
开发者ID:moul,项目名称:client,代码行数:11,代码来源:proof_cache.go
示例7: MarshalToJSON
func (sh SigHints) MarshalToJSON() *jsonw.Wrapper {
ret := jsonw.NewDictionary()
ret.SetKey("version", jsonw.NewInt(sh.version))
ret.SetKey("hints", jsonw.NewArray(len(sh.hints)))
i := 0
for _, v := range sh.hints {
ret.AtKey("hints").SetIndex(i, v.MarshalToJSON())
i++
}
return ret
}
开发者ID:paul-pearce,项目名称:client-beta,代码行数:11,代码来源:sig_hints.go
示例8: ToTrackingStatementSeqTail
func (u *User) ToTrackingStatementSeqTail() *jsonw.Wrapper {
mul := u.GetPublicChainTail()
if mul == nil {
return jsonw.NewNil()
}
ret := jsonw.NewDictionary()
ret.SetKey("sig_id", jsonw.NewString(mul.SigID.ToString(true)))
ret.SetKey("seqno", jsonw.NewInt(int(mul.Seqno)))
ret.SetKey("payload_hash", jsonw.NewString(mul.LinkID.String()))
return ret
}
开发者ID:qbit,项目名称:client,代码行数:11,代码来源:kbsig.go
示例9: BaseToTrackingStatement
func (g *GenericChainLink) BaseToTrackingStatement(state keybase1.ProofState) *jsonw.Wrapper {
ret := jsonw.NewDictionary()
ret.SetKey("curr", jsonw.NewString(g.id.String()))
ret.SetKey("sig_id", jsonw.NewString(g.GetSigID().ToString(true)))
rkp := jsonw.NewDictionary()
ret.SetKey("remote_key_proof", rkp)
rkp.SetKey("state", jsonw.NewInt(int(state)))
prev := g.GetPrev()
var prevVal *jsonw.Wrapper
if prev == nil {
prevVal = jsonw.NewNil()
} else {
prevVal = jsonw.NewString(prev.String())
}
ret.SetKey("prev", prevVal)
ret.SetKey("ctime", jsonw.NewInt64(g.unpacked.ctime))
ret.SetKey("etime", jsonw.NewInt64(g.unpacked.etime))
return ret
}
开发者ID:polluks,项目名称:client,代码行数:22,代码来源:kbsig.go
示例10: ToJSON
func (arg ProofMetadata) ToJSON(g *GlobalContext) (ret *jsonw.Wrapper, err error) {
// if only Me exists, then that is the signing user too
if arg.SigningUser == nil && arg.Me != nil {
arg.SigningUser = arg.Me
}
var seqno int
var prev *jsonw.Wrapper
if arg.LastSeqno > 0 {
seqno = int(arg.LastSeqno) + 1
prev = jsonw.NewString(arg.PrevLinkID.String())
} else {
lastSeqno := arg.Me.sigChain().GetLastKnownSeqno()
lastLink := arg.Me.sigChain().GetLastKnownID()
if lastLink == nil {
seqno = 1
prev = jsonw.NewNil()
} else {
seqno = int(lastSeqno) + 1
prev = jsonw.NewString(lastLink.String())
}
}
ctime := arg.CreationTime
if ctime == 0 {
ctime = time.Now().Unix()
}
ei := arg.ExpireIn
if ei == 0 {
ei = SigExpireIn
}
ret = jsonw.NewDictionary()
ret.SetKey("tag", jsonw.NewString("signature"))
ret.SetKey("ctime", jsonw.NewInt64(ctime))
ret.SetKey("expire_in", jsonw.NewInt(ei))
ret.SetKey("seqno", jsonw.NewInt(seqno))
ret.SetKey("prev", prev)
eldest := arg.Eldest
if eldest == "" {
eldest = arg.Me.GetEldestKID()
}
body := jsonw.NewDictionary()
body.SetKey("version", jsonw.NewInt(KeybaseSignatureV1))
body.SetKey("type", jsonw.NewString(string(arg.LinkType)))
key, err := KeySection{
Key: arg.SigningKey,
EldestKID: eldest,
SigningUser: arg.SigningUser,
IncludePGPHash: arg.IncludePGPHash,
}.ToJSON()
if err != nil {
return nil, err
}
body.SetKey("key", key)
ret.SetKey("body", body)
// Capture the most recent Merkle Root and also what kind of client
// we're running.
ret.SetKey("client", clientInfo(g))
if mr := merkleRootInfo(g); mr != nil {
ret.SetKey("merkle_root", mr)
}
return
}
开发者ID:polluks,项目名称:client,代码行数:73,代码来源:kbsig.go
注:本文中的github.com/keybase/go-jsonw.NewInt函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论