Skip to content

feat(pq-key-fingerprint/ts): phase 1 - rebuild source API surface (ENG-1760)#22

Merged
eacet merged 2 commits intomainfrom
feature/eng-1760
Mar 10, 2026
Merged

feat(pq-key-fingerprint/ts): phase 1 - rebuild source API surface (ENG-1760)#22
eacet merged 2 commits intomainfrom
feature/eng-1760

Conversation

@eacet
Copy link
Copy Markdown
Member

@eacet eacet commented Mar 4, 2026

Summary

Package(s)

Languages

  • TypeScript
  • Rust

Checklist

  • Tests pass for all modified packages
  • Linting/formatting passes (biome check, cargo fmt)
  • Both language implementations are consistent (or noted as follow-up)
  • Package README updated if public API changed
  • No unnecessary dependencies added

Related Issues

@eacet
Copy link
Copy Markdown
Member Author

eacet commented Mar 4, 2026

@codex review

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 4, 2026

Greptile Summary

This PR establishes the Phase 1 API surface for pq-key-fingerprint by introducing the package's public types (types.ts) and error hierarchy (errors.ts), wiring up TypeScript project references between pq-key-fingerprint → pq-key-encoder → pq-oid, and bumping related package versions. No fingerprinting logic is implemented yet — this is purely a type/error scaffold.

Key changes:

  • New errors.ts defines a clean error hierarchy (FingerprintErrorInvalidFingerprintInputError, InvalidKeyTypeError, UnsupportedDigestError, RuntimeCapabilityError) with correct Object.setPrototypeOf usage in the base class.
  • New types.ts defines FingerprintInput, FingerprintResult, FingerprintOptions, and PublicKeyData; imports and re-exports relevant types from pq-key-encoder.
  • pq-key-encoder/ts/tsconfig.json gains composite: true to support project references.
  • pq-key-fingerprint/ts/tsconfig.json adds a references entry pointing to pq-key-encoder.
  • FingerprintOptions is declared as interface rather than type, violating the project's type-first convention.
  • FingerprintInput includes PQJwk (which is PQPublicJwk | PQPrivateJwk), meaning private JWKs are accepted at the type level; runtime validation via InvalidKeyTypeError is the only guard.

Confidence Score: 4/5

  • Safe to merge — this is a type/error-only scaffold with no runtime logic; issues are style-level.
  • No runtime logic is introduced, so there is no risk of behavioral regression. The two flagged items (interface vs type and the private-JWK leak in FingerprintInput) are style/design concerns rather than bugs. The project-reference wiring looks correct.
  • packages/pq-key-fingerprint/ts/src/types.ts deserves a second look for the interfacetype conversion and the PQJwk vs PQPublicJwk decision before the implementation phase builds on top of these types.

Important Files Changed

Filename Overview
packages/pq-key-fingerprint/ts/src/types.ts New types file defining the public API surface; two issues: FingerprintOptions uses interface instead of type (rule violation), and FingerprintInput admits PQPrivateJwk at the type level.
packages/pq-key-fingerprint/ts/src/errors.ts New error hierarchy rooted at FingerprintError; Object.setPrototypeOf(this, new.target.prototype) in the base class correctly propagates to subclasses via new.target. Looks solid.
packages/pq-key-fingerprint/ts/tsconfig.json Adds project reference to pq-key-encoder; missing composite: true which will be needed if this package is itself referenced downstream.
packages/pq-key-fingerprint/ts/src/index.ts Replaces stub export with barrel re-exports of errors and types; clean and correct.
packages/pq-key-fingerprint/ts/package.json Adds pq-key-encoder dependency, switches build to tsc -b, and adds a test script. All straightforward.
packages/pq-key-encoder/ts/tsconfig.json Adds composite: true to enable TypeScript project references — required for downstream packages to reference it.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    FI["FingerprintInput\n(PublicKeyInput | Uint8Array | string | PQJwk)"]
    PKI["PublicKeyInput\n(PublicKeyData | {alg, bytes})"]
    PKD["PublicKeyData\n(Omit<KeyData,'type'|'alg'> & {alg, type:'public'})"]
    PQJ["PQJwk\n(PQPublicJwk | PQPrivateJwk)"]
    FO["FingerprintOptions\n{digest?: FingerprintDigest, encoding?: FingerprintEncoding}"]
    FR["FingerprintResult\n(string | Uint8Array)"]

    FI --> PKI
    FI --> PQJ
    PKI --> PKD
    FO --> |"digest: SHA-256 | SHA-384 | SHA-512"| FR
    FO --> |"encoding: hex | base64 | base64url | bytes"| FR

    subgraph Errors
        FE["FingerprintError"]
        IFIE["InvalidFingerprintInputError"]
        IKTE["InvalidKeyTypeError"]
        UDE["UnsupportedDigestError"]
        RCE["RuntimeCapabilityError"]
        FE --> IFIE
        FE --> IKTE
        FE --> UDE
        FE --> RCE
    end
Loading

Last reviewed commit: c02e544

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@eacet eacet changed the title ENG-1760 Phase 1: rebuild source API surface feat(pq-key-fingerprint/ts): phase 1 - implement fingerprint core logic (ENG-1760) Mar 4, 2026
@eacet eacet changed the title feat(pq-key-fingerprint/ts): phase 1 - implement fingerprint core logic (ENG-1760) feat(pq-key-fingerprint/ts): phase 1 - rebuild source API surface (ENG-1760) Mar 4, 2026
"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.

@eacet eacet requested a review from snwfdhmp March 10, 2026 11:31
Copy link
Copy Markdown
Member Author

eacet commented Mar 10, 2026

Merge activity

  • Mar 10, 4:45 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 10, 4:45 PM UTC: @eacet merged this pull request with Graphite.

@eacet eacet merged commit f37e523 into main Mar 10, 2026
6 of 7 checks passed
@eacet eacet deleted the feature/eng-1760 branch March 10, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant