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