MCPcopy
hub / github.com/perkeep/perkeep / signAndSend

Method signAndSend

app/scanningcabinet/datastore.go:237–247  ·  view source on GitHub ↗

TODO(mpl): move that to client pkg, with a good API ?

(ctx context.Context, json string)

Source from the content-addressed store, hash-verified

235// TODO(mpl): move that to client pkg, with a good API ?
236
237func (h *handler) signAndSend(ctx context.Context, json string) error {
238 // TODO(mpl): sign things ourselves if we can.
239 scl, err := h.cl.Sign(ctx, h.server, strings.NewReader("json="+json))
240 if err != nil {
241 return fmt.Errorf("could not get signed claim %v: %v", json, err)
242 }
243 if _, err := h.cl.Upload(ctx, client.NewUploadHandleFromString(string(scl))); err != nil {
244 return fmt.Errorf("could not upload signed claim %v: %v", json, err)
245 }
246 return nil
247}
248
249func (h *handler) setAttribute(ctx context.Context, pn blob.Ref, attr, val string) error {
250 ucl, err := schema.NewSetAttributeClaim(pn, attr, val).SetSigner(h.signer).JSON()

Callers 4

setAttributeMethod · 0.95
delAttributeMethod · 0.95
addAttributeMethod · 0.95
deleteNodeMethod · 0.95

Calls 3

SignMethod · 0.45
UploadMethod · 0.45

Tested by

no test coverage detected