ed25519SeedToX25519 function

Uint8List ed25519SeedToX25519(
  1. Uint8List seed
)

Converts an Ed25519 seed (the 32-byte private key) to the X25519 secret the Go client derives: SHA-512 of the seed, first 32 bytes, clamped.

Implementation

Uint8List ed25519SeedToX25519(Uint8List seed) {
  if (seed.length != 32) {
    throw ArgumentError('Ed25519 seed must be 32 bytes, got ${seed.length}');
  }
  final out = Uint8List(32);
  TweetNaClExt.crypto_sign_ed25519_sk_to_x25519_sk(out, seed);
  return out;
}