-
- All Implemented Interfaces:
-
cash.z.ecc.android.sdk.internal.Derivation
public final class RustDerivationTool implements Derivation
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classRustDerivationTool.Companion
-
Method Summary
Modifier and Type Method Description Array<String>deriveUnifiedFullViewingKeys(ByteArray seed, Integer networkId, Integer numberOfAccounts)StringderiveUnifiedFullViewingKey(JniUnifiedSpendingKey usk, Integer networkId)ByteArrayderiveUnifiedSpendingKey(ByteArray seed, Integer networkId, Long accountIndex)StringderiveUnifiedAddress(ByteArray seed, Integer networkId, Long accountIndex)StringderiveUnifiedAddress(String viewingKey, Integer networkId)Given a Unified Full Viewing Key string, return the associated Unified Address. JniMetadataKeyderiveAccountMetadataKey(ByteArray seed, Integer networkId, Long accountIndex)Derives a ZIP 325 Account Metadata Key from the given seed. Array<ByteArray>derivePrivateUseMetadataKey(JniMetadataKey accountMetadataKey, String ufvk, Integer networkId, ByteArray privateUseSubject)Derives a metadata key for private use from a ZIP 325 Account Metadata Key. ByteArrayderiveArbitraryWalletKey(ByteArray contextString, ByteArray seed)Derives a ZIP 32 Arbitrary Key from the given seed at the "wallet level", i.e. ByteArrayderiveArbitraryAccountKey(ByteArray contextString, ByteArray seed, Integer networkId, Long accountIndex)Derives a ZIP 32 Arbitrary Key from the given seed at the account level. -
-
Method Detail
-
deriveUnifiedFullViewingKeys
Array<String> deriveUnifiedFullViewingKeys(ByteArray seed, Integer networkId, Integer numberOfAccounts)
- Parameters:
numberOfAccounts- Use DEFAULT_NUMBER_OF_ACCOUNTS to derive a single key.
-
deriveUnifiedFullViewingKey
String deriveUnifiedFullViewingKey(JniUnifiedSpendingKey usk, Integer networkId)
-
deriveUnifiedSpendingKey
ByteArray deriveUnifiedSpendingKey(ByteArray seed, Integer networkId, Long accountIndex)
-
deriveUnifiedAddress
String deriveUnifiedAddress(ByteArray seed, Integer networkId, Long accountIndex)
-
deriveUnifiedAddress
String deriveUnifiedAddress(String viewingKey, Integer networkId)
Given a Unified Full Viewing Key string, return the associated Unified Address.
- Parameters:
viewingKey- the viewing key to use for deriving the address.
-
deriveAccountMetadataKey
JniMetadataKey deriveAccountMetadataKey(ByteArray seed, Integer networkId, Long accountIndex)
Derives a ZIP 325 Account Metadata Key from the given seed.
-
derivePrivateUseMetadataKey
Array<ByteArray> derivePrivateUseMetadataKey(JniMetadataKey accountMetadataKey, String ufvk, Integer networkId, ByteArray privateUseSubject)
Derives a metadata key for private use from a ZIP 325 Account Metadata Key.
If
ufvkis non-null, this method will return one metadata key for every FVK item contained within the UFVK, in preference order. As UFVKs may in general change over time (due to the inclusion of new higher-preference FVK items, or removal of older deprecated FVK items), private usage of these keys should always follow preference order:For encryption-like private usage, the first key in the array should always be used, and all other keys ignored.
For decryption-like private usage, each key in the array should be tried in turn until metadata can be recovered, and then the metadata should be re-encrypted under the first key.
- Parameters:
ufvk- the external UFVK for which a metadata key is required, ornullif the metadata key is "inherent" (for the same account as the Account Metadata Key).privateUseSubject- a globally unique non-empty sequence of at most 252 bytes that identifies the desired private-use context.
-
deriveArbitraryWalletKey
ByteArray deriveArbitraryWalletKey(ByteArray contextString, ByteArray seed)
Derives a ZIP 32 Arbitrary Key from the given seed at the "wallet level", i.e. directly from the seed with no ZIP 32 path applied.
The resulting key will be the same across all networks (Zcash mainnet, Zcash testnet, OtherCoin mainnet, and so on). You can think of it as a context-specific seed fingerprint that can be used as (static) key material.
- Parameters:
contextString- a globally-unique non-empty sequence of at most 252 bytes that identifies the desired context.
-
deriveArbitraryAccountKey
ByteArray deriveArbitraryAccountKey(ByteArray contextString, ByteArray seed, Integer networkId, Long accountIndex)
Derives a ZIP 32 Arbitrary Key from the given seed at the account level.
- Parameters:
contextString- a globally-unique non-empty sequence of at most 252 bytes that identifies the desired context.
-
-
-
-