-
public interface DerivationTool
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classDerivationTool.Companion
-
Method Summary
Modifier and Type Method Description abstract List<UnifiedFullViewingKey>deriveUnifiedFullViewingKeys(ByteArray seed, ZcashNetwork network, Integer numberOfAccounts)Given a seed and a number of accounts, return the associated Unified Full Viewing Keys. abstract UnifiedFullViewingKeyderiveUnifiedFullViewingKey(UnifiedSpendingKey usk, ZcashNetwork network)Given a unified spending key, return the associated unified full viewing key. abstract UnifiedSpendingKeyderiveUnifiedSpendingKey(ByteArray seed, ZcashNetwork network, Zip32AccountIndex accountIndex)Derives and returns a unified spending key from the given seed for the given account ID. abstract StringderiveUnifiedAddress(ByteArray seed, ZcashNetwork network, Zip32AccountIndex accountIndex)Given a seed and account index, return the associated Unified Address. abstract StringderiveUnifiedAddress(String viewingKey, ZcashNetwork network)Given a Unified Full Viewing Key string, return the associated Unified Address. abstract AccountMetadataKeyderiveAccountMetadataKey(ByteArray seed, ZcashNetwork network, Zip32AccountIndex accountIndex)Derives a ZIP 325 Account Metadata Key from the given seed. abstract Array<ByteArray>derivePrivateUseMetadataKey(AccountMetadataKey accountMetadataKey, String ufvk, ZcashNetwork network, ByteArray privateUseSubject)Derives a metadata key for private use from a ZIP 325 Account Metadata Key. abstract ByteArrayderiveArbitraryWalletKey(ByteArray contextString, ByteArray seed)Derives a ZIP 32 Arbitrary Key from the given seed at the "wallet level", i.e. abstract ByteArrayderiveArbitraryAccountKey(ByteArray contextString, ByteArray seed, ZcashNetwork network, Zip32AccountIndex accountIndex)Derives a ZIP 32 Arbitrary Key from the given seed at the account level. -
-
Method Detail
-
deriveUnifiedFullViewingKeys
abstract List<UnifiedFullViewingKey> deriveUnifiedFullViewingKeys(ByteArray seed, ZcashNetwork network, Integer numberOfAccounts)
Given a seed and a number of accounts, return the associated Unified Full Viewing Keys.
- Parameters:
seed- the seed from which to derive viewing keys.numberOfAccounts- the number of accounts to use.
-
deriveUnifiedFullViewingKey
abstract UnifiedFullViewingKey deriveUnifiedFullViewingKey(UnifiedSpendingKey usk, ZcashNetwork network)
Given a unified spending key, return the associated unified full viewing key.
- Parameters:
usk- the key from which to derive the viewing key.
-
deriveUnifiedSpendingKey
abstract UnifiedSpendingKey deriveUnifiedSpendingKey(ByteArray seed, ZcashNetwork network, Zip32AccountIndex accountIndex)
Derives and returns a unified spending key from the given seed for the given account ID.
Returns the newly created ZIP 316 account identifier, along with the binary encoding of the `UnifiedSpendingKey` for the newly created account. The caller should store the returned spending key in a secure fashion.
- Parameters:
seed- the seed from which to derive spending keys.accountIndex- the ZIP 32 account index to derive.
-
deriveUnifiedAddress
abstract String deriveUnifiedAddress(ByteArray seed, ZcashNetwork network, Zip32AccountIndex accountIndex)
Given a seed and account index, return the associated Unified Address.
- Parameters:
seed- the seed from which to derive the address.accountIndex- the ZIP 32 account index to use for deriving the address.
-
deriveUnifiedAddress
abstract String deriveUnifiedAddress(String viewingKey, ZcashNetwork network)
Given a Unified Full Viewing Key string, return the associated Unified Address.
- Parameters:
viewingKey- the viewing key to use for deriving the address.
-
deriveAccountMetadataKey
abstract AccountMetadataKey deriveAccountMetadataKey(ByteArray seed, ZcashNetwork network, Zip32AccountIndex accountIndex)
Derives a ZIP 325 Account Metadata Key from the given seed.
-
derivePrivateUseMetadataKey
abstract Array<ByteArray> derivePrivateUseMetadataKey(AccountMetadataKey accountMetadataKey, String ufvk, ZcashNetwork network, 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
abstract 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
abstract ByteArray deriveArbitraryAccountKey(ByteArray contextString, ByteArray seed, ZcashNetwork network, Zip32AccountIndex 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.seed- the seed from which to derive the arbitrary key.accountIndex- the ZIP 32 account index for which to derive the arbitrary key.
-
-
-
-