示例#1
0
文件: api.go 项目: Javantea/h0tb0x
func (this *ApiMgr) getWriter(w http.ResponseWriter, req *http.Request) {
	vars := mux.Vars(req)
	cid := vars["cid"]
	who := vars["who"]
	pubKey := this.GetWriter(cid, who)
	if pubKey == nil {
		this.sendError(w, http.StatusNotFound, "No such writer")
		return
	}
	json := WriterJson{
		Id:     who,
		PubKey: transfer.AsString(pubKey),
	}
	this.sendJson(w, json)
}
示例#2
0
文件: api.go 项目: Javantea/h0tb0x
func (this *ApiMgr) getWriters(w http.ResponseWriter, req *http.Request) {
	vars := mux.Vars(req)
	cid := vars["cid"]
	basisRec := this.SyncMgr.Get(sync.RTBasis, cid, "$")
	if basisRec == nil {
		this.sendError(w, http.StatusNotFound, "No such collection")
		return
	}
	rows := this.Db.MultiQuery("SELECT key, value FROM Object WHERE topic = ? AND type = ?",
		cid, sync.RTWriter)
	out := []WriterJson{}
	for rows.Next() {
		var json WriterJson
		var data []byte
		this.Db.Scan(rows, &json.Id, &data)
		if len(data) > 0 {
			json.PubKey = transfer.AsString(data)
			out = append(out, json)
		}
	}
	this.sendJson(w, out)
}
示例#3
0
文件: crypto.go 项目: Javantea/h0tb0x
// Converts to a string
func (this *Digest) String() string { return transfer.AsString(this) }