Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 5 additions & 2 deletions bun.lock

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

1 change: 1 addition & 0 deletions packages/pq-key-encoder/ts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"module": "ESNext",
"moduleResolution": "bundler",
"declaration": true,
"composite": true,
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
Expand Down
6 changes: 5 additions & 1 deletion packages/pq-key-fingerprint/ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"dist"
],
"scripts": {
"build": "tsc",
"build": "tsc -b",
"test": "bun test",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the 'test': 'bun test' script since no test files exist yet. The bun test runner fails when it cannot find any files with test naming conventions (.test, test, .spec, spec). This script should be added back when actual test files are implemented.

Spotted by Graphite (based on CI logs)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

"prepublishOnly": "npm run build"
},
"keywords": [
Expand All @@ -19,6 +20,9 @@
],
"author": "",
"license": "MIT",
"dependencies": {
"pq-key-encoder": "^1.0.3"
},
"devDependencies": {
"typescript": "^5.0.0"
}
Expand Down
40 changes: 40 additions & 0 deletions packages/pq-key-fingerprint/ts/src/errors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/** Base error for pq-key-fingerprint failures. */
export class FingerprintError extends Error {
constructor(message: string) {
super(message);
this.name = 'FingerprintError';
Object.setPrototypeOf(this, new.target.prototype);
}
}

/** Error for invalid or missing fingerprint input values. */
export class InvalidFingerprintInputError extends FingerprintError {
constructor(message: string) {
super(message);
this.name = 'InvalidFingerprintInputError';
}
}

/** Error for key-type mismatches, such as passing private keys. */
export class InvalidKeyTypeError extends FingerprintError {
constructor(message: string) {
super(message);
this.name = 'InvalidKeyTypeError';
}
}

/** Error for unsupported digest algorithm selections. */
export class UnsupportedDigestError extends FingerprintError {
constructor(message: string) {
super(message);
this.name = 'UnsupportedDigestError';
}
}

/** Error for missing runtime cryptographic capabilities. */
export class RuntimeCapabilityError extends FingerprintError {
constructor(message: string) {
super(message);
this.name = 'RuntimeCapabilityError';
}
}
6 changes: 2 additions & 4 deletions packages/pq-key-fingerprint/ts/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
// pq-key-fingerprint - Generate fingerprints/hashes of PQ public keys
// Implementation coming soon

export {};
export * from './errors';
export * from './types';
23 changes: 23 additions & 0 deletions packages/pq-key-fingerprint/ts/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type { AlgorithmName as EncoderAlgorithmName, KeyData, PQJwk } from 'pq-key-encoder';

export type { AlgorithmName } from 'pq-key-encoder';

export type FingerprintDigest = 'SHA-256' | 'SHA-384' | 'SHA-512';

export type FingerprintEncoding = 'hex' | 'base64' | 'base64url' | 'bytes';

export interface FingerprintOptions {
digest?: FingerprintDigest;
encoding?: FingerprintEncoding;
}
Comment thread
eacet marked this conversation as resolved.

export type PublicKeyData = Omit<KeyData, 'type' | 'alg'> & {
alg: EncoderAlgorithmName;
type: 'public';
};

export type PublicKeyInput = PublicKeyData | { alg: EncoderAlgorithmName; bytes: Uint8Array };

export type FingerprintInput = PublicKeyInput | Uint8Array | string | PQJwk;
Comment thread
eacet marked this conversation as resolved.

export type FingerprintResult = string | Uint8Array;
1 change: 1 addition & 0 deletions packages/pq-key-fingerprint/ts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"esModuleInterop": true,
"skipLibCheck": true
},
"references": [{ "path": "../../pq-key-encoder/ts" }],
Comment thread
eacet marked this conversation as resolved.
"include": ["src"]
}
Loading