salsaBoxBeforenm method

  1. @override
BuBytes salsaBoxBeforenm({
  1. required List<int> peerPublicKey,
  2. required List<int> secretKey,
})
override

NaCl crypto_box_beforenm: derives the 32-byte transport key from 32-byte peerPublicKey and 32-byte secretKey. Throws on invalid lengths; throws CryptoException on a zero shared secret.

Implementation

@override
BuBytes salsaBoxBeforenm({
  required List<int> peerPublicKey,
  required List<int> secretKey,
}) {
  ApiValidate.length(
    peerPublicKey,
    SalsaBox.keyLength,
    operation: "salsaBoxBeforenm",
    name: "peerPublicKey",
  );
  ApiValidate.length(
    secretKey,
    SalsaBox.keyLength,
    operation: "salsaBoxBeforenm",
    name: "secretKey",
  );
  return _inner.salsaBoxBeforenm(
    peerPublicKey: peerPublicKey,
    secretKey: secretKey,
  );
}