Improve username link storage service validation.

This commit is contained in:
Greyson Parrelli 2026-06-08 16:14:12 +00:00 committed by Cody Henthorne
parent c5785c086e
commit 26b1d3a0f8

View File

@ -314,12 +314,18 @@ object StorageSyncHelper {
}
if (update.new.proto.usernameLink != null) {
SignalStore.account.usernameLink = UsernameLinkComponents(
update.new.proto.usernameLink!!.entropy.toByteArray(),
UuidUtil.parseOrThrow(update.new.proto.usernameLink!!.serverId.toByteArray())
)
val remoteServerId = UuidUtil.parseOrNull(update.new.proto.usernameLink!!.serverId.toByteArray())
SignalStore.misc.usernameQrCodeColorScheme = StorageSyncModels.remoteToLocalUsernameColor(update.new.proto.usernameLink!!.color)
if (remoteServerId != null) {
SignalStore.account.usernameLink = UsernameLinkComponents(
update.new.proto.usernameLink!!.entropy.toByteArray(),
remoteServerId
)
SignalStore.misc.usernameQrCodeColorScheme = StorageSyncModels.remoteToLocalUsernameColor(update.new.proto.usernameLink!!.color)
} else {
Log.w(TAG, "Remote username link had a malformed serverId. Ignoring the username link.")
}
}
SignalStore.releaseChannel.releaseChannelRecipientId?.let { releaseChannelId ->