mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-14 11:25:02 +02:00
Update jwt secret handling
This commit is contained in:
parent
d0d152c20d
commit
8775e55762
6 changed files with 39 additions and 40 deletions
|
@ -157,12 +157,13 @@ class ApiKey extends Model {
|
|||
|
||||
/**
|
||||
* Generate a new api key
|
||||
* @param {string} tokenSecret
|
||||
* @param {string} keyId
|
||||
* @param {string} name
|
||||
* @param {number} [expiresIn] - Seconds until the api key expires or undefined for no expiration
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
static async generateApiKey(keyId, name, expiresIn) {
|
||||
static async generateApiKey(tokenSecret, keyId, name, expiresIn) {
|
||||
const options = {}
|
||||
if (expiresIn && !isNaN(expiresIn) && expiresIn > 0) {
|
||||
options.expiresIn = expiresIn
|
||||
|
@ -175,7 +176,7 @@ class ApiKey extends Model {
|
|||
name,
|
||||
type: 'api'
|
||||
},
|
||||
global.ServerSettings.tokenSecret,
|
||||
tokenSecret,
|
||||
options,
|
||||
(err, token) => {
|
||||
if (err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue