encryption
encryption is a module in @cipherstash/stack. TypeScript API reference with its signature, parameters, and usage.
encryption
Classes
BatchEncryptQueryOperation
Defined in: encryption/operations/batch-encrypt-query.ts:98
Extends
EncryptionOperation<EncryptedQueryResult[]>
Constructors
Constructor
new BatchEncryptQueryOperation(client, terms): BatchEncryptQueryOperation;Defined in: encryption/operations/batch-encrypt-query.ts:101
Parameters
client
terms
readonly ScalarQueryTerm[]
Returns
Overrides
EncryptionOperation<
EncryptedQueryResult[]
>.constructorMethods
audit()
audit(config): this;Defined in: encryption/operations/base-operation.ts:20
Attach audit metadata to this operation. Can be chained.
Parameters
config
Configuration for ZeroKMS audit logging
Returns
this
Inherited from
EncryptionOperation.auditgetAuditData()
getAuditData(): AuditData;Defined in: encryption/operations/base-operation.ts:28
Get the audit data for this operation.
Returns
AuditData
Inherited from
EncryptionOperation.getAuditDatathen()
then<TResult1, TResult2>(onfulfilled?, onrejected?): Promise<TResult1 | TResult2>;Defined in: encryption/operations/base-operation.ts:42
Make the operation thenable
Type Parameters
TResult1
TResult1 = Result<EncryptedQueryResult[], EncryptionError>
TResult2
TResult2 = never
Parameters
onfulfilled?
(value) => TResult1 | PromiseLike<TResult1> | null
onrejected?
(reason) => TResult2 | PromiseLike<TResult2> | null
Returns
Promise<TResult1 | TResult2>
Inherited from
EncryptionOperation.thenwithLockContext()
withLockContext(lockContext): BatchEncryptQueryOperationWithLockContext;Defined in: encryption/operations/batch-encrypt-query.ts:108
Parameters
lockContext
Returns
BatchEncryptQueryOperationWithLockContext
execute()
execute(): Promise<Result<EncryptedQueryResult[], EncryptionError>>;Defined in: encryption/operations/batch-encrypt-query.ts:119
Execute the operation and return a Result
Returns
Promise<Result<EncryptedQueryResult[], EncryptionError>>
Overrides
EncryptionOperation.executeBulkDecryptModelsOperation
Defined in: encryption/operations/bulk-decrypt-models.ts:14
Extends
EncryptionOperation<Decrypted<T>[]>
Type Parameters
T
T extends Record<string, unknown>
Constructors
Constructor
new BulkDecryptModelsOperation<T>(client, models): BulkDecryptModelsOperation<T>;Defined in: encryption/operations/bulk-decrypt-models.ts:20
Parameters
client
models
T[]
Returns
Overrides
EncryptionOperation<Decrypted<T>[]>.constructorMethods
audit()
audit(config): this;Defined in: encryption/operations/base-operation.ts:20
Attach audit metadata to this operation. Can be chained.
Parameters
config
Configuration for ZeroKMS audit logging
Returns
this
Inherited from
EncryptionOperation.auditgetAuditData()
getAuditData(): AuditData;Defined in: encryption/operations/base-operation.ts:28
Get the audit data for this operation.
Returns
AuditData
Inherited from
EncryptionOperation.getAuditDatathen()
then<TResult1, TResult2>(onfulfilled?, onrejected?): Promise<TResult1 | TResult2>;Defined in: encryption/operations/base-operation.ts:42
Make the operation thenable
Type Parameters
TResult1
TResult1 = Result<Decrypted<T>[], EncryptionError>
TResult2
TResult2 = never
Parameters
onfulfilled?
(value) => TResult1 | PromiseLike<TResult1> | null
onrejected?
(reason) => TResult2 | PromiseLike<TResult2> | null
Returns
Promise<TResult1 | TResult2>
Inherited from
EncryptionOperation.thenwithLockContext()
withLockContext(lockContext): BulkDecryptModelsOperationWithLockContext<T>;Defined in: encryption/operations/bulk-decrypt-models.ts:26
Parameters
lockContext
Returns
BulkDecryptModelsOperationWithLockContext<T>
execute()
execute(): Promise<Result<Decrypted<T>[], EncryptionError>>;Defined in: encryption/operations/bulk-decrypt-models.ts:32
Execute the operation and return a Result
Returns
Promise<Result<Decrypted<T>[], EncryptionError>>
Overrides
EncryptionOperation.executegetOperation()
getOperation(): {
client: Client;
models: T[];
};Defined in: encryption/operations/bulk-decrypt-models.ts:63
Returns
{
client: Client;
models: T[];
}client
client: Client;models
models: T[];BulkDecryptOperation
Defined in: encryption/operations/bulk-decrypt.ts:60
Extends
EncryptionOperation<BulkDecryptedData>
Constructors
Constructor
new BulkDecryptOperation(client, encryptedPayloads): BulkDecryptOperation;Defined in: encryption/operations/bulk-decrypt.ts:64
Parameters
client
encryptedPayloads
Returns
Overrides
EncryptionOperation<BulkDecryptedData>.constructorMethods
audit()
audit(config): this;Defined in: encryption/operations/base-operation.ts:20
Attach audit metadata to this operation. Can be chained.
Parameters
config
Configuration for ZeroKMS audit logging
Returns
this
Inherited from
EncryptionOperation.auditgetAuditData()
getAuditData(): AuditData;Defined in: encryption/operations/base-operation.ts:28
Get the audit data for this operation.
Returns
AuditData
Inherited from
EncryptionOperation.getAuditDatathen()
then<TResult1, TResult2>(onfulfilled?, onrejected?): Promise<TResult1 | TResult2>;Defined in: encryption/operations/base-operation.ts:42
Make the operation thenable
Type Parameters
TResult1
TResult1 = Result<BulkDecryptedData, EncryptionError>
TResult2
TResult2 = never
Parameters
onfulfilled?
(value) => TResult1 | PromiseLike<TResult1> | null
onrejected?
(reason) => TResult2 | PromiseLike<TResult2> | null
Returns
Promise<TResult1 | TResult2>
Inherited from
EncryptionOperation.thenwithLockContext()
withLockContext(lockContext): BulkDecryptOperationWithLockContext;Defined in: encryption/operations/bulk-decrypt.ts:70
Parameters
lockContext
Returns
BulkDecryptOperationWithLockContext
execute()
execute(): Promise<Result<BulkDecryptedData, EncryptionError>>;Defined in: encryption/operations/bulk-decrypt.ts:76
Execute the operation and return a Result
Returns
Promise<Result<BulkDecryptedData, EncryptionError>>
Overrides
EncryptionOperation.executegetOperation()
getOperation(): {
client: Client;
encryptedPayloads: BulkDecryptPayload;
};Defined in: encryption/operations/bulk-decrypt.ts:118
Returns
{
client: Client;
encryptedPayloads: BulkDecryptPayload;
}client
client: Client;encryptedPayloads
encryptedPayloads: BulkDecryptPayload;BulkEncryptModelsOperation
Defined in: encryption/operations/bulk-encrypt-models.ts:14
Extends
EncryptionOperation<T[]>
Type Parameters
T
T extends Record<string, unknown>
Constructors
Constructor
new BulkEncryptModelsOperation<T>(
client,
models,
table): BulkEncryptModelsOperation<T>;Defined in: encryption/operations/bulk-encrypt-models.ts:21
Parameters
client
models
Record<string, unknown>[]
table
BuildableTable
Returns
Overrides
EncryptionOperation<T[]>.constructorMethods
audit()
audit(config): this;Defined in: encryption/operations/base-operation.ts:20
Attach audit metadata to this operation. Can be chained.
Parameters
config
Configuration for ZeroKMS audit logging
Returns
this
Inherited from
EncryptionOperation.auditgetAuditData()
getAuditData(): AuditData;Defined in: encryption/operations/base-operation.ts:28
Get the audit data for this operation.
Returns
AuditData
Inherited from
EncryptionOperation.getAuditDatathen()
then<TResult1, TResult2>(onfulfilled?, onrejected?): Promise<TResult1 | TResult2>;Defined in: encryption/operations/base-operation.ts:42
Make the operation thenable
Type Parameters
TResult1
TResult1 = Result<T[], EncryptionError>
TResult2
TResult2 = never
Parameters
onfulfilled?
(value) => TResult1 | PromiseLike<TResult1> | null
onrejected?
(reason) => TResult2 | PromiseLike<TResult2> | null
Returns
Promise<TResult1 | TResult2>
Inherited from
EncryptionOperation.thenwithLockContext()
withLockContext(lockContext): BulkEncryptModelsOperationWithLockContext<T>;Defined in: encryption/operations/bulk-encrypt-models.ts:32
Parameters
lockContext
Returns
BulkEncryptModelsOperationWithLockContext<T>
execute()
execute(): Promise<Result<T[], EncryptionError>>;Defined in: encryption/operations/bulk-encrypt-models.ts:38
Execute the operation and return a Result
Returns
Promise<Result<T[], EncryptionError>>
Overrides
EncryptionOperation.executegetOperation()
getOperation(): {
client: Client;
models: Record<string, unknown>[];
table: BuildableTable;
};Defined in: encryption/operations/bulk-encrypt-models.ts:75
Returns
{
client: Client;
models: Record<string, unknown>[];
table: BuildableTable;
}client
client: Client;models
models: Record<string, unknown>[];table
table: BuildableTable;BulkEncryptOperation
Defined in: encryption/operations/bulk-encrypt.ts:73
Extends
EncryptionOperation<BulkEncryptedData>
Constructors
Constructor
new BulkEncryptOperation(
client,
plaintexts,
opts): BulkEncryptOperation;Defined in: encryption/operations/bulk-encrypt.ts:79
Parameters
client
plaintexts
opts
Returns
Overrides
EncryptionOperation<BulkEncryptedData>.constructorMethods
audit()
audit(config): this;Defined in: encryption/operations/base-operation.ts:20
Attach audit metadata to this operation. Can be chained.
Parameters
config
Configuration for ZeroKMS audit logging
Returns
this
Inherited from
EncryptionOperation.auditgetAuditData()
getAuditData(): AuditData;Defined in: encryption/operations/base-operation.ts:28
Get the audit data for this operation.
Returns
AuditData
Inherited from
EncryptionOperation.getAuditDatathen()
then<TResult1, TResult2>(onfulfilled?, onrejected?): Promise<TResult1 | TResult2>;Defined in: encryption/operations/base-operation.ts:42
Make the operation thenable
Type Parameters
TResult1
TResult1 = Result<BulkEncryptedData, EncryptionError>
TResult2
TResult2 = never
Parameters
onfulfilled?
(value) => TResult1 | PromiseLike<TResult1> | null
onrejected?
(reason) => TResult2 | PromiseLike<TResult2> | null
Returns
Promise<TResult1 | TResult2>
Inherited from
EncryptionOperation.thenwithLockContext()
withLockContext(lockContext): BulkEncryptOperationWithLockContext;Defined in: encryption/operations/bulk-encrypt.ts:91
Parameters
lockContext
Returns
BulkEncryptOperationWithLockContext
execute()
execute(): Promise<Result<BulkEncryptedData, EncryptionError>>;Defined in: encryption/operations/bulk-encrypt.ts:97
Execute the operation and return a Result
Returns
Promise<Result<BulkEncryptedData, EncryptionError>>
Overrides
EncryptionOperation.executegetOperation()
getOperation(): {
client: Client;
plaintexts: BulkEncryptPayload;
column: BuildableColumn;
table: BuildableTable;
};Defined in: encryption/operations/bulk-encrypt.ts:148
Returns
{
client: Client;
plaintexts: BulkEncryptPayload;
column: BuildableColumn;
table: BuildableTable;
}client
client: Client;plaintexts
plaintexts: BulkEncryptPayload;column
column: BuildableColumn;table
table: BuildableTable;DecryptModelOperation
Defined in: encryption/operations/decrypt-model.ts:14
Extends
EncryptionOperation<Decrypted<T>>
Type Parameters
T
T extends Record<string, unknown>
Constructors
Constructor
new DecryptModelOperation<T>(client, model): DecryptModelOperation<T>;Defined in: encryption/operations/decrypt-model.ts:20
Parameters
client
model
T
Returns
Overrides
EncryptionOperation<Decrypted<T>>.constructorMethods
audit()
audit(config): this;Defined in: encryption/operations/base-operation.ts:20
Attach audit metadata to this operation. Can be chained.
Parameters
config
Configuration for ZeroKMS audit logging
Returns
this
Inherited from
EncryptionOperation.auditgetAuditData()
getAuditData(): AuditData;Defined in: encryption/operations/base-operation.ts:28
Get the audit data for this operation.
Returns
AuditData
Inherited from
EncryptionOperation.getAuditDatathen()
then<TResult1, TResult2>(onfulfilled?, onrejected?): Promise<TResult1 | TResult2>;Defined in: encryption/operations/base-operation.ts:42
Make the operation thenable
Type Parameters
TResult1
TResult1 = Result<Decrypted<T>, EncryptionError>
TResult2
TResult2 = never
Parameters
onfulfilled?
(value) => TResult1 | PromiseLike<TResult1> | null
onrejected?
(reason) => TResult2 | PromiseLike<TResult2> | null
Returns
Promise<TResult1 | TResult2>
Inherited from
EncryptionOperation.thenwithLockContext()
withLockContext(lockContext): DecryptModelOperationWithLockContext<T>;Defined in: encryption/operations/decrypt-model.ts:26
Parameters
lockContext
Returns
DecryptModelOperationWithLockContext<T>
execute()
execute(): Promise<Result<Decrypted<T>, EncryptionError>>;Defined in: encryption/operations/decrypt-model.ts:32
Execute the operation and return a Result
Returns
Promise<Result<Decrypted<T>, EncryptionError>>
Overrides
EncryptionOperation.executegetOperation()
getOperation(): {
client: Client;
model: T;
};Defined in: encryption/operations/decrypt-model.ts:62
Returns
{
client: Client;
model: T;
}client
client: Client;model
model: T;DecryptOperation
Defined in: encryption/operations/decrypt.ts:18
Decrypts an encrypted payload using the provided client. This is the type returned by the decrypt method of the EncryptionClient.
Extends
EncryptionOperation<JsPlaintext>
Constructors
Constructor
new DecryptOperation(client, encryptedData): DecryptOperation;Defined in: encryption/operations/decrypt.ts:26
Parameters
client
encryptedData
EncryptedPayload | null
Returns
Overrides
EncryptionOperation<JsPlaintext>.constructorMethods
audit()
audit(config): this;Defined in: encryption/operations/base-operation.ts:20
Attach audit metadata to this operation. Can be chained.
Parameters
config
Configuration for ZeroKMS audit logging
Returns
this
Inherited from
EncryptionOperation.auditgetAuditData()
getAuditData(): AuditData;Defined in: encryption/operations/base-operation.ts:28
Get the audit data for this operation.
Returns
AuditData
Inherited from
EncryptionOperation.getAuditDatathen()
then<TResult1, TResult2>(onfulfilled?, onrejected?): Promise<TResult1 | TResult2>;Defined in: encryption/operations/base-operation.ts:42
Make the operation thenable
Type Parameters
TResult1
TResult1 = Result<JsPlaintext, EncryptionError>
TResult2
TResult2 = never
Parameters
onfulfilled?
(value) => TResult1 | PromiseLike<TResult1> | null
onrejected?
(reason) => TResult2 | PromiseLike<TResult2> | null
Returns
Promise<TResult1 | TResult2>
Inherited from
EncryptionOperation.thenwithLockContext()
withLockContext(lockContext): DecryptOperationWithLockContext;Defined in: encryption/operations/decrypt.ts:32
Parameters
lockContext
Returns
DecryptOperationWithLockContext
execute()
execute(): Promise<Result<JsPlaintext, EncryptionError>>;Defined in: encryption/operations/decrypt.ts:38
Execute the operation and return a Result
Returns
Promise<Result<JsPlaintext, EncryptionError>>
Overrides
EncryptionOperation.executegetOperation()
getOperation(): {
client: Client;
encryptedData: EncryptedPayload | null;
auditData?: Record<string, unknown>;
};Defined in: encryption/operations/decrypt.ts:76
Returns
{
client: Client;
encryptedData: EncryptedPayload | null;
auditData?: Record<string, unknown>;
}client
client: Client;encryptedData
encryptedData: EncryptedPayload | null;auditData?
optional auditData: Record<string, unknown>;EncryptModelOperation
Defined in: encryption/operations/encrypt-model.ts:14
Extends
EncryptionOperation<T>
Type Parameters
T
T extends Record<string, unknown>
Constructors
Constructor
new EncryptModelOperation<T>(
client,
model,
table): EncryptModelOperation<T>;Defined in: encryption/operations/encrypt-model.ts:21
Parameters
client
model
Record<string, unknown>
table
BuildableTable
Returns
Overrides
EncryptionOperation<T>.constructorMethods
audit()
audit(config): this;Defined in: encryption/operations/base-operation.ts:20
Attach audit metadata to this operation. Can be chained.
Parameters
config
Configuration for ZeroKMS audit logging
Returns
this
Inherited from
EncryptionOperation.auditgetAuditData()
getAuditData(): AuditData;Defined in: encryption/operations/base-operation.ts:28
Get the audit data for this operation.
Returns
AuditData
Inherited from
EncryptionOperation.getAuditDatathen()
then<TResult1, TResult2>(onfulfilled?, onrejected?): Promise<TResult1 | TResult2>;Defined in: encryption/operations/base-operation.ts:42
Make the operation thenable
Type Parameters
TResult1
TResult1 = Result<T, EncryptionError>
TResult2
TResult2 = never
Parameters
onfulfilled?
(value) => TResult1 | PromiseLike<TResult1> | null
onrejected?
(reason) => TResult2 | PromiseLike<TResult2> | null
Returns
Promise<TResult1 | TResult2>
Inherited from
EncryptionOperation.thenwithLockContext()
withLockContext(lockContext): EncryptModelOperationWithLockContext<T>;Defined in: encryption/operations/encrypt-model.ts:32
Parameters
lockContext
Returns
EncryptModelOperationWithLockContext<T>
execute()
execute(): Promise<Result<T, EncryptionError>>;Defined in: encryption/operations/encrypt-model.ts:38
Execute the operation and return a Result
Returns
Promise<Result<T, EncryptionError>>
Overrides
EncryptionOperation.executegetOperation()
getOperation(): {
client: Client;
model: Record<string, unknown>;
table: BuildableTable;
};Defined in: encryption/operations/encrypt-model.ts:74
Returns
{
client: Client;
model: Record<string, unknown>;
table: BuildableTable;
}client
client: Client;model
model: Record<string, unknown>;table
table: BuildableTable;EncryptQueryOperation
Defined in: encryption/operations/encrypt-query.ts:26
Extends
EncryptionOperation<EncryptedQueryResult>
Constructors
Constructor
new EncryptQueryOperation(
client,
plaintext,
opts): EncryptQueryOperation;Defined in: encryption/operations/encrypt-query.ts:27
Parameters
client
plaintext
Plaintext | null | undefined
opts
QueryTermBase
Returns
Overrides
EncryptionOperation<EncryptedQueryResult>.constructorMethods
audit()
audit(config): this;Defined in: encryption/operations/base-operation.ts:20
Attach audit metadata to this operation. Can be chained.
Parameters
config
Configuration for ZeroKMS audit logging
Returns
this
Inherited from
EncryptionOperation.auditgetAuditData()
getAuditData(): AuditData;Defined in: encryption/operations/base-operation.ts:28
Get the audit data for this operation.
Returns
AuditData
Inherited from
EncryptionOperation.getAuditDatathen()
then<TResult1, TResult2>(onfulfilled?, onrejected?): Promise<TResult1 | TResult2>;Defined in: encryption/operations/base-operation.ts:42
Make the operation thenable
Type Parameters
TResult1
TResult1 = Result<EncryptedQueryResult, EncryptionError>
TResult2
TResult2 = never
Parameters
onfulfilled?
(value) => TResult1 | PromiseLike<TResult1> | null
onrejected?
(reason) => TResult2 | PromiseLike<TResult2> | null
Returns
Promise<TResult1 | TResult2>
Inherited from
EncryptionOperation.thenwithLockContext()
withLockContext(lockContext): EncryptQueryOperationWithLockContext;Defined in: encryption/operations/encrypt-query.ts:35
Parameters
lockContext
Returns
EncryptQueryOperationWithLockContext
execute()
execute(): Promise<Result<EncryptedQueryResult, EncryptionError>>;Defined in: encryption/operations/encrypt-query.ts:47
Execute the operation and return a Result
Returns
Promise<Result<EncryptedQueryResult, EncryptionError>>
Overrides
EncryptionOperation.executegetOperation()
getOperation(): {
client: Client;
plaintext: Plaintext | null | undefined;
column: BuildableQueryColumn;
table: BuildableTable;
queryType?: QueryTypeName;
returnType?: EncryptedReturnType;
};Defined in: encryption/operations/encrypt-query.ts:119
Returns
{
client: Client;
plaintext: Plaintext | null | undefined;
column: BuildableQueryColumn;
table: BuildableTable;
queryType?: QueryTypeName;
returnType?: EncryptedReturnType;
}client
client: Client;plaintext
plaintext: Plaintext | null | undefined;column
column: BuildableQueryColumn;table
table: BuildableTable;queryType?
optional queryType: QueryTypeName;returnType?
optional returnType: EncryptedReturnType;EncryptOperation
Defined in: encryption/operations/encrypt.ts:22
Extends
EncryptionOperation<Encrypted>
Constructors
Constructor
new EncryptOperation(
client,
plaintext,
opts): EncryptOperation;Defined in: encryption/operations/encrypt.ts:32
Parameters
client
plaintext
Plaintext | null
opts
Returns
Overrides
EncryptionOperation<Encrypted>.constructorMethods
audit()
audit(config): this;Defined in: encryption/operations/base-operation.ts:20
Attach audit metadata to this operation. Can be chained.
Parameters
config
Configuration for ZeroKMS audit logging
Returns
this
Inherited from
EncryptionOperation.auditgetAuditData()
getAuditData(): AuditData;Defined in: encryption/operations/base-operation.ts:28
Get the audit data for this operation.
Returns
AuditData
Inherited from
EncryptionOperation.getAuditDatathen()
then<TResult1, TResult2>(onfulfilled?, onrejected?): Promise<TResult1 | TResult2>;Defined in: encryption/operations/base-operation.ts:42
Make the operation thenable
Type Parameters
TResult1
TResult1 = Result<EncryptedPayload, EncryptionError>
TResult2
TResult2 = never
Parameters
onfulfilled?
(value) => TResult1 | PromiseLike<TResult1> | null
onrejected?
(reason) => TResult2 | PromiseLike<TResult2> | null
Returns
Promise<TResult1 | TResult2>
Inherited from
EncryptionOperation.thenwithLockContext()
withLockContext(lockContext): EncryptOperationWithLockContext;Defined in: encryption/operations/encrypt.ts:44
Parameters
lockContext
Returns
EncryptOperationWithLockContext
execute()
execute(): Promise<Result<EncryptedPayload, EncryptionError>>;Defined in: encryption/operations/encrypt.ts:50
Execute the operation and return a Result
Returns
Promise<Result<EncryptedPayload, EncryptionError>>
Overrides
EncryptionOperation.executegetOperation()
getOperation(): {
client: Client;
plaintext: Plaintext | null;
column: BuildableColumn;
table: BuildableTable;
};Defined in: encryption/operations/encrypt.ts:102
Returns
{
client: Client;
plaintext: Plaintext | null;
column: BuildableColumn;
table: BuildableTable;
}client
client: Client;plaintext
plaintext: Plaintext | null;column
column: BuildableColumn;table
table: BuildableTable;Functions
noClientError()
function noClientError(): Error;Defined in: encryption/index.ts:64
Returns
Error
Encryption()
Call Signature
function Encryption<S>(config): Promise<EncryptionClient<S>>;Defined in: encryption/index.ts:870
Type Parameters
S
S extends readonly [AnyV3Table, AnyV3Table]
Parameters
config
schemas
S
config?
Returns
Promise<EncryptionClient<S>>
Call Signature
function Encryption<S>(config): Promise<EncryptionClient<S>>;Defined in: encryption/index.ts:873
Type Parameters
S
S extends readonly AnyV3Table[]
Parameters
config
schemas
NonEmptyV3<S>
config?
Returns
Promise<EncryptionClient<S>>
References
EncryptionClient
Re-exports EncryptionClient