Skip to main content

StringEncrypter

@webda/core


Interface: StringEncrypter

Defined in: packages/core/src/services/cryptoservice.service.ts:360

Encrypt/Decrypt string

The encrypted output is stored after crypt:<encrypter>: in a configuration file: it must be a single-line string.

Methods​

configure()?​

optional configure(options, context): void | Promise<void>

Defined in: packages/core/src/services/cryptoservice.service.ts:370

Optional: receive parameters.configurationEncryption.encrypters[<name>] before the first encrypt or decrypt of a configuration

It can be called again when the configuration changes.

Parameters​

options​

any

the encrypter options, an empty object if not set

context​

EncrypterContext

the application path and the mode

Returns​

void | Promise<void>


decrypt()​

decrypt(data, options?): Promise<string>

Defined in: packages/core/src/services/cryptoservice.service.ts:396

Decrypt a string

It must throw if the data cannot be decrypted, never return garbage.

Parameters​

data​

string

the encrypted value

options?​

any

encrypter specific options

Returns​

Promise<string>

the plain value


encrypt()​

encrypt(data, options?): Promise<string>

Defined in: packages/core/src/services/cryptoservice.service.ts:386

Encrypt a string

Parameters​

data​

string

the plain value

options?​

any

encrypter specific options

Returns​

Promise<string>

the encrypted value


needsUpgrade()?​

optional needsUpgrade(data): boolean

Defined in: packages/core/src/services/cryptoservice.service.ts:379

Optional: tell if an encrypted value must be re-encrypted by webda config encrypt --upgrade

Every value is re-encrypted when it is not implemented.

Parameters​

data​

string

the encrypted value

Returns​

boolean

true to re-encrypt it