Skip to content

Conversation

Jon-edge
Copy link
Collaborator

@Jon-edge Jon-edge commented Mar 7, 2024

This pull request updates the unique ID used for generating share referral links. It replaces the previous method of using base58ToUuid with a new method that generates an anonymized referral ID using hash.js. This ensures that the referral links are more secure and unique.

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Requirements

If you have made any visual changes to the GUI. Make sure you have:

  • Tested on iOS device
  • Tested on Android device
  • Tested on small-screen device (iPod Touch)
  • Tested on large-screen device (tablet)

const refId = hashjs.sha256().update(data).digest('hex')

const website = `${config.website}?af=referred_${refId}`
console.debug(website)
Copy link
Member

Choose a reason for hiding this comment

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

remove debug

const data = Uint8Array.from(Buffer.from(account.rootLoginId, 'hex'))
const refId = hashjs.sha256().update(data).digest('hex')

const website = `${config.website}?af=referred_${refId}`
Copy link
Member

@paullinator paullinator Mar 10, 2024

Choose a reason for hiding this comment

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

Just so it's not so long, remove the 0x prefix and truncate to 10 digits. also, prefix should be appreferred_

@Jon-edge Jon-edge force-pushed the jon/share-link-hash branch from 6780ec7 to 4d014d1 Compare March 11, 2024 23:47
const website = `${config.website}?af=referred_${refId}`
console.debug(website)
// Truncate the refId to 10 characters using the first and last 5 chars:
refId = refId.substring(0, 5) + refId.substring(refId.length - 5)
Copy link
Member

Choose a reason for hiding this comment

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

Just use the first 10 characters. refId is a hash so it doesn't matter.

@Jon-edge Jon-edge force-pushed the jon/share-link-hash branch from 96e09e3 to 2f5d4ed Compare March 12, 2024 01:15
fixup! Update unique ID for share referral links
@Jon-edge Jon-edge force-pushed the jon/share-link-hash branch from 2f5d4ed to f59a3bd Compare March 12, 2024 18:03
@Jon-edge Jon-edge enabled auto-merge March 12, 2024 18:06
@Jon-edge Jon-edge merged commit e1c70be into develop Mar 12, 2024
@Jon-edge Jon-edge deleted the jon/share-link-hash branch March 12, 2024 18:12
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