|
| 1 | +--- |
| 2 | +type: docs |
| 3 | +category: Go |
| 4 | +title: Go Client Overview |
| 5 | +weight: 5 |
| 6 | +--- |
| 7 | + |
| 8 | +[`sigstore-go`](https://pkg.go.dev/github.com/sigstore/sigstore-go) is the Go language client library for Sigstore. |
| 9 | + |
| 10 | +`sigstore-go` is intended as a minimal dependency library for signing and verifying. It's not intended to replace [cosign](../../cosign/signing/overview.md), which provides a CLI with many features for interacting with Sigstore. Over time, `cosign` will use `sigstore-go` for verification. |
| 11 | + |
| 12 | +- Friendly API for integrating Go code with Sigstore |
| 13 | +- Smaller dependency tree |
| 14 | +- Focuses on newly specified data structures in [sigstore/protobuf-specs](https://github.com/sigstore/protobuf-specs) |
| 15 | +- Perfect for simple signing and verififcation tasks |
| 16 | + |
| 17 | +`sigstore-go` is currently in beta. |
| 18 | + |
| 19 | +## Features |
| 20 | + |
| 21 | +- Signing and verification of [Sigstore bundles](https://github.com/sigstore/protobuf-specs/blob/main/protos/sigstore_bundle.proto) |
| 22 | +- Verification of raw Sigstore signatures |
| 23 | +- Signing and verifying with a Timestamp Authority (TSA) |
| 24 | +- Online and offline signing and verifying with Rekor (Artifact Transparency Log) |
| 25 | +- Structured verification results including certificate metadata |
| 26 | +- TUF support |
| 27 | +- Verification support for custom [trusted root](https://github.com/sigstore/protobuf-specs/blob/main/protos/sigstore_trustroot.proto) |
| 28 | +- Basic CLI |
| 29 | + |
| 30 | +## Installation |
| 31 | + |
| 32 | +### Main CLI installation |
| 33 | + |
| 34 | +`sigstore-go` requires Go 1.21 or greater. The package is tested with Go 1.23. |
| 35 | + |
| 36 | +To compile/install the CLI, clone [`sigstore-go`](https://github.com/sigstore/sigstore-go) and run. |
| 37 | + |
| 38 | +```console |
| 39 | +make install |
| 40 | +``` |
| 41 | + |
| 42 | +Alternatively, you can use `go run cmd/sigstore-go/main.go` to access the CLI, as show in the [example](#cli-example). |
| 43 | + |
| 44 | +## Example |
| 45 | + |
| 46 | +### CLI example |
| 47 | + |
| 48 | +The following is an example of using the sigstore-go CLI to verify a signature. |
| 49 | + |
| 50 | +```console |
| 51 | +go run cmd/sigstore-go/main.go \ |
| 52 | + -artifact-digest 76176ffa33808b54602c7c35de5c6e9a4deb96066dba6533f50ac234f4f1f4c6b3527515dc17c06fbe2860030f410eee69ea20079bd3a2c6f3dcf3b329b10751 \ |
| 53 | + -artifact-digest-algorithm sha512 \ |
| 54 | + -expectedIssuer https://token.actions.githubusercontent.com \ |
| 55 | + -expectedSAN https://github.com/sigstore/sigstore-js/.github/workflows/release.yml@refs/heads/main \ |
| 56 | + examples/bundle-provenance.json |
| 57 | +Verification successful! |
| 58 | +{ |
| 59 | + "version": 20230823, |
| 60 | + "statement": { |
| 61 | + "_type": "https://in-toto.io/Statement/v0.1", |
| 62 | + "predicateType": "https://slsa.dev/provenance/v0.2", |
| 63 | + "subject": ... |
| 64 | + }, |
| 65 | + ... |
| 66 | +} |
| 67 | +``` |
| 68 | + |
| 69 | +### Additional examples |
| 70 | + |
| 71 | +Additional examples are available in the [project documentation](https://github.com/sigstore/sigstore-go#sigstore-go). |
| 72 | + |
| 73 | +- [Signing example](https://github.com/sigstore/sigstore-go/blob/main/docs/signing.md#examples) |
| 74 | +- [Verifying example](https://github.com/sigstore/sigstore-go/blob/main/docs/verification.md#verification-using-sigstore-go) |
| 75 | +- [OCI image verifying example](https://github.com/sigstore/sigstore-go/blob/main/docs/oci-image-verification.md#example-of-oci-image-verification-using-sigstore-go) |
0 commit comments