detached_verify method

bool detached_verify(
  1. Uint8List message,
  2. Uint8List signature
)

Implementation

bool detached_verify(Uint8List message, Uint8List signature) {
  if (signature.length != signatureLength) return false;
  if (_theirPublicKey.length != publicKeyLength) return false;
  Uint8List sm = Uint8List(signatureLength + message.length);
  Uint8List m = Uint8List(signatureLength + message.length);
  for (int i = 0; i < signatureLength; i++) sm[i] = signature[i];
  for (int i = 0; i < message.length; i++)
    sm[i + signatureLength] = message[i];
  return (TweetNaclFast.crypto_sign_open(
          m, -1, sm, 0, sm.length, _theirPublicKey) >=
      0);
}