Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 1.29 KB

File metadata and controls

28 lines (20 loc) · 1.29 KB

WaEncrypt

a script to securely encode / decode strings

Usage

you need to instantiate the WaEncrypt class, something like: const encrypt = new WaEncrypt()

To encode something

using the previous example of instantiation we call the encode method of the class, this method takes two arguments in the form of a string, the first is a secret and the second a string that you want to encode:


const encrypt = new WaEncrypt()
encrypt.encode('mySecret', 'my text that i want encode')

using a secret literally like 'mySecret' and the literal text 'my string that i want encode', the class return the string :
8G tg)t t0vt 7 dvnt gnu6#g37/735vug85v4vhgqq{8

To decode a string

Take the previous example, now we can use a method decode of the class, this method take two arguments too, the first is your secret used to encode and the second is the encoded string:


const encrypt = new WaEncrypt()
encrypt.decode('mySecret', '8G tg)t t0vt 7 dvnt gnu6#g37/735vug85v4vhgqq{8')

and the return is : 'my text that i want encode'

Secret

It's important that you use a very scrambled string to be your secret

Errors

If you use the wrong secret an object with an error will be show : {message: "Invalid secret"}