Closed groovejames closed 1 year ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
netease-cloud-music-api | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Sep 14, 2023 5:16pm |
Nevermind, I'll close this. I just realized that there's a lot more to do to achieve Deno compatibility. I'll might come back later.
This PR adds compatibility with Deno. It allows at least the API to be imported into a Deno application (not the server part based on express, though).
For the Deno compatibility I had to change the following things:
crypto.js
: replacecrypto.publicEncrypt(..., RSA_NO_PADDING)
which alas is not available in Deno. I replaced it with a custom RSA implementation which does the same.publicKey
incrypto.js
changed to have a line-length of 64 chars. Deno (or rather, it's Rust-based backend) doesn't like long-lined public keys, which is not a standard anyways.crypto.createPublicKey(key).export({ format: 'jwk' })
. This function is available in Node.js 16.x or higher. Therefore the requirements for this PR rise from Node.js 12.x to 16.x. I hope this is ok. If you don't agree I can find another alternative.I carefully checked that the changed crypto functions produce exactly the same binary data as before.
I tested with Node.js 16.x, 20.x and Deno. Everything seems to work as usual, so if you agree I think this can be integrated into the master branch. :)