retailnext / node-radius

Node.js RADIUS library for packet encoding and decoding.
Other
200 stars 60 forks source link

Removes use of deprecated Buffer constructor #66

Closed skibz closed 4 months ago

skibz commented 1 year ago

This patch updates the use of buffers to be in line with current standards.

The biggest upside is that buffers get zero-filled automatically when allocating them with Buffer.alloc, so we get to remove some manual zeroing and zero padding operations throughout the library.

I suppose the change I'm proposing here is no bueno if there's a desire to continue supporting users who are running Node versions prior to v5.10.0 (which is when Buffer.alloc, Buffer.from, and friends were introduced) without adding a nasty process.version conditional or something.

Really hoping that it's unlikely people still use such old versions of Node, though. Node 5 was almost an eternity ago... 🙈

nearbuyjason commented 1 year ago

Thank you for the PR, @skibz.

Would you please update the minimum node version in https://github.com/retailnext/node-radius/blob/5b55be28a909359a39c703a262814d0efd9b0bb5/package.json#L11?

skibz commented 1 year ago

Certainly!