Skip to content

Commit

Permalink
extract verification code into separate package (#886)
Browse files Browse the repository at this point in the history
Signed-off-by: Brian DeHamer <[email protected]>
  • Loading branch information
bdehamer authored Dec 6, 2023
1 parent 3a3deeb commit 6f9c662
Show file tree
Hide file tree
Showing 57 changed files with 5,948 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/swift-balloons-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sigstore/verify': minor
---

Extract verification code into dedicated package
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
dist
**/__generated__
**/__fixtures__
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- os: ubuntu-latest
shell: bash
jest-cache: /tmp/jest
- os: macos-latest
- os: macos-latest-large
shell: bash
jest-cache: /tmp/jest
- os: windows-latest
Expand Down
40 changes: 40 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions packages/core/src/dsse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ const PAE_PREFIX = 'DSSEv1';

// DSSE Pre-Authentication Encoding
export function preAuthEncoding(payloadType: string, payload: Buffer): Buffer {
const prefix = Buffer.from(
`${PAE_PREFIX} ${payloadType.length} ${payloadType} ${payload.length} `,
'ascii'
);
return Buffer.concat([prefix, payload]);
const prefix = [
PAE_PREFIX,
payloadType.length,
payloadType,
payload.length,
'',
].join(' ');

return Buffer.concat([Buffer.from(prefix, 'ascii'), payload]);
}
3 changes: 2 additions & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ export * as dsse from './dsse';
export * as encoding from './encoding';
export * as json from './json';
export * as pem from './pem';
export { X509Certificate } from './x509';
export { ByteStream } from './stream';
export { EXTENSION_OID_SCT, X509Certificate, X509SCTExtension } from './x509';
3 changes: 2 additions & 1 deletion packages/core/src/x509/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

export { X509Certificate } from './cert';
export { EXTENSION_OID_SCT, X509Certificate } from './cert';
export { X509SCTExtension } from './ext';
9 changes: 9 additions & 0 deletions packages/verify/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# @sigstore/verify &middot; [![npm version](https://img.shields.io/npm/v/@sigstore/verify.svg?style=flat)](https://www.npmjs.com/package/@sigstore/verify) [![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)

A library for verifying [Sigstore][1] signatures.

## Prerequisites

- Node.js version >= 16.14.0

[1]: https://www.sigstore.dev
27 changes: 27 additions & 0 deletions packages/verify/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
Copyright 2022 The Sigstore Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
const base = require('../../jest.config.base');

module.exports = {
...base,
displayName: 'verify',
setupFilesAfterEnv: ['@sigstore/jest/all'],
testPathIgnorePatterns: [
'<rootDir>/dist/',
'<rootDir>/src/__tests__/__fixtures__',
],
coveragePathIgnorePatterns: ['__fixtures__'],
};
36 changes: 36 additions & 0 deletions packages/verify/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "@sigstore/verify",
"version": "0.0.0",
"description": "Verification of Sigstore signatures",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"clean": "shx rm -rf dist *.tsbuildinfo",
"build": "tsc --build",
"test": "jest"
},
"files": [
"dist"
],
"author": "[email protected]",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/sigstore/sigstore-js.git"
},
"bugs": {
"url": "https://github.com/sigstore/sigstore-js/issues"
},
"homepage": "https://github.com/sigstore/sigstore-js/tree/main/packages/verify#readme",
"publishConfig": {
"provenance": true
},
"dependencies": {
"@sigstore/protobuf-specs": "^0.1.0",
"@sigstore/bundle": "^2.1.0",
"@sigstore/core": "^0.1.0"
},
"engines": {
"node": "^16.14.0 || >=18.0.0"
}
}
Loading

0 comments on commit 6f9c662

Please sign in to comment.