本文整理汇总了Golang中github.com/keybase/go-jsonw.NewInt64函数的典型用法代码示例。如果您正苦于以下问题:Golang NewInt64函数的具体用法?Golang NewInt64怎么用?Golang NewInt64使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewInt64函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: condenseRecord
func condenseRecord(l *libkb.TrackChainLink) (*jsonw.Wrapper, error) {
uid, err := l.GetTrackedUID()
if err != nil {
return nil, err
}
trackedKeys, err := l.GetTrackedKeys()
if err != nil {
return nil, err
}
fpsDisplay := make([]string, len(trackedKeys))
for i, trackedKey := range trackedKeys {
fpsDisplay[i] = strings.ToUpper(trackedKey.Fingerprint.String())
}
un, err := l.GetTrackedUsername()
if err != nil {
return nil, err
}
rp := l.RemoteKeyProofs()
out := jsonw.NewDictionary()
out.SetKey("uid", libkb.UIDWrapper(uid))
out.SetKey("keys", jsonw.NewString(strings.Join(fpsDisplay, ", ")))
out.SetKey("ctime", jsonw.NewInt64(l.GetCTime().Unix()))
out.SetKey("username", jsonw.NewString(un))
out.SetKey("proofs", rp)
return out, nil
}
示例2: save
func (s *Session) save() error {
mtime := time.Now()
s.GetDictionary().SetKey("mtime", jsonw.NewInt64(mtime.Unix()))
if err := s.file.Save(true, 0); err != nil {
return err
}
s.mtime = mtime
return nil
}
示例3: 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
}
示例4: 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
}
示例5: 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
}
示例6: Pack
func (c *ChainLink) Pack() error {
p := jsonw.NewDictionary()
// Store the original JSON string so its order is preserved
p.SetKey("payload_json", jsonw.NewString(c.unpacked.payloadJSONStr))
p.SetKey("sig", jsonw.NewString(c.unpacked.sig))
p.SetKey("sig_id", jsonw.NewString(string(c.unpacked.sigID)))
p.SetKey("kid", c.unpacked.kid.ToJsonw())
p.SetKey("ctime", jsonw.NewInt64(c.unpacked.ctime))
if c.unpacked.pgpFingerprint != nil {
p.SetKey("fingerprint", jsonw.NewString(c.unpacked.pgpFingerprint.String()))
}
p.SetKey("sig_verified", jsonw.NewBool(c.sigVerified))
p.SetKey("proof_text_full", jsonw.NewString(c.unpacked.proofText))
if c.cki != nil {
p.SetKey("computed_key_infos", jsonw.NewWrapper(*c.cki))
}
c.packed = p
return nil
}
示例7: 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
}