-
-
Notifications
You must be signed in to change notification settings - Fork 91
Open
Labels
breaking changeBreaking changeBreaking changecomponent/buildBuild system and packagingBuild system and packagingcomponent/federationFederation object relatedFederation object relatedcomponent/signaturesOIP or HTTP/LD Signatures relatedOIP or HTTP/LD Signatures relatedtype/bugSomething isn't workingSomething isn't working
Description
Summary
I use some node:crypto methods (webcrypto) to handle some key-related logic alongside fedify.
When I upgrade @types/node to version >=24.7.0, I start seeing type errors.
This is likely an incompatibility between types used by Fedify (Deno or DOM), and Node.js, which introduces crypto.subtle.decapsulateBits in v24.7.0.
Workaround
- Don't upgrade @types/node beyond v24.6.2, or
- Assert results of methods from
node:cryptoe.g.(await crypto.subtle.importKey(/*....*/)) as CryptoKey.
This issue is not pressing.
Expected Behavior
I'd expect these type errors not to be present.
Actual Behavior
I use some node:crypto methods (webcrypto) to handle some key-related logic.
When I upgrade @types/node to version >=24.7.0, I start seeing type errors like:
error TS2345: Argument of type '(ctx: Context<ContextData>) => Promise<{ privateKey: CryptoKey; publicKey: CryptoKey; }[]>' is not assignable to parameter of type 'ActorKeyPairsDispatcher<ContextData>'.
Type 'Promise<{ privateKey: CryptoKey; publicKey: CryptoKey; }[]>' is not assignable to type 'CryptoKeyPair[] | Promise<CryptoKeyPair[]>'.
Type 'Promise<{ privateKey: CryptoKey; publicKey: CryptoKey; }[]>' is not assignable to type 'Promise<CryptoKeyPair[]>'.
Type '{ privateKey: CryptoKey; publicKey: CryptoKey; }[]' is not assignable to type 'CryptoKeyPair[]'.
Type '{ privateKey: webcrypto.CryptoKey; publicKey: CryptoKey; }' is not assignable to type 'CryptoKeyPair'.
The types of 'privateKey.usages' are incompatible between these types.
Type 'import("node:crypto").webcrypto.KeyUsage[]' is not assignable to type 'KeyUsage[]'.
Type 'import("node:crypto").webcrypto.KeyUsage' is not assignable to type 'KeyUsage'.
Type '"decapsulateBits"' is not assignable to type 'KeyUsage'.
61 .setKeyPairsDispatcher(async ctx => {
Environment
OS: Arch Linux
Runtime: Node.js v25
This is a type error, not a runtime error.
Logs / Screenshots
No response
Steps to Reproduce
tbd if needed
Metadata
Metadata
Assignees
Labels
breaking changeBreaking changeBreaking changecomponent/buildBuild system and packagingBuild system and packagingcomponent/federationFederation object relatedFederation object relatedcomponent/signaturesOIP or HTTP/LD Signatures relatedOIP or HTTP/LD Signatures relatedtype/bugSomething isn't workingSomething isn't working