API reference@evolu/commonlocal‑first/Protocol › decryptAndDecodeDbChange

function decryptAndDecodeDbChange(
  message: EncryptedCrdtMessage,
  key: Uint8Array<ArrayBufferLike> &
    Brand<"Entropy"> &
    Brand<"Length32"> &
    Brand<"EncryptionKey">,
): Result<
  DbChange,
  | DecryptWithXChaCha20Poly1305Error
  | ProtocolInvalidDataError
  | ProtocolTimestampMismatchError
>;

Defined in: packages/common/src/local-first/Protocol.ts:1905

Decrypts and decodes an EncryptedCrdtMessage using the provided owner's encryption key. Verifies that the embedded timestamp matches the expected timestamp to ensure message integrity.