Skip to content

fix(crypto): accept a string algorithm in CryptoEngine.digest - #94

Merged
Mythie merged 1 commit into
LibPDF-js:mainfrom
CloudRaker:fix/digest-alg-string
Sep 16, 2026
Merged

Mythie merged 1 commit into
LibPDF-js:mainfrom
CloudRaker:fix/digest-alg-string

Conversation

@beaulac

@beaulac beaulac commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

CryptoEngine.digest base method takes SubtleCrypto's AlgorithmIdentifier = string | { name: string }, this makes the CryptoEngine's override consistent with this signature. TypeScript unfortunately does not catch this because it checks method parameters bivariantly even with strict on.

pkijs passes the digest algorithm as a bare string in several places when verifying signatures.

The override spread it, { ...algorithm }, which turns a string into array; Web Crypto then rejects it. Any pkijs verification after this engine is installed, i.e. after any sign, failed that way.

@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

@beaulac is attempting to deploy a commit to the mythie's projects Team on Vercel.

A member of the Team first needs to authorize it.

@beaulac
beaulac force-pushed the fix/digest-alg-string branch from a09c3ce to 65ca929 Compare September 14, 2026 13:53
@Mythie

Mythie commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

lgtm

@Mythie
Mythie merged commit bd3b3a6 into LibPDF-js:main Sep 16, 2026
3 of 5 checks passed
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.

2 participants