{"name":"@sigstore/sign","version":"4.0.1","author":{"name":"bdehamer@github.com"},"license":"Apache-2.0","_id":"@sigstore/sign@4.0.1","maintainers":[{"name":"mylesborins","email":"myles.borins@gmail.com"},{"name":"bdehamer","email":"brian@dehamer.com"}],"homepage":"https://github.com/sigstore/sigstore-js/tree/main/packages/sign#readme","bugs":{"url":"https://github.com/sigstore/sigstore-js/issues"},"dist":{"shasum":"36ed397d0528e4da880b9060e26234098de5d35b","tarball":"http://registry-npm.ywwl.com/@sigstore/sign/download/@sigstore/sign-4.0.1.tgz","fileCount":65,"integrity":"sha512-KFNGy01gx9Y3IBPG/CergxR9RZpN43N+lt3EozEfeoyqm8vEiLxwRl3ZO5sPx3Obv1ix/p7FWOlPc2Jgwfp9PA==","signatures":[{"sig":"MEUCIQCkStPNz6fCNYJqTVfxhKSoBCGUdsgjK25w6N8A9tKquwIgWfsxKjvxpDhQ58ax0l4Vj2Dy248pNpyw0vbA8asnE7c=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@sigstore%2fsign@4.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":85697,"size":20355,"noattachment":false,"key":"/@sigstore/sign/-/@sigstore/sign-4.0.1.tgz"},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":"^20.17.0 || >=22.9.0"},"gitHead":"83b349b02f28d4ef42193cf59ea4730b2236f645","scripts":{"test":"jest","build":"tsc --build","clean":"shx rm -rf dist *.tsbuildinfo"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:57beebb8-adda-434c-9637-ca55536c4289"}},"repository":{"url":"git+https://github.com/sigstore/sigstore-js.git","type":"git"},"_npmVersion":"11.6.1","description":"Sigstore signing library","directories":{},"_nodeVersion":"20.19.5","dependencies":{"proc-log":"^5.0.0","promise-retry":"^2.0.1","@sigstore/core":"^3.0.0","@sigstore/bundle":"^4.0.0","make-fetch-happen":"^15.0.2","@sigstore/protobuf-specs":"^0.5.0"},"publishConfig":{"provenance":true},"_hasShrinkwrap":false,"devDependencies":{"@sigstore/jest":"^0.0.0","@sigstore/mock":"^0.11.0","@types/promise-retry":"^1.1.6","@sigstore/rekor-types":"^4.0.0","@types/make-fetch-happen":"^10.0.4"},"_npmOperationalInternal":{"tmp":"tmp/sign_4.0.1_1758821954736_0.42020888697005754","host":"s3://npm-registry-packages-npm-production"},"readme":"# @sigstore/sign &middot; [![npm version](https://img.shields.io/npm/v/@sigstore/sign.svg?style=flat)](https://www.npmjs.com/package/@sigstore/sign) [![CI Status](https://github.com/sigstore/sigstore-js/workflows/CI/badge.svg)](https://github.com/sigstore/sigstore-js/actions/workflows/ci.yml) [![Smoke Test Status](https://github.com/sigstore/sigstore-js/workflows/smoke-test/badge.svg)](https://github.com/sigstore/sigstore-js/actions/workflows/smoke-test.yml)\n\nA library for generating [Sigstore][1] signatures.\n\n## Features\n\n- Support for keyless signature generation with [Fulcio][2]-issued signing\n  certificates\n- Support for ambient OIDC credential detection in CI/CD environments\n- Support for recording signatures to the [Rekor][3] transparency log\n- Support for requesting timestamped countersignature from a [Timestamp\n  Authority][4]\n\n## Prerequisites\n\n- Node.js version ^22.22.2 || ^24.15.0 || >=26.0.0\n\n## Installation\n\n```\nnpm install @sigstore/sign\n```\n\n## Overview\n\nThis library provides the building blocks for composing custom Sigstore signing\nworkflows.\n\n### BundleBuilder\n\nThe top-level component is the `BundleBuilder` which has responsibility for\ntaking some artifact and returning a [Sigstore bundle][5] containing the\nsignature for that artifact and the various materials necessary to verify that\nsignature.\n\n```typescript\ninterface BundleBuilder {\n  create: (artifact: Artifact) => Promise<Bundle>;\n}\n```\n\nThe artifact to be signed is simply an array of bytes and an optional mimetype.\nThe type is necessary when the signature is packaged as a [DSSE][6] envelope.\n\n```typescript\ntype Artifact = {\n  data: Buffer;\n  type?: string;\n};\n```\n\nThere are two `BundleBuilder` implementations provided as part of this package:\n\n- [`DSSEBundleBuilder`](./src/bundler/dsse.ts) - Combines the verification material and\n  artifact signature into a [`dsse_envelope`][7] -style Sigstore bundle\n- [`MessageBundleBuilder`](./src/bundler/message.ts) - Combines the verification\n  material and artifact signature into a [`message_signature`][8]-style Sigstore\n  bundle.\n\n### Signer\n\nEvery `BundleBuilder` must be instantiated with a `Signer` implementation. The\n`Signer` is responsible for taking a `Buffer` and returning an `Signature`.\n\n```typescript\ninterface Signer {\n  sign: (data: Buffer) => Promise<Signature>;\n}\n```\n\nThe returned `Signature` contains a signature and the public key which can be\nused to verify that signature -- the key may either take the form of a x509\ncertificate or public key.\n\n```typescript\ntype Signature = {\n  signature: Buffer;\n  key: KeyMaterial;\n};\n\ntype KeyMaterial =\n  | {\n      $case: 'x509Certificate';\n      certificate: string;\n    }\n  | {\n      $case: 'publicKey';\n      publicKey: string;\n      hint?: string;\n    };\n```\n\nThis package provides the [`FulcioSigner`](./src/signer/fulcio/index.ts)\nwhich implements the `Signer` interface and signs the artifact with an\nephemeral keypair. It will also retrieve an OIDC token from the configured\n`IdentityProvider` and then request a signing certificate from Fulcio which binds\nthe ephemeral key to the identity embedded in the token. This signing\ncertificate is returned as part of the `Signature`.\n\n### Witness\n\nThe `BundleBuilder` may also be configured with zero-or-more `Witness`\ninstances. Each `Witness` receives the artifact signature and the public key\nand returns an `VerificationMaterial` which represents some sort of\ncounter-signature for the artifact's signature.\n\n```typescript\ninterface Witness {\n  testify: (\n    signature: SignatureBundle,\n    publicKey: string\n  ) => Promise<VerificationMaterial>;\n}\n```\n\nThe returned `VerificationMaterial` may contain either Rekor transparency log\nentries or RFC3161 timestamps.\n\n```typescript\ntype VerificationMaterial = {\n  tlogEntries?: TransparencyLogEntry[];\n  rfc3161Timestamps?: RFC3161SignedTimestamp[];\n};\n```\n\nThe entries in the returned `VerificationMaterial` are automatically added to\nthe Sigstore `Bundle` by the `BundleBuilder`.\n\nThe package provides two different `Witness` implementations:\n\n- [`RekorWitness`](./src/witness/tlog/index.ts) - Adds an entry to the Rekor\n  transparency log and returns a `TransparencyLogEntry` to be included in the\n  `Bundle`\n- [`TSAWitness`](./src/witness/tsa/index.ts) - Requests an RFC3161 timestamp\n  over the artifact signature and returns an `RFC3161SignedTimestamp` to be\n  included in the `Bundle`\n\n## Usage Example\n\n```typescript\nconst {\n  CIContextProvider,\n  DSSEBundleBuilder,\n  FulcioSigner,\n  RekorWitness,\n  TSAWitness,\n} = require('@sigstore/sign');\n\n// Set-up the signer\nconst signer = new FulcioSigner({\n  fulcioBaseURL: 'https://fulcio.sigstore.dev',\n  identityProvider: new CIContextProvider('sigstore'),\n});\n\n// Set-up the witnesses\nconst rekorWitness = new RekorWitness({\n  rekorBaseURL: 'https://rekor.sigstore.dev',\n});\n\nconst tsaWitness = new TSAWitness({\n  tsaBaseURL: 'https://tsa.github.com',\n});\n\n// Instantiate a bundle builder\nconst bundler = new DSSEBundleBuilder({\n  signer,\n  witnesses: [rekorWitness, tsaWitness],\n});\n\n// Sign a thing\nconst artifact = {\n  type: 'text/plain',\n  data: Buffer.from('something to be signed'),\n};\nconst bundle = await bundler.create(artifact);\n```\n\n[1]: https://www.sigstore.dev\n[2]: https://github.com/sigstore/fulcio\n[3]: https://github.com/sigstore/rekor\n[4]: https://github.com/sigstore/timestamp-authority\n[5]: https://github.com/sigstore/protobuf-specs/blob/main/protos/sigstore_bundle.proto\n[6]: https://github.com/secure-systems-lab/dsse\n[7]: https://github.com/sigstore/protobuf-specs/blob/5ef54068bb534152474c5685f5cd248f38549fbd/protos/sigstore_bundle.proto#L80\n[8]: https://github.com/sigstore/protobuf-specs/blob/5ef54068bb534152474c5685f5cd248f38549fbd/protos/sigstore_bundle.proto#L74\n","publish_time":1758821954954,"_cnpm_publish_time":1758821954954,"dist-tags":{"latest":"5.1.0"}}