Skip to main content

CryptoServiceParameters

@webda/core


Class: CryptoServiceParameters

Defined in: packages/core/src/services/icryptoservice.ts:4

Parameters for the CryptoService including key lifecycle, rotation, and algorithm settings

Extends​

Constructors​

Constructor​

new CryptoServiceParameters(): CryptoServiceParameters

Returns​

CryptoServiceParameters

Inherited from​

ServiceParameters.constructor

Properties​

asymetricOptions?​

optional asymetricOptions?: object

Defined in: packages/core/src/services/icryptoservice.ts:40

Options for asymetric generation

modulusLength?​

optional modulusLength?: number

Default​
2048

namedCurve?​

optional namedCurve?: string

Only if asymetricType "ec"

privateKeyEncoding?​

optional privateKeyEncoding?: object

privateKeyEncoding.cipher?​

optional cipher?: string

privateKeyEncoding.format?​

optional format?: "pem"

privateKeyEncoding.passphrase?​

optional passphrase?: string

privateKeyEncoding.type?​

optional type?: "pkcs1" | "pkcs8" | "sec1"

https://nodejs.org/docs/latest-v14.x/api/crypto.html#crypto_keyobject_export_options

Default​
pkcs8

publicKeyEncoding?​

optional publicKeyEncoding?: object

publicKeyEncoding.format?​

optional format?: "pem"

publicKeyEncoding.type?​

optional type?: "spki" | "pkcs1"

Default​
spki

asymetricType​

asymetricType: "rsa" | "dsa" | "ec" | "ed25519" | "ed448" | "x25519" | "x448" | "dh"

Defined in: packages/core/src/services/icryptoservice.ts:36

Type of asymetric key

https://nodejs.org/api/crypto.html#cryptogeneratekeypairsynctype-options https://nodejs.org/docs/latest-v14.x/api/crypto.html#crypto_crypto_generatekeypairsync_type_options


autoCreate?​

optional autoCreate?: boolean

Defined in: packages/core/src/services/icryptoservice.ts:22

Create first set of key if does not exist


autoRotate?​

optional autoRotate?: number

Defined in: packages/core/src/services/icryptoservice.ts:18

Try to rotate keys when they expire in days


jwt?​

optional jwt?: JWTOptions

Defined in: packages/core/src/services/icryptoservice.ts:78

Default JWT options


keyActiveLifespan​

keyActiveLifespan: number

Defined in: packages/core/src/services/icryptoservice.ts:10

Number of hours a key should be used for encryption

if auto-rotate is not set this


keyLifespan​

keyLifespan: number

Defined in: packages/core/src/services/icryptoservice.ts:14

Number of hours allowed to decrypt data encrypted with this key


symetricCipher?​

optional symetricCipher?: string

Defined in: packages/core/src/services/icryptoservice.ts:74

Default​

"aes-256-ctr"

symetricKeyLength?​

optional symetricKeyLength?: number

Defined in: packages/core/src/services/icryptoservice.ts:70

Default​

256

type​

type: string

Defined in: packages/core/src/services/serviceparameters.ts:10

Type of the service

Inherited from​

ServiceParameters.type


url?​

optional url?: string

Defined in: packages/core/src/services/icryptoservice.ts:28

To expose JWKS

See​

https://datatracker.ietf.org/doc/html/rfc7517

Methods​

load()​

load(params?): this

Defined in: packages/core/src/services/icryptoservice.ts:85

Load parameters with defaults for key lengths, ciphers, and JWT options

Parameters​

params?​

any = {}

the service parameters

Returns​

this

this for chaining

Overrides​

ServiceParameters.load


update()​

update(params?, delta): this

Defined in: packages/core/src/services/serviceparameters.ts:35

Update parameters and call watchers if a parameter was changed

Parameters​

params?​

any = {}

the service parameters

delta​

any

the delta

Returns​

this

this for chaining

Inherited from​

ServiceParameters.update


with()​

with(callback): this

Defined in: packages/core/src/services/serviceparameters.ts:65

Watch for changes on the parameters and call watchers when a parameter is changed

Parameters​

callback​

(params) => void

the callback function

Returns​

this

this for chaining

Inherited from​

ServiceParameters.with