Exemple #1
0
func (ph *PublishHandler) signUpload(jsonSign *signhandler.Handler, name string, bb *schema.Builder) (blob.Ref, error) {
	signed, err := jsonSign.Sign(bb)
	if err != nil {
		return blob.Ref{}, fmt.Errorf("error signing %s: %v", name, err)
	}
	uh := client.NewUploadHandleFromString(signed)
	_, err = ph.Storage.ReceiveBlob(uh.BlobRef, uh.Contents)
	if err != nil {
		return blob.Ref{}, fmt.Errorf("error uploading %s: %v", name, err)
	}
	return uh.BlobRef, nil
}
Exemple #2
0
func (ph *PublishHandler) signUpload(jsonSign *signhandler.Handler, name string, m map[string]interface{}) (*blobref.BlobRef, error) {
	signed, err := jsonSign.SignMap(m)
	if err != nil {
		return nil, fmt.Errorf("error signing %s: %v", name, err)
	}
	uh := client.NewUploadHandleFromString(signed)
	_, err = ph.Storage.ReceiveBlob(uh.BlobRef, uh.Contents)
	if err != nil {
		return nil, fmt.Errorf("error uploading %s: %v", name, err)
	}
	return uh.BlobRef, nil
}