# JWT

#### Creating the instance

```typescript
import { JWT } from '@arcend/auth';

const jwt: JWT = new JWT({secret: "SECRETKEY"});
```

#### Creating token types

```typescript
// jwt.createType(name: string, exp: string)
jwt.createType('session', '12h');
jwt.createType('action', '5m');
```

#### Creating key

```typescript
// jwt.sign(type: string, user?: string)
let tokenNoUser: string   = jwt.sign('action');
let tokenWithUser: string = jwt.sign('action', 'arcend');
```

#### Checking keys

```typescript
// jwt.check(token: string, type: string, user?: string)
let checkNoUser: boolean   = jwt.check('sometoken', 'action');
let checkWithUser: boolean = jwt.check('sometoken', 'action', 'arcend');
```
