Skip to content

Use native crypto.randomUUID() instead of hat module#1274

Closed
varna wants to merge 1 commit intomapbox:mainfrom
varna:uuid
Closed

Use native crypto.randomUUID() instead of hat module#1274
varna wants to merge 1 commit intomapbox:mainfrom
varna:uuid

Conversation

@varna
Copy link
Contributor

@varna varna commented Aug 15, 2024

Reducing number of dependencies by replacing hat module with native crypto.randomUUID() which is well supported:

https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID#browser_compatibility
https://caniuse.com/mdn-api_crypto_randomuuid

This would push mapbox-gl-draw dev env to node 20 (or deno/bun). Node 18 is reaching end of maintenance next year, so idk if that's an issue for you.

@varna varna requested a review from a team as a code owner August 15, 2024 12:52
@underoot
Copy link
Member

underoot commented Oct 8, 2024

Hello, @varna! Thank you for your contribution! To me, it seems that replacing of hat with crypto.randomUUID() will cause inability to use maps on site without HTTPS. I agree that hat module seems outdated and need to be replaced. Maybe we can consider some another alternatives like nanoid

cc @stepankuzmin

@underoot
Copy link
Member

underoot commented Dec 3, 2024

Thank you for contribution! We decided to go with nanoid because of non-secure contexts #1318

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants