UnifiedSpendingKey.fromUnifiedSpendKeyBytes constructor

UnifiedSpendingKey.fromUnifiedSpendKeyBytes({
  1. required List<int> uskBytes,
  2. required ZCashNetwork network,
  3. required ZCryptoContext context,
})

Implementation

factory UnifiedSpendingKey.fromUnifiedSpendKeyBytes({
  required List<int> uskBytes,
  required ZCashNetwork network,
  required ZCryptoContext context,
}) {
  final decode = ZCashEncodingUtils.decodeUnifiedSpendKey(uskBytes);
  final config = ZcashConf().fromNetwork(network);
  return UnifiedSpendingKey._(
    config: config,
    context: context,
    sapling: Zip32Sapling.fromExtendedSpendingKeyBytes(
      decode.firstWhere((e) => e.type == Typecode.sapling).data,
    ),
    orchard: Zip32Orchard.fromSpendKey(
      context: context,
      sk: decode.firstWhere((e) => e.type == Typecode.orchard).data,
    ),
    transparent: Bip32Slip10Secp256k1.fromExtendedPrivateKeyBytes(
      decode.firstWhere((e) => e.type == Typecode.p2pkh).data,
    ),
  );
}