3.1.0 • Published 8 months ago

hashing-token v3.1.0

Weekly downloads
-
License
-
Repository
-
Last release
8 months ago

hashing Package

Links

Installation

npm install hashing-token
yarn add hashing-token
pnpm add hashing-token

Features

  • Token Encryption and Decryption: Easily encrypt and decrypt data with secure tokens.
  • Password Hashing: Hash passwords authentication.
  • Verify Hashing: Verify passwords authentication.
  • Random ID Generation: Create random and secure IDs.

import package

/*js (module)*/

const Hashing = require("hashing-token") //or
const { Token , Decode , CreateID , Passwords , Verify } = require("hashing-token")

//ts or js (ES6)
import Hashing from "hashing-token" //or
import { Token , Decode , CreateID , Passwords , Verify } from "hashing-token"

Create Id

CreateID(50 /* not required number default: 20*/)//509849995099545497481015749545

Token

Token("hashing-token"/* required string|array|object*/,"SecrateKey"/* required string*/,"SecrateKey"/*not required string*/)//f903b0aeffcf60b0933533788eafac78.92f5f87136109da77a7d4bfdcb36fb55.......

Decode

Decode("f903b0aeffcf60b0933533788eafac78.92f5f87136109da77a7d4bfdcb36fb55......."/* required string*/,"SecrateKey"/* required string*/,{SecrateKey2:"",MaxAge:1000}/*not required secrete2: string MaxAge: number (1000 = 1s)*/)//hashing-token

Password

Password("hashing-token"/* required string*/,"SecrateKey"/* required string*/,30/*not required number*/)//509849995099545497481015749545

Verify

Verify("hashing-token","509849995099545497481015749545"/*hashing required string*/,"SecrateKey"/* required string*/,30/*not required string*/)//true
Verify("hashing-token","509849995099545497481015749545"/*hashing required string*/,"SecrateKey"/* required string*/,31/*not required string*/)//false
Verify("hashing","509849995099545497481015749545"/*hashing required string*/,"SecrateKey"/* required string*/,30/*not required string*/)//false

add max age in token

import { Decode, Token } from "hashing-token";

let token = Token ("hashing-token","hashing-token-secrete",{MaxAge:3000}/*3s*/);

console.log("token: ",token);

setTimeout(async()=>await console.log("decode after 2s: ",Decode(token,"hashing-token-secrete")),2000);// hashing-token
setTimeout(async()=>await console.log("decode after 5s: ",Decode(token,"hashing-token-secrete")),5000); // the token is expired
1.1.0

8 months ago

3.1.0

8 months ago

3.0.0

8 months ago

2.2.1

8 months ago

2.1.1

8 months ago

2.4.1

8 months ago

2.3.1

8 months ago

2.0.1

8 months ago

2.0.0

8 months ago

1.0.0

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago