From a9c21190aa8249009ddb51574c365a6330a0d825 Mon Sep 17 00:00:00 2001 From: Patrick Zheng Date: Wed, 25 Dec 2024 13:13:01 +0800 Subject: [PATCH] fix docs Signed-off-by: Patrick Zheng --- example_signBlob_test.go | 9 +++++---- example_verifyBlob_test.go | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/example_signBlob_test.go b/example_signBlob_test.go index 35a12e0e..bb93e9de 100644 --- a/example_signBlob_test.go +++ b/example_signBlob_test.go @@ -24,7 +24,7 @@ import ( "github.com/notaryproject/notation-go/signer" ) -// ExampleSignBlob demonstrates how to use [signer.BlobSign] to sign arbitrary +// ExampleSignBlob demonstrates how to use [notation.SignBlob] to sign arbitrary // data. func Example_signBlob() { // exampleSigner implements [notation.Signer] and [notation.BlobSigner]. @@ -32,7 +32,7 @@ func Example_signBlob() { // artifacts or blobs. // Users should replace `exampleCertTuple.PrivateKey` with their own private // key and replace `exampleCerts` with the corresponding certificate chain, - //following the Notary Project certificate requirements: + // following the Notary Project certificate requirements: // https://github.com/notaryproject/notaryproject/blob/v1.0.0/specs/signature-specification.md#certificate-requirements exampleSigner, err := signer.NewGenericSigner(exampleCertTuple.PrivateKey, exampleCerts) if err != nil { @@ -44,7 +44,7 @@ func Example_signBlob() { exampleSignatureMediaType := jws.MediaTypeEnvelope exampleContentMediaType := "video/mp4" - // exampleSignOptions is an example of notation.SignBlobOptions. + // exampleSignOptions is an example of [notation.SignBlobOptions]. exampleSignOptions := notation.SignBlobOptions{ SignerSignOptions: notation.SignerSignOptions{ SignatureMediaType: exampleSignatureMediaType, @@ -54,7 +54,8 @@ func Example_signBlob() { UserMetadata: map[string]string{"buildId": "101"}, } - // exampleReader reads the data that needs to be signed. This data can be in a file or in memory. + // exampleReader reads the data that needs to be signed. + // This data can be in a file or in memory. exampleReader := strings.NewReader("example blob") // Upon successful signing, signature envelope and signerInfo are returned. diff --git a/example_verifyBlob_test.go b/example_verifyBlob_test.go index 06ad22e9..8fd64b1e 100644 --- a/example_verifyBlob_test.go +++ b/example_verifyBlob_test.go @@ -42,7 +42,7 @@ var exampleBlobPolicyDocument = trustpolicy.BlobDocument{ }, } -// ExampleVerifyBlob demonstrates how to use [verifier.Verify] to verify a +// ExampleVerifyBlob demonstrates how to use [notation.VerifyBlob] to verify a // signature of an arbitrary blob. func Example_verifyBlob() { // Both COSE ("application/cose") and JWS ("application/jose+json") @@ -53,7 +53,7 @@ func Example_verifyBlob() { exampleSignatureEnvelope := getSignatureEnvelope() // createTrustStoreForBlobVerify creates a trust store directory for demo purpose. - // Users could use the default trust store from Notation and add trusted + // Users could use the default trust store from Notary Project and add trusted // certificates into it following the trust store spec: // https://github.com/notaryproject/notaryproject/blob/v1.1.0/specs/trust-store-trust-policy.md#trust-store if err := createTrustStoreForBlobVerify(); err != nil { @@ -70,7 +70,7 @@ func Example_verifyBlob() { // This data can be in a file or in memory. exampleReader := strings.NewReader("example blob") - // exampleVerifyOptions is an example of [notation.VerifierVerifyOptions] + // exampleVerifyOptions is an example of [notation.VerifyBlobOptions] exampleVerifyOptions := notation.VerifyBlobOptions{ BlobVerifierVerifyOptions: notation.BlobVerifierVerifyOptions{ SignatureMediaType: exampleSignatureMediaType, @@ -92,7 +92,7 @@ func Example_verifyBlob() { // Note, upon successful verification, payload.TargetArtifact from the // signature envelope matches exactly with our exampleTargetDescriptor. - // (This check has been done for the user inside [verifier.Verify].) + // (This check has been done for the user inside verifier.Verify.) fmt.Println("payload Content:", string(outcome.EnvelopeContent.Payload.Content)) // Output: