Updated readme
This commit is contained in:
51
README.md
51
README.md
@@ -25,53 +25,52 @@ const payload = jwt.decode(token)
|
||||
|
||||
```
|
||||
|
||||
<hr>
|
||||
|
||||
### `jwt.sign(payload, secret, [algorithm])`
|
||||
|
||||
Signs a payload and returns the token.
|
||||
|
||||
#### Arguments
|
||||
|
||||
`payload`
|
||||
Argument | Type | Satus | Default | Description
|
||||
----------- | -------- | -------- | ------- | -----------
|
||||
`payload` | `object` | required | - | The payload object
|
||||
`secret` | `string` | required | - | A string which is used to sign the payload.
|
||||
`algorithm` | `string` | optional | `HS256` | The algorithm used to sign the payload, possible values: `HS256` or `HS512`
|
||||
|
||||
The payload object.
|
||||
|
||||
|
||||
`secret`
|
||||
|
||||
A string which is used to sign the payload.
|
||||
|
||||
|
||||
`algorithm` (optional, default: `HS256`)
|
||||
|
||||
The algorithm used to sign the payload, possible values: `HS256` or `HS512`
|
||||
#### `return`
|
||||
returns token as a `string`
|
||||
|
||||
<hr>
|
||||
|
||||
### `jwt.verify(token, secret, [algorithm])`
|
||||
|
||||
Verifies the integrity of the token and returns a boolean value.
|
||||
|
||||
Argument | Type | Satus | Default | Description
|
||||
----------- | -------- | -------- | ------- | -----------
|
||||
`token` | `string` | required | - | The token string generated by `jwt.sign()`.
|
||||
`secret` | `string` | required | - | The string which was used to sign the payload.
|
||||
`algorithm` | `string` | optional | `HS256` | The algorithm used to sign the payload, possible values: `HS256` or `HS512`
|
||||
|
||||
`token`
|
||||
#### `return`
|
||||
returns `boolean`
|
||||
|
||||
The token string generated by `jwt.sign()`.
|
||||
|
||||
|
||||
`secret`
|
||||
|
||||
A string which is used to sign the payload.
|
||||
|
||||
|
||||
`algorithm` (optional, default: `HS256`)
|
||||
|
||||
The algorithm used to sign the payload, possible values: `HS256` or `HS512`
|
||||
<hr>
|
||||
|
||||
### `jwt.decode(token)`
|
||||
|
||||
Returns the payload without verifying the integrity of the token.
|
||||
|
||||
Argument | Type | Satus | Default | Description
|
||||
----------- | -------- | -------- | ------- | -----------
|
||||
`token` | `string` | required | - | The token string generated by `jwt.sign()`.
|
||||
|
||||
`token`
|
||||
#### `return`
|
||||
returns payload `object`
|
||||
|
||||
The token string generated by `jwt.sign()`.
|
||||
<hr>
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
Reference in New Issue
Block a user