1.1.2 • Published 1 year ago

typescript-auth v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Auth TypeScript

Description

Auth TypeScript is an authentication package for TypeScript applications. It provides a class for handling user authentication and token generation/verification using JSON Web Tokens (JWT).

Installation

You can install Auth TypeScript via npm:

npm install typescript-auth

import { Authentication, User, AuthConfig } from 'typescript-auth';
interface CustomUser extends User {
    username: string;
}
const authConfig: AuthConfig = {
    secretKey: 'your_secret_key_here',
    expiresIn: '1h'
};
const auth = new Authentication<CustomUser>(authConfig);
const user: CustomUser = {
    email: 'example@example.com',
    username: 'example_user'
};
// Login
const token = auth.login(user);
console.log('Generated token:', token);
// Verify
const isTokenValid = auth.verify(token!);
console.log('Is token valid?', isTokenValid);
1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago