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