- Extend Authority entity table to also store the authorities in WIF format.
- Make ImportBrainkeyActivity to create and store the WIF format into the database.
This commit is contained in:
parent
cec0857113
commit
61aeca0575
3 changed files with 9 additions and 1 deletions
|
@ -284,12 +284,14 @@ class ImportBrainkeyActivity : ConnectedActivity() {
|
||||||
*/
|
*/
|
||||||
private fun addAuthorityToDatabase(userId: String, authorityType: Int, brainKey: BrainKey) {
|
private fun addAuthorityToDatabase(userId: String, authorityType: Int, brainKey: BrainKey) {
|
||||||
val brainKeyWords = brainKey.brainKey
|
val brainKeyWords = brainKey.brainKey
|
||||||
|
val wif = brainKey.walletImportFormat
|
||||||
val sequenceNumber = brainKey.sequenceNumber
|
val sequenceNumber = brainKey.sequenceNumber
|
||||||
|
|
||||||
val encryptedBrainKey = CryptoUtils.encrypt(this, brainKeyWords)
|
val encryptedBrainKey = CryptoUtils.encrypt(this, brainKeyWords)
|
||||||
val encryptedSequenceNumber = CryptoUtils.encrypt(this, sequenceNumber.toString())
|
val encryptedSequenceNumber = CryptoUtils.encrypt(this, sequenceNumber.toString())
|
||||||
|
val encryptedWIF = CryptoUtils.encrypt(this, wif)
|
||||||
|
|
||||||
val authority = Authority(0, userId, authorityType, encryptedBrainKey, encryptedSequenceNumber)
|
val authority = Authority(0, userId, authorityType, encryptedWIF, encryptedBrainKey, encryptedSequenceNumber)
|
||||||
|
|
||||||
val authorityRepository = AuthorityRepository(application)
|
val authorityRepository = AuthorityRepository(application)
|
||||||
authorityRepository.insert(authority)
|
authorityRepository.insert(authority)
|
||||||
|
|
|
@ -10,6 +10,7 @@ data class Authority (
|
||||||
@ColumnInfo(name = "id") val id: Long,
|
@ColumnInfo(name = "id") val id: Long,
|
||||||
@ColumnInfo(name = "user_id") val userId: String,
|
@ColumnInfo(name = "user_id") val userId: String,
|
||||||
@ColumnInfo(name = "authority_type") val authorityType: Int,
|
@ColumnInfo(name = "authority_type") val authorityType: Int,
|
||||||
|
@ColumnInfo(name = "encrypted_wif") val encryptedWIF: String,
|
||||||
@ColumnInfo(name = "encrypted_brain_key") val encryptedBrainKey: String,
|
@ColumnInfo(name = "encrypted_brain_key") val encryptedBrainKey: String,
|
||||||
@ColumnInfo(name = "encrypted_sequence_number") val encryptedSequenceNumber: String
|
@ColumnInfo(name = "encrypted_sequence_number") val encryptedSequenceNumber: String
|
||||||
)
|
)
|
|
@ -191,6 +191,11 @@ class TransfersLoader(private var mContext: Context?, private val mLifeCycle: Li
|
||||||
// all its stored request ids will now be reset
|
// all its stored request ids will now be reset
|
||||||
responseMap.clear()
|
responseMap.clear()
|
||||||
}
|
}
|
||||||
|
// According to Nelson this is better than doing it in onServiceConnected, but here it does not get called
|
||||||
|
// else if (message.updateCode == ConnectionStatusUpdate.CONNECTED) {
|
||||||
|
// // Start the transfers update
|
||||||
|
// startTransfersUpdateProcedure()
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue