MCPcopy
hub / github.com/perkeep/perkeep / UploadPublicKey

Method UploadPublicKey

pkg/client/client.go:1404–1414  ·  view source on GitHub ↗

UploadPublicKey uploads the public key (if one is defined), so subsequent (likely synchronous) indexing of uploaded signed blobs will have access to the public key to verify it. In the normal case, the stat cache prevents this from doing anything anyway.

(ctx context.Context)

Source from the content-addressed store, hash-verified

1402// will have access to the public key to verify it. In the normal
1403// case, the stat cache prevents this from doing anything anyway.
1404func (c *Client) UploadPublicKey(ctx context.Context) error {
1405 sigRef := c.SignerPublicKeyBlobref()
1406 if !sigRef.Valid() {
1407 return nil
1408 }
1409 var err error
1410 if _, keyUploaded := c.haveCache.StatBlobCache(sigRef); !keyUploaded {
1411 _, err = c.uploadString(ctx, c.publicKeyArmored, false)
1412 }
1413 return err
1414}
1415
1416// checkMatchingKeys compares the client's and the server's keys and logs if they differ.
1417func (c *Client) checkMatchingKeys() {

Callers 4

UploadAndSignBlobMethod · 0.95
ImporterTestFunction · 0.45
mainFunction · 0.45

Calls 4

uploadStringMethod · 0.95
StatBlobCacheMethod · 0.65
ValidMethod · 0.45

Tested by

no test coverage detected