devnoname120 / google-play-book-downloader

Download and decrypt books purchased on Google Play Books without text reflowing
GNU Affero General Public License v3.0
54 stars 4 forks source link

use builtin crypto module #4

Closed lmlsna closed 1 year ago

lmlsna commented 1 year ago

Uses the builtin crypto module as long as crypto support is enabled (it is by default). The package-lock.json files in this repository reflects that crypto 1.0.1 is deprecated in favor of the built in module. This fails on node 18 without this change.

devnoname120 commented 1 year ago

Why not just add import * as crypto from 'node:crypto' to the top of the file? The script requires crypto to work so I'm not sure why we would use a try/catch construct here.

Edit: Node.js's documentation recommends const { subtle } = globalThis.crypto;