readNativeEncryptedBuffer function

EncryptedBuffer readNativeEncryptedBuffer(
  1. NativeEncryptedBuffer encryptedBuffer
)

Reads a native encrypted buffer and converts it to an EncryptedBuffer instance.

The encryptedBuffer parameter is a NativeEncryptedBuffer containing the native encrypted data.

Implementation

EncryptedBuffer readNativeEncryptedBuffer(NativeEncryptedBuffer encryptedBuffer) {
  int noncePos = encryptedBuffer.nonce_pos;
  int tagPos = encryptedBuffer.tag_pos;

  return EncryptedBuffer(
      Uint8List.fromList(secretBufferToBytesList(encryptedBuffer.buffer)),
      tagPos,
      noncePos);
}