-
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.
Add derivation methods for ZIP 325 private use metadata keys
Co-authored-by: Daira-Emma Hopwood <[email protected]>
- Loading branch information
Showing
12 changed files
with
417 additions
and
29 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
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
29 changes: 29 additions & 0 deletions
29
backend-lib/src/main/java/cash/z/ecc/android/sdk/internal/model/JniMetadataKey.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,29 @@ | ||
package cash.z.ecc.android.sdk.internal.model | ||
|
||
import androidx.annotation.Keep | ||
import cash.z.ecc.android.sdk.internal.jni.JNI_METADATA_KEY_CHAIN_CODE_SIZE | ||
import cash.z.ecc.android.sdk.internal.jni.JNI_METADATA_KEY_SK_SIZE | ||
|
||
/** | ||
* Serves as cross layer (Kotlin, Rust) communication class. | ||
* | ||
* @param sk the ZIP 32 key required to derive child keys. | ||
* @param chainCode The ZIP 32 chain code required to derive child keys. | ||
* | ||
* @throws IllegalArgumentException if the values are inconsistent. | ||
*/ | ||
@Keep | ||
class JniMetadataKey( | ||
val sk: ByteArray, | ||
val chainCode: ByteArray, | ||
) { | ||
init { | ||
require(sk.size == JNI_METADATA_KEY_SK_SIZE) { | ||
"Account UUID must be 32 bytes" | ||
} | ||
|
||
require(chainCode.size == JNI_METADATA_KEY_CHAIN_CODE_SIZE) { | ||
"Seed fingerprint must be 32 bytes" | ||
} | ||
} | ||
} |
Oops, something went wrong.