diff --git a/README.md b/README.md index fd6c1e9..a6093c7 100644 --- a/README.md +++ b/README.md @@ -25,53 +25,52 @@ const payload = jwt.decode(token) ``` +
+ ### `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` +
### `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` +
### `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()`. +
## Install