©️
Cross api
En-US
En-US
  • Introduction
  • Compatibility
  • Extensions
  • Usage
    • Tools
      • Config
      • ListProvider
      • Language
      • Help
    • Structure
      • MakeApi
      • MakeModule
      • MakeProvider
      • Revert
  • Structure
    • Root
    • Src
    • @Types
    • Assets
    • Config
    • Dtos
    • Jobs
    • Keys
    • Middlewares
    • Modules
    • Routes
    • Shared
    • Utils
  • Services
    • Transactions
    • Exists
    • FindBy
    • FindIn
    • FindLike
    • FindAll
    • Create
    • CreateMany
    • Update
    • UpdateMany
    • Delete
    • DeleteMany
    • SoftDelete
    • SoftDeleteMany
  • Mappers
    • CloneAttribute
    • UpdateAttribute
    • PatchAttribute
    • UpdateString
    • PatchString
    • InsertAttribute
  • Providers
    • Cache
    • Crypto
    • Hash
    • Lead
    • MailTemplate
    • Mail
    • Queue
    • Notification
    • Storage
Powered by GitBook
On this page
  • Available:
  • Methods:

Was this helpful?

  1. Providers

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.

const { content, iv } = this.cryptoProvider.encrypt('12345');

Decrypt: Decrypts an encrypted content from the IV.

const data = this.cryptoProvider.decrypt({ content, iv });

PreviousCacheNextHash

Last updated 6 months ago

Was this helpful?