0.5.0 • Published 6 months ago
@sigstore/oci v0.5.0
@sigstore/oci ·

Attach artifacts to images in OCI registries.
Prerequisites
- Node.js version >= 18.17.0
Installation
npm install @sigstore/ociUsage
const { attachArtifactToImage } = require('@sigstore/oci');import { attachArtifactToImage } from '@sigstore/oci';attachArtifactToImage(options)
Uploads the provided artifact to the registry and associates it with an OCI image.
optionsObjectartifactBuffer: Bytes of the artifact to upload.mediaTypestring: Content type to assign to the artifact.imageNamestring: Fully-qualified name of the image to which the artifact should be associated.imageDigeststring: Digest of the image to which the artifact should be associated. Should be of the form<alg>:<digest>.credentialsObjectusernamestring: Username to use when authenticating with the registry.passwordstring: Password to use when authenticating with the registry.
annotationsRecord<string, string>: Arbitrary name/value pairs to be associated with artifact.
getRegistryCredentials(imageName)
Reads the local $HOME/.docker/config.json file and returns the credentials associated with the image's registry.
imageNamestring: Fully-qualified name of the image from which to extract the registry hostname.
Returns a Credentials object with the following keys:
usernamestringpasswordstring
Throws if the Docker config cannot be located or if there are no credentials for the specified registry.