TODO(mpl): move that to client pkg, with a good API ?
()
| 281 | // TODO(mpl): move that to client pkg, with a good API ? |
| 282 | |
| 283 | func (h *handler) newPermanode() (blob.Ref, error) { |
| 284 | // TODO(mpl): sign things ourselves if we can. |
| 285 | var pn blob.Ref |
| 286 | upn, err := schema.NewUnsignedPermanode().SetSigner(h.signer).JSON() |
| 287 | if err != nil { |
| 288 | return pn, fmt.Errorf("could not create unsigned permanode: %v", err) |
| 289 | } |
| 290 | spn, err := h.cl.Sign(context.TODO(), h.server, strings.NewReader("json="+upn)) |
| 291 | if err != nil { |
| 292 | return pn, fmt.Errorf("could not get signed permanode: %v", err) |
| 293 | } |
| 294 | sbr, err := h.cl.Upload(context.TODO(), client.NewUploadHandleFromString(string(spn))) |
| 295 | if err != nil { |
| 296 | return pn, fmt.Errorf("could not upload permanode: %v", err) |
| 297 | } |
| 298 | return sbr.BlobRef, nil |
| 299 | } |
| 300 | |
| 301 | func (h *handler) createScan(ctx context.Context, mo mediaObject) (blob.Ref, error) { |
| 302 | pn, err := h.newPermanode() |
no test coverage detected