Copyright | © 2018-2021 IOHK |
---|---|
License | Apache-2.0 |
Safe Haskell | None |
Language | Haskell2010 |
Implementation of address derivation for
Shared
Keys.
Synopsis
-
newtype
SharedKey
(depth ::
Depth
) key =
SharedKey
{
- getKey :: key
- generateKeyFromSeed :: ( SomeMnemonic , Maybe SomeMnemonic ) -> Passphrase "encryption" -> SharedKey ' RootK XPrv
- unsafeGenerateKeyFromSeed :: ( SomeMnemonic , Maybe SomeMnemonic ) -> Passphrase "encryption" -> SharedKey depth XPrv
- purposeCIP1854 :: Index ' Hardened ' PurposeK
Types
newtype SharedKey (depth :: Depth ) key Source #
A cryptographic key for Shared address derivation, with phantom-types to disambiguate derivation paths
let rootPrivateKey = SharedKey 'RootK XPrv let accountPubKey = SharedKey 'AccountK XPub let addressPubKey = SharedKey 'AddressK XPub
Instances
Generation and derivation
:: ( SomeMnemonic , Maybe SomeMnemonic ) |
The actual seed and its recovery / generation passphrase |
-> Passphrase "encryption" | |
-> SharedKey ' RootK XPrv |
Generate a root key from a corresponding seed. The seed should be at least 16 bytes.
unsafeGenerateKeyFromSeed Source #
:: ( SomeMnemonic , Maybe SomeMnemonic ) |
The actual seed and its recovery / generation passphrase |
-> Passphrase "encryption" | |
-> SharedKey depth XPrv |
Generate a new key from seed. Note that the
depth
is left open so that
the caller gets to decide what type of key this is. This is mostly for
testing, in practice, seeds are used to represent root keys, and one should
use
generateKeyFromSeed
.
purposeCIP1854 :: Index ' Hardened ' PurposeK Source #
Purpose for shared wallets is a constant set to 1854' (or 0x8000073E) following the original CIP-1854 Multi-signature Wallets.
It indicates that the subtree of this node is used according to this specification.
Hardened derivation is used at this level.