From e69c95694e2d8d03ddfe0322c925740d5a943521 Mon Sep 17 00:00:00 2001 From: Julien Le Coupanec Date: Sat, 18 Apr 2020 12:28:32 +0200 Subject: [PATCH] docs(adonis): encryption and hashing --- backend/adonis.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/backend/adonis.js b/backend/adonis.js index 6bf6fde..69bd035 100644 --- a/backend/adonis.js +++ b/backend/adonis.js @@ -301,6 +301,21 @@ Logger.debug(msg[, …​data]) // Print a debug log (level 7). Logger.transport(transport) // Switch transport on the fly. +/******************************************************************************************** +* ENCRYPTION AND HASHING +* https://adonisjs.com/docs/4.1/encryption-and-hashing +********************************************************************************************/ + +const Encryption = use('Encryption') + +Encryption.encrypt(string) // Encrypt a given value. +Encryption.decrypt(string) // Decrypt an encrypted value. + +const Hash = use('Hash') + +await Hash.make(string[, config]) // Hash a plain string value. +await Hash.verify(string, hashedString) // Since you cannot decrypt a hash, you can verify the user input against the previously hashed value. + /******************************************************************************************** * SESSIONS * https://adonisjs.com/docs/sessions