Skip to content

replace aes-js library with webcrypto#12307

Merged
tyrasd merged 3 commits intodevelopfrom
kh/aes
May 8, 2026
Merged

replace aes-js library with webcrypto#12307
tyrasd merged 3 commits intodevelopfrom
kh/aes

Conversation

@k-yle
Copy link
Copy Markdown
Collaborator

@k-yle k-yle commented May 8, 2026

this was originally suggested on the osm discord, but it turns out that person is working on RapiD, not iD. so this PR backports the idea.


like #11634, this reduces the bundle size by about 0.1MB.

AES-CTR is natively supported by WebCrypto, and support by all browsers since 2020.

So the question is: do we need to support 6-year-old browsers?

  • we already use modern browser features with no error handling..., which means iD already crashes in 5-year-old browsers
  • our browserslist config means that we only support 2-year-old browsers, with a few expections.

@k-yle k-yle added the chore Improvements to the iD development experience or codebase label May 8, 2026
@bhousel
Copy link
Copy Markdown
Member

bhousel commented May 8, 2026

Probably worth doing, but part of why I hesitated switching this out in Rapid was because it switches the decryption from sync to async. It's still probably a good idea, but I didn't want to audit all the places that the code is used.

@k-yle
Copy link
Copy Markdown
Collaborator Author

k-yle commented May 8, 2026

thanks bryan, yeah it was it bit cumbersome to make it fit into the synchronous code, but thankfully it's only used in those 2 places

Copy link
Copy Markdown
Member

@tyrasd tyrasd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that should be fine. btw: osm-auth also relies on webcrypto being available.

@tyrasd
Copy link
Copy Markdown
Member

tyrasd commented May 8, 2026

@k-yle: would you like to add this to the changelog as well?

@k-yle
Copy link
Copy Markdown
Collaborator Author

k-yle commented May 8, 2026

sure, done

@tyrasd tyrasd merged commit 8d5fc21 into develop May 8, 2026
4 checks passed
@tyrasd tyrasd deleted the kh/aes branch May 8, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Improvements to the iD development experience or codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants