Home Reference Source
public class | since 6.3.0 | source

EncapsulatedKeyManager

this class is experimental. Part of the Client-Side Encrytion preview feature

A manager for encapsulated keys.

EnvelopeEncryptionProfile requires data keys to exist before they can be used for encryption. This manager provides operations for creating and managing such keys.

When creating a key, the manager uses the configured KeyEncapsulationService to generate and encapsulate a new data key and registers the resulting EncapsulatedKeyRecord with the configured EncapsulatedKeyRecordRepository.

Constructor Summary

Public Constructor
public

Method Summary

Public Methods
public

create(name: string): Promise<void>

Creates a new key via the KeyEncapsulationService and saves it in the profile's configured EncapsulatedKeyRecordRepository

public

deleteAliasById(id: string)

Deletes the alias from encapsulated key by id.

public

deleteById(id: string)

Deletes an encapsulated key by id.

public

findByAlias(alias: string): *

Finds an encapsulated key by its alias.

public

findById(id: string): *

Finds an encapsulated key by its id.

public

setAliasById(id: string, alias: string | undefined)

Sets the alias of an encapsulated key by id.

Public Constructors

public constructor() source

Public Methods

public create(name: string): Promise<void> source

Creates a new key via the KeyEncapsulationService and saves it in the profile's configured EncapsulatedKeyRecordRepository

Params:

NameTypeAttributeDescription
name string

The alias the new key should be saved under in the EncapsulatedKeyRecordRepository

Return:

Promise<void>

Promise that resolves when the key is created, saved and ready to use.

public deleteAliasById(id: string) source

Deletes the alias from encapsulated key by id.

Params:

NameTypeAttributeDescription
id string

the key id

public deleteById(id: string) source

Deletes an encapsulated key by id.

Params:

NameTypeAttributeDescription
id string

the key id, must not be {@literal null}

public findByAlias(alias: string): * source

Finds an encapsulated key by its alias.

Params:

NameTypeAttributeDescription
alias string

the key alias

Return:

*

the encapsulated key or undefined when no key with the given alias exists

public findById(id: string): * source

Finds an encapsulated key by its id.

Params:

NameTypeAttributeDescription
id string

the key id

Return:

*

the encapsulated key or undefined when no key with the given id exists

public setAliasById(id: string, alias: string | undefined) source

Sets the alias of an encapsulated key by id. The alias must not be used by another key. To assign an alias currently used by another key, it must first be deleted from that key.

Params:

NameTypeAttributeDescription
id string

the key id

alias string | undefined

the new key alias