Example #1
0
func (c *Client) UploadAndSignBlob(b schema.AnyBlob) (*PutResult, error) {
	signed, err := c.SignBlob(b.Blob(), time.Time{})
	if err != nil {
		return nil, err
	}
	return c.uploadString(signed)
}
Example #2
0
func (up *Uploader) UploadAndSignBlob(b schema.AnyBlob) (*client.PutResult, error) {
	signed, err := up.SignBlob(b.Blob(), time.Time{})
	if err != nil {
		return nil, err
	}
	return up.uploadString(signed)
}
Example #3
0
func (c *Client) UploadAndSignBlob(b schema.AnyBlob) (*PutResult, error) {
	signed, err := c.signBlob(b.Blob(), time.Time{})
	if err != nil {
		return nil, err
	}
	c.checkMatchingKeys()
	if err := c.uploadPublicKey(); err != nil {
		return nil, err
	}
	return c.uploadString(signed, false)
}
Example #4
0
func (c *Client) UploadAndSignBlob(b schema.AnyBlob) (*PutResult, error) {
	signed, err := c.signBlob(b.Blob(), time.Time{})
	if err != nil {
		return nil, err
	}

	// sigRef is guaranteed valid at this point, because SignBlob
	// succeeded.  If we don't know for sure that the server
	// already has this public key, upload it.  And do it serially
	// so by the time we do the second upload of the signed blob,
	// any synchronous indexing on the server won't fail due to a
	// missing public key.
	sigRef := c.SignerPublicKeyBlobref()
	if _, keyUploaded := c.haveCache.StatBlobCache(sigRef); !keyUploaded {
		if _, err := c.uploadString(c.publicKeyArmored); err != nil {
			return nil, err
		}
	}

	return c.uploadString(signed)
}
Example #5
0
func (c *Client) UploadBlob(b schema.AnyBlob) (*PutResult, error) {
	// TODO(bradfitz): ask the blob for its own blobref, rather
	// than changing the hash function with uploadString?
	return c.uploadString(b.Blob().JSON())
}