keyPair_fromSecretKey static method

KeyPair keyPair_fromSecretKey(
  1. Uint8List secretKey
)

Implementation

static KeyPair keyPair_fromSecretKey(Uint8List secretKey) {
  KeyPair kp = new KeyPair(publicKeyLength, secretKeyLength);
  Uint8List pk = kp.publicKey;
  Uint8List sk = kp.secretKey;

  // copy sk
  for (int i = 0; i < kp.secretKey.length; i++) sk[i] = secretKey[i];

  // copy pk from sk
  for (int i = 0; i < kp.publicKey.length; i++)
    pk[i] = secretKey[32 + i]; // hard-copy

  return kp;
}