2.1.3 • Published 3 months ago

js-pbkdf2 v2.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

js-pbkdf2

PBKDF2Js Create Release publish LICENSE Featured on Openbase

Password-Based Key: This library provides the functionality, and required a password to encrypt and decrypt data, can be use from frontend and backend. It can also send the encrypted data through http request.

Installation

npm i js-pbkdf2

Usage to encrypt and decrypt from frontend

import { encrypt, decrypt } from 'js-pbkdf2';

const encrypted = await encrypt('secret password', JSON.stringify({example: 'example'}));

const encrypt2 = await encrypt('secret password', 'sample string');

const decrypted = await decrypt('secret password', 'WOwy8gEvHxEuLe0wl2A/cA==');

Usage to encrypt and decrypt backend

import { encrypt, decrypt } from 'js-pbkdf2';

const encrypted = await encrypt('secret password', JSON.stringify({example: 'example'}));

const encrypt2 = await encrypt('process.env.SECRET_KEY', 'sample string');

const buf = await encrypt('process.env.SECRET_KEY', JSON.stringify({ id: 1, name: 'test', buffer: Buffer.from('hello'), typeArr: new Uint8Array([1, 2, 3]),}));

const decrypt = await jsPbkdf2.decryptData('process.env.SECRET_KEY', 'WOwy8gEvHxEuLe0wl2A/cA==');

Sent http request

import { encrypt, decrypt } from 'js-pbkdf2';

const encrypted = await encrypt('secret password', JSON.stringify({userName: 'example', password: 'sample'}));

fetch('https://127.0.0.1/api/sample', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Accept': 'application/json',
    },
    body: JSON.stringify(encrypted),    
})

Status

ProjectStatusDescription
jsPbkdf2jsPbkdf2-statusPassword-Based Key encrypt and decrypt
2.1.2

3 months ago

2.0.2

3 months ago

2.1.3

3 months ago

2.0.1

3 months ago

2.0.0

3 months ago

1.1.5

1 year ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago