Crypto

An implementation of cryptographic features such as data encoding, RSA key generation, and authentication tokens.

Available:

  • Crypto

  • Fake

Methods:

GenerateKeys: Generates a pair of RSA keys and exports them both in PEM format, converts the public key to JWK, and saves all of them to specific files.

this.cryptoProvider.generateKeys();

GenerateRefreshToken: Generates a signed refreshToken from a unique identifier.

const id = uuid();

const data = this.cryptoProvider.generateRefreshToken(id);

GenerateJwtToken: Generates a default jsonWebToken.

const id = uuid();

const data = this.cryptoProvider.generateJwtToken(
  { email: 'emai@mail.com' },
  { subject: id },
);

Encrypt: Encrypts a piece of data passed by parameter.

Decrypt: Decrypts an encrypted content from the IV.


Last updated

Was this helpful?