API reference / @evolu/common / Evolu/Protocol / decryptAndDecodeDbChange

Function: decryptAndDecodeDbChange()

function decryptAndDecodeDbChange(deps): (message, key) => Result<Readonly<{
  id: string & Brand<"Id">;
  table: string & Brand<"Base64Url"> & Brand<"MaxLength256">;
  values: Readonly<Record<string & Brand<"Base64Url"> & Brand<"MaxLength256">, null | string | number | Uint8Array<ArrayBufferLike>>>;
}>, 
  | SymmetricCryptoDecryptError
  | ProtocolInvalidDataError
| ProtocolTimestampMismatchError>;

Defined in: packages/common/src/Evolu/Protocol.ts:1750

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

ParameterType
depsSymmetricCryptoDep

Returns

(message, key): Result<Readonly<{
  id: string & Brand<"Id">;
  table: string & Brand<"Base64Url"> & Brand<"MaxLength256">;
  values: Readonly<Record<string & Brand<"Base64Url"> & Brand<"MaxLength256">, null | string | number | Uint8Array<ArrayBufferLike>>>;
}>, 
  | SymmetricCryptoDecryptError
  | ProtocolInvalidDataError
| ProtocolTimestampMismatchError>;

Parameters

ParameterType
messageEncryptedCrdtMessage
keyUint8Array<ArrayBufferLike> & Brand<"Length32"> & Brand<"EncryptionKey">

Returns

Result<Readonly<{ id: string & Brand<"Id">; table: string & Brand<"Base64Url"> & Brand<"MaxLength256">; values: Readonly<Record<string & Brand<"Base64Url"> & Brand<"MaxLength256">, null | string | number | Uint8Array<ArrayBufferLike>>>; }>, | SymmetricCryptoDecryptError | ProtocolInvalidDataError | ProtocolTimestampMismatchError>

Was this page helpful?