Open-Attestation / open-attestation

Meta framework for providing digital provenance and integrity to documents.
https://openattestation.com
Apache License 2.0
54 stars 18 forks source link

fix: polyfill buffer, shim randombytes #286

Closed phanshiyu closed 5 months ago

phanshiyu commented 5 months ago

What

  1. remove direct use of crypto and instead use https://www.npmjs.com/package/randombytes, which uses native crypto methods based on environment
  2. use https://www.npmjs.com/package/buffer instead of relying on buffer from node env

Tested

  1. CRA - works out of the box
  2. React vite needs
    // vite.config.ts
    export default defineConfig({
    plugins: [react()],
    define: {
    // By default, Vite doesn't include shims for NodeJS/
    // necessary for segment analytics lib to work
    global: 'globalThis'
    },  
    })
  3. next server side - out of the box
  4. next client side - have to install undici
github-actions[bot] commented 5 months ago

:tada: This PR is included in version 6.10.0-alpha.5 :tada:

The release is available on:

Your semantic-release bot :package::rocket: