Skip to content

๐Ÿ”‘ Modern Encrypt / decrypt strings (access tokens, secret names, etc) with a key for node

License

Notifications You must be signed in to change notification settings

morajabi/tiny-crypto-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Tiny Crypto

Simpler (but secure) crypto utility alternative to the native crypto module shipped with Node. Tiny Crypto is only for strings like access tokens, secure names, secure Ids, etc and not meant for passwords! (passwords shouldn't be decryptable therefore use bcrypt)

Install

yarn add tiny-crypto # or npm install tiny-crypto

Use

Keep in mind this is node-only! Here's how you can use it:

// Import!
import TinyCrypto from 'tiny-crypto'

// Init!
const tinyCrypto = new TinyCrypto('secretk3y!') // Ideally from an environment variable

// Use!
const encryptedString = tinyCrypto.encrypt('bacon')
const decryptedString = tinyCrypto.decrypt(encryptedString)

console.log(encryptedString) // 5590fd6409be2494de0226f5d7
console.log(decryptedString) // bacon

Flow Type

I ship a flow type version too, feel free to send a PR if there's any issues. I'm here.

PRs welcome!

Idea

MIT

About

๐Ÿ”‘ Modern Encrypt / decrypt strings (access tokens, secret names, etc) with a key for node

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published