23 lines
445 B
Markdown
23 lines
445 B
Markdown
# @goodgo/auth-sdk
|
|
|
|
Authentication SDK utilities for JWT token management.
|
|
|
|
## Usage
|
|
|
|
```typescript
|
|
import { verifyToken, createToken, isTokenExpired } from '@goodgo/auth-sdk';
|
|
|
|
// Create token
|
|
const token = createToken(
|
|
{ userId: '123', email: 'user@example.com', role: 'USER' },
|
|
'secret',
|
|
'15m'
|
|
);
|
|
|
|
// Verify token
|
|
const payload = verifyToken(token, { secret: 'secret' });
|
|
|
|
// Check expiration
|
|
const expired = isTokenExpired(token);
|
|
```
|