Skip to content

Multiplex Server Token Generation Broken Due to Deprecated Function Use #47

Description

@paulalbinson

When running my own multiplex server the token generation does not work giving the following error:

TypeError: crypto.createCipher is not a function at createHash (/var/www/revealjs-server/node_modules/reveal-multiplex/index.js:51:22) at /var/www/revealjs-server/node_modules/reveal-multiplex/index.js:47:38 at Layer.handle [as handle_request] (/var/www/revealjs-server/node_modules/express/lib/router/layer.js:95:5) at next (/var/www/revealjs-server/node_modules/express/lib/router/route.js:137:13) at Route.dispatch (/var/www/revealjs-server/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/var/www/revealjs-server/node_modules/express/lib/router/layer.js:95:5) at /var/www/revealjs-server/node_modules/express/lib/router/index.js:281:22 at Function.process_params (/var/www/revealjs-server/node_modules/express/lib/router/index.js:341:12) at next (/var/www/revealjs-server/node_modules/express/lib/router/index.js:275:10) at SendStream.error (/var/www/revealjs-server/no

A brief investigation reveals
The crypto.createCipher() function is deprecated and has been removed in newer versions of Node.js (e.g., v22) due to security concerns.

Migrate to crypto.createCipheriv(): This is the recommended approach. The createCipheriv() method requires an Initialization Vector (IV) and a key, which enhances security by avoiding a weak key derivation function and static IVs. You will need to manage the key and IV securely, generating a new, random IV for each encryption operation and storing it with the ciphertext. Refer to the Node.js documentation for proper implementation and examples of crypto.createCipheriv() and crypto.createDecipheriv()

Thus, it appears there is a need to revise the operation of the token generation.

This is not something I'm sure about doing, so if someone could have a go at fixing it, that would be great.

Many thanks
Paul

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions