UNPKG

@inngest/middleware-encryption

Version:
46 lines (45 loc) 2.04 kB
import { AESEncryptionService } from "./aes"; /** * The default field used to store encrypted data in events. */ export declare const LEGACY_DEFAULT_EVENT_ENCRYPTION_FIELD = "encrypted"; /** * Available types to control the top-level fields of the event that will be * encrypted. Can be a single field name, an array of field names, a function * that returns `true` if a field should be encrypted, or `false` to disable all * event encryption. */ export type LEGACY_EventEncryptionFieldInput = string | string[] | ((field: string) => boolean) | false; export declare namespace LEGACY_V0Service { interface Options { /** * The key or keys used to encrypt and decrypt data. If multiple keys are * provided, the first key will be used to encrypt data and all keys will be * tried when decrypting data. */ key: string | string[]; /** * If `true`, the encryption middleware will only encrypt using the legacy * V0 AES encryption service. This is useful for transitioning all services * to using the new encryption service before then removing the flag and * moving all encryption to LibSodium. */ forceEncryptWithV0: boolean; /** * The top-level fields of the event that will be encrypted. Can be a single * field name, an array of field names, a function that returns `true` if a * field should be encrypted, or `false` to disable all event encryption. * * By default, the top-level field named `"encrypted"` will be encrypted * (exported as `DEFAULT_ENCRYPTION_FIELD`). */ eventEncryptionField?: LEGACY_EventEncryptionFieldInput; } } export declare class LEGACY_V0Service { protected options: LEGACY_V0Service.Options; readonly service: AESEncryptionService; constructor(options: LEGACY_V0Service.Options); fieldShouldBeEncrypted(field: string): boolean; encryptEventData(data: Record<string, unknown>): unknown; }