Move x25519KeyPair

This commit is contained in:
Andrew 2024-06-17 20:04:25 +09:30
parent 66b77abcd0
commit 922a3ce827

View File

@ -42,11 +42,6 @@ class PickDisplayNameViewModel(
val displayName = state.value.displayName
val keyPairGenerationResult = KeyPairUtilities.generate()
val seed = keyPairGenerationResult.seed
val ed25519KeyPair = keyPairGenerationResult.ed25519KeyPair
val x25519KeyPair = keyPairGenerationResult.x25519KeyPair
when {
displayName.isEmpty() -> { state.update { it.copy(error = R.string.displayNameErrorDescription) } }
displayName.length > NAME_PADDED_LENGTH -> { state.update { it.copy(error = R.string.displayNameErrorDescriptionShorter) } }
@ -58,6 +53,11 @@ class PickDisplayNameViewModel(
database.clearAllLastMessageHashes()
database.clearReceivedMessageHashValues()
val keyPairGenerationResult = KeyPairUtilities.generate()
val seed = keyPairGenerationResult.seed
val ed25519KeyPair = keyPairGenerationResult.ed25519KeyPair
val x25519KeyPair = keyPairGenerationResult.x25519KeyPair
KeyPairUtilities.store(context, seed, ed25519KeyPair, x25519KeyPair)
configFactory.keyPairChanged()
val userHexEncodedPublicKey = x25519KeyPair.hexEncodedPublicKey