Closed
Description
Looks like these lines do nothing since buf
is returned. Should return bufView
? Which may also fix issues related to nodejs/node#46067 (see upstream issues linked to this issue and solutions) which was causing errors like below thrown for people using that implementation.
'importkey' on 'subtlecrypto': 2nd argument is not instance of arraybuffer, buffer, typedarray, or dataview.
Example code on this page also needs fixing as it copy/pastes the stringToArrayBuffer
implementation.
https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey
Also see, where bufView
is returned.
https://stackoverflow.com/questions/34814480/how-to-load-a-public-key-in-pem-format-for-encryption