deriveAddress method

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

Implementation

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

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

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

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