fromSeed static method

Future<ICPAccount> fromSeed(
  1. Uint8List seed, {
  2. int? index,
  3. CurveType curveType = CurveType.ed25519,
})

Implementation

static Future<ICPAccount> fromSeed(
  Uint8List seed, {
  int? index,
  CurveType curveType = CurveType.ed25519,
}) async {
  final ECKeys keys = ecKeysfromSeed(seed, index: index ?? 0);
  final Ed25519KeyIdentity? identity = curveType == CurveType.secp256k1
      ? null
      : await Ed25519KeyIdentity.generate(seed);
  final Secp256k1KeyIdentity? ecIdentity = curveType == CurveType.ed25519
      ? null
      : Secp256k1KeyIdentity.fromKeyPair(
          keys.ecPublicKey!,
          keys.ecPrivateKey!,
        );
  return ICPAccount(curveType: curveType)
    .._ecKeys = keys
    .._identity = identity
    .._ecIdentity = ecIdentity
    .._phrase = '';
}