These two places use a special Edge Runtime which has constraints different from Node.js, for example Buffer does not exist there.
At the moment getHashedName and computeUserHash are using the sha.js package which internally uses Buffer. This prevents the package from being usable from Edge Runtime.
Both Edge Runtime supports and Node.js support SubtleCrypto mdn, (edge-runtime) so it might be possible to switch both functions to this implementation.
This change would allow the package to be used from Next.js Middleware and Edge API Routes.
I'm trying to use this package in a Next.js Edge API Route or a Middleware.
These two places use a special Edge Runtime which has constraints different from Node.js, for example
Buffer
does not exist there.At the moment
getHashedName
andcomputeUserHash
are using thesha.js
package which internally usesBuffer
. This prevents the package from being usable from Edge Runtime.Both Edge Runtime supports and Node.js support SubtleCrypto mdn, (edge-runtime) so it might be possible to switch both functions to this implementation.
This change would allow the package to be used from Next.js Middleware and Edge API Routes.