deriveAddress method

Uint8List deriveAddress(
  1. String serviceName, {
  2. int index = 0,
})

Implementation

Uint8List deriveAddress(String serviceName, {int index = 0}) {
  if (services![serviceName] == null) {
    throw 'Service doesn\'t exist in the keychain';
  }

  final KeyPair keyPair = deriveArchethicKeypair(
      seed, services![serviceName]!.derivationPath!, index,
      curve: services![serviceName]!.curve!);
  final int curveID = crypto.curveToID(services![serviceName]!.curve!);

  final Uint8List hashedPublicKey =
      crypto.hash(keyPair.publicKey, algo: services![serviceName]!.hashAlgo!);

  return concatUint8List(<Uint8List>[
    Uint8List.fromList(<int>[curveID]),
    Uint8List.fromList(hashedPublicKey)
  ]);
}