Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix account generation error #233

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ buildscript {
xserializationjson : '1.5.1',
ktor : '2.3.1',
xbackup : '1.0.0',
xcrypto : '1.0.2',
xsubstrate : '1.0.1'
xcrypto : '1.0.3',
xsubstrate : '1.0.2'
]

ext {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import jp.co.soramitsu.feature_account_api.domain.interfaces.CredentialsReposito
import jp.co.soramitsu.feature_blockexplorer_api.data.SoraConfigManager
import jp.co.soramitsu.sora.substrate.runtime.RuntimeManager
import jp.co.soramitsu.sora.substrate.runtime.SubstrateOptionsProvider
import jp.co.soramitsu.sora.substrate.substrate.deriveSeed32
import jp.co.soramitsu.xcrypto.util.fromHex
import jp.co.soramitsu.xcrypto.util.toHexString
import jp.co.soramitsu.xsubstrate.encrypt.keypair.substrate.Sr25519Keypair
Expand Down Expand Up @@ -81,7 +82,7 @@ class CredentialsRepositoryImpl constructor(
}

private suspend fun generateEntropyAndKeysFromMnemonic(mnemonic: Mnemonic): String {
val derivationResult = SubstrateSeedFactory.deriveSeed(mnemonic.words, null)
val derivationResult = SubstrateSeedFactory.deriveSeed32(mnemonic.words, null)
val keyPair = SubstrateKeypairFactory.generate(
SubstrateOptionsProvider.encryptionType,
derivationResult.seed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ class CredentialsRepositoryTest {
every { SubstrateKeypairFactory.generate(any(), any()) } returns keypair
every { SubstrateKeypairFactory.generate(any(), any(), any()) } returns keypair
every { FirebaseWrapper.log("Keys were created") } just runs
every { derivationResult.seed } returns "seed".toByteArray()
every { derivationResult.seed } returns "seedseedseedseedseedseedseedseedseedseedseedseedseedseed".toByteArray()
every { derivationResult.mnemonic } returns Mnemonic(
"",
emptyList(),
ByteArray(1) { 1 })

credentialsRepository = CredentialsRepositoryImpl(
datasource,
cryptoAssistant,
Expand Down