-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch from ZIP 32 account indices to UUID account identifiers
- Loading branch information
Showing
20 changed files
with
195 additions
and
181 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
9 changes: 9 additions & 0 deletions
9
backend-lib/src/main/java/cash/z/ecc/android/sdk/internal/jni/JniConstants.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,9 @@ | ||
package cash.z.ecc.android.sdk.internal.jni | ||
|
||
import cash.z.ecc.android.sdk.internal.model.JniAccount | ||
|
||
/** | ||
* The number of bytes in the account UUID parameter. It's used e.g. in [JniAccount.accountUuid], or | ||
* [JniUnifiedSpendingKey.accountUuid] | ||
*/ | ||
const val JNI_ACCOUNT_UUID_BYTES_SIZE = 16 |
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
9 changes: 5 additions & 4 deletions
9
backend-lib/src/main/java/cash/z/ecc/android/sdk/internal/model/JniAccount.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 |
---|---|---|
@@ -1,22 +1,23 @@ | ||
package cash.z.ecc.android.sdk.internal.model | ||
|
||
import androidx.annotation.Keep | ||
import cash.z.ecc.android.sdk.internal.jni.JNI_ACCOUNT_UUID_BYTES_SIZE | ||
|
||
/** | ||
* Serves as cross layer (Kotlin, Rust) communication class. | ||
* | ||
* @param accountIndex the ZIP 32 account index. | ||
* @param accountUuid the "one-way stable" identifier for the account. | ||
* @param ufvk The account's Unified Full Viewing Key, if any. | ||
* @throws IllegalArgumentException if the values are inconsistent. | ||
*/ | ||
@Keep | ||
class JniAccount( | ||
val accountIndex: Int, | ||
val accountUuid: ByteArray, | ||
val ufvk: String?, | ||
) { | ||
init { | ||
require(accountIndex >= 0) { | ||
"Account index must be non-negative" | ||
require(accountUuid.size == JNI_ACCOUNT_UUID_BYTES_SIZE) { | ||
"Account UUID must be 16 bytes" | ||
} | ||
} | ||
} |
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.