API reference / @evolu/common / Evolu/Protocol / decryptAndDecodeDbChange
Function: decryptAndDecodeDbChange()
function decryptAndDecodeDbChange(deps): (
message,
key,
) => Result<
Readonly<{
id: string & Brand<"Id">;
table: string;
values: Readonly<
Record<string, string | number | Uint8Array<ArrayBufferLike> | null>
>;
}>,
| SymmetricCryptoDecryptError
| ProtocolInvalidDataError
| ProtocolTimestampMismatchError
>;
Defined in: packages/common/src/Evolu/Protocol.ts:1693
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.
Parameters
| Parameter | Type |
|---|---|
deps | SymmetricCryptoDep |
Returns
(message, key): Result<Readonly<{
id: string & Brand<"Id">;
table: string;
values: Readonly<Record<string, string | number | Uint8Array<ArrayBufferLike> | null>>;
}>,
| SymmetricCryptoDecryptError
| ProtocolInvalidDataError
| ProtocolTimestampMismatchError>;
Parameters
| Parameter | Type |
|---|---|
message | EncryptedCrdtMessage |
key | Uint8Array<ArrayBufferLike> & Brand<"Entropy"> & Brand<"Length32"> & Brand<"EncryptionKey"> |
Returns
Result<Readonly<{
id: string & Brand<"Id">;
table: string;
values: Readonly<Record<string, string | number | Uint8Array<ArrayBufferLike> | null>>;
}>,
| SymmetricCryptoDecryptError
| ProtocolInvalidDataError
| ProtocolTimestampMismatchError>