-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/ABW-3664-default-modal-insets
# Conflicts: # app/src/main/java/com/babylon/wallet/android/presentation/settings/preferences/gateways/GatewaysScreen.kt
- Loading branch information
Showing
90 changed files
with
1,223 additions
and
1,639 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 0 additions & 57 deletions
57
app/src/main/java/com/babylon/wallet/android/data/transaction/InteractionState.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/babylon/wallet/android/domain/model/signing/EntityWithSignature.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.babylon.wallet.android.domain.model.signing | ||
|
||
import com.radixdlt.sargon.SignatureWithPublicKey | ||
import com.radixdlt.sargon.extensions.ProfileEntity | ||
|
||
/** | ||
* A data class that holds an entity and its signature | ||
* | ||
*/ | ||
data class EntityWithSignature( | ||
val entity: ProfileEntity, | ||
val signatureWithPublicKey: SignatureWithPublicKey | ||
) |
54 changes: 54 additions & 0 deletions
54
app/src/main/java/com/babylon/wallet/android/domain/model/signing/SignRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.babylon.wallet.android.domain.model.signing | ||
|
||
import com.babylon.wallet.android.utils.removeTrailingSlash | ||
import com.radixdlt.sargon.BagOfBytes | ||
import com.radixdlt.sargon.Hash | ||
import com.radixdlt.sargon.TransactionIntent | ||
import com.radixdlt.sargon.extensions.bagOfBytesOf | ||
import com.radixdlt.sargon.extensions.compile | ||
import com.radixdlt.sargon.extensions.hash | ||
import com.radixdlt.sargon.extensions.hexToBagOfBytes | ||
import rdx.works.core.toByteArray | ||
|
||
sealed interface SignRequest { | ||
|
||
val dataToSign: BagOfBytes | ||
val hashedDataToSign: Hash | ||
|
||
class SignTransactionRequest( | ||
intent: TransactionIntent | ||
) : SignRequest { | ||
// Used when signing with Ledger | ||
override val dataToSign: BagOfBytes = intent.compile() | ||
|
||
// Used when signing with device | ||
override val hashedDataToSign: Hash = intent.hash().hash | ||
} | ||
|
||
class SignAuthChallengeRequest( | ||
val challengeHex: String, | ||
val origin: String, | ||
val dAppDefinitionAddress: String | ||
) : SignRequest { | ||
|
||
// TODO removeTrailingSlash is a hack to fix the issue with dapp login, it should be removed after logic is moved to sargon | ||
override val dataToSign: BagOfBytes | ||
get() { | ||
require(dAppDefinitionAddress.length <= UByte.MAX_VALUE.toInt()) | ||
return bagOfBytesOf( | ||
byteArrayOf(ROLA_PAYLOAD_PREFIX.toByte()) + | ||
challengeHex.hexToBagOfBytes().toByteArray() + | ||
dAppDefinitionAddress.length.toUByte().toByte() + | ||
dAppDefinitionAddress.toByteArray() + | ||
origin.removeTrailingSlash().toByteArray() | ||
) | ||
} | ||
|
||
override val hashedDataToSign: Hash | ||
get() = dataToSign.hash() | ||
|
||
companion object { | ||
const val ROLA_PAYLOAD_PREFIX = 0x52 | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
app/src/main/java/com/babylon/wallet/android/domain/model/signing/SignType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.babylon.wallet.android.domain.model.signing | ||
|
||
enum class SignType { | ||
SigningTransaction, ProvingOwnership | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.