Skip to content

Commit

Permalink
♻️ use browser-provided crypto for uuids
Browse files Browse the repository at this point in the history
  • Loading branch information
krmax44 committed Nov 27, 2023
1 parent 87f0764 commit 44bbf02
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions frontend/javascript/components/campaign-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,6 @@ import i18n from '../../i18n/campaign-list.json'
import CampaignRequest from './campaign-request'
import Room from 'froide/frontend/javascript/lib/websocket.ts'
function uuidv4() {
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) =>
(
c ^
(crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))
).toString(16)
)
}
export default {
name: 'CampaignList',
components: {
Expand Down Expand Up @@ -280,7 +271,7 @@ export default {
const key = 'campaign_temp_client_id'
const clientId = window.localStorage.getItem(key)
if (!clientId) {
this.clientId = uuidv4()
this.clientId = crypto.randomUUID()
localStorage.setItem(key, this.clientId)
} else {
this.clientId = clientId
Expand Down

0 comments on commit 44bbf02

Please sign in to comment.