Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions js/sign/package-lock.json

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

6 changes: 3 additions & 3 deletions js/sign/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wbn-sign",
"version": "0.2.3",
"version": "0.2.4",
"description": "Signing tool to sign a web bundle with integrity block",
"homepage": "https://github.com/WICG/webpackage/tree/main/js/sign",
"main": "./lib/wbn-sign.cjs",
Expand All @@ -13,7 +13,7 @@
"scripts": {
"build": "npm run build:esm && npm run build:cjs",
"build:esm": "tsc",
"build:cjs": "esbuild --bundle --format=cjs --external:cborg --outfile=lib/wbn-sign.cjs src/wbn-sign.ts --platform=node",
"build:cjs": "esbuild --bundle --format=cjs --outfile=lib/wbn-sign.cjs src/wbn-sign.ts --platform=node",
"test": "jasmine tests/*.js tests/*.cjs",
"lint": "npx prettier --write . --ignore-unknown --config ./package.json"
},
Expand All @@ -40,7 +40,7 @@
"license": "W3C-20150513",
"dependencies": {
"base32-encode": "^2.0.0",
"cborg": "^4.0.0",
"cborg": "^4.2.14",
"commander": "^7.0.0",
"read": "^2.0.0"
},
Expand Down
6 changes: 3 additions & 3 deletions js/sign/src/signers/integrity-block-signer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import crypto, { KeyObject } from 'crypto';
import * as cborg from 'cborg';
import { encode } from 'cborg';
import { INTEGRITY_BLOCK_MAGIC, VERSION_B2 } from '../utils/constants.js';
import { checkDeterministic } from '../cbor/deterministic.js';
import {
Expand Down Expand Up @@ -40,7 +40,7 @@ export class IntegrityBlockSigner {
};

const ibCbor = integrityBlock.toCBOR();
const attrCbor = cborg.encode(newAttributes);
const attrCbor = encode(newAttributes);
checkDeterministic(ibCbor);
checkDeterministic(attrCbor);

Expand Down Expand Up @@ -175,7 +175,7 @@ export class IntegrityBlock {
}

toCBOR(): Uint8Array {
return cborg.encode([
return encode([
INTEGRITY_BLOCK_MAGIC,
VERSION_B2,
this.attributes,
Expand Down
2 changes: 1 addition & 1 deletion js/sign/src/wbn-sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export {
IntegrityBlock,
IntegrityBlockSigner,
} from './signers/integrity-block-signer.js';
export { WebBundleId } from './web-bundle-id.js';
export { WebBundleId, getBundleId } from './web-bundle-id.js';
export { parsePemKey, readPassphrase, getRawPublicKey } from './utils/utils.js';
4 changes: 2 additions & 2 deletions js/sign/src/web-bundle-id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
getSignatureType,
} from './utils/utils.js';
import { SignatureType } from './utils/constants.js';
import * as cborg from 'cborg';
import { decodeFirst } from 'cborg';

// Web Bundle ID is a base32-encoded (without padding) ed25519 public key
// transformed to lowercase. More information:
Expand Down Expand Up @@ -58,7 +58,7 @@ export class WebBundleId {

export function getBundleId(signedWebBundle: Uint8Array) {
try {
const decodedData = cborg.decodeFirst(signedWebBundle);
const decodedData = decodeFirst(signedWebBundle);

if (!decodedData[0] || !decodedData[0][2]) {
throw Error('Signed Web Bundle structure is invalid');
Expand Down