You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
discogs-client is a Node.js and browser client library
I believe that's the only problematic place, and using something different instead should fix the problem. Here's an example implementation:
functionrandomUUID(): string{// Create an array of 16 random bytes (128 bits)constrandomBytes=newUint8Array(16);crypto.getRandomValues(randomBytes);// Set the version to 4 (UUIDv4) and the variant to 10x (as per the UUID v4 specification)randomBytes[6]=(randomBytes[6]&0x0f)|0x40;// Set version to 4randomBytes[8]=(randomBytes[8]&0x3f)|0x80;// Set variant to 10x// Convert the byte array to a UUID string in the format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxxconstuuid=[...randomBytes].map((byte,index)=>{// Add dashes in the specific UUID positionsconsthex=byte.toString(16).padStart(2,'0');return[4,6,8,10].includes(index) ? `-${hex}` : hex;}).join('');returnuuid;}
The text was updated successfully, but these errors were encountered:
Looks like using when the library in React Native project it falls back to browser bundle. I tested that by removing browser directory from node_modules. After that I was getting import errors, because the imported file was not found.
I also dug a but more, and I am afraid that a bit more work is required to make this library React Native friendly:
I tried to use
DiscogsOAuth
in React Native app and following was thrown:I believe this is because the library is trying to access
window
, which is specific for browser environment:discogs-client/browser/crypto.js
Line 5 in 77a139c
So the question is if...
I believe that's the only problematic place, and using something different instead should fix the problem. Here's an example implementation:
The text was updated successfully, but these errors were encountered: