fix(backend): Avoid async issues when returning key list
This commit is contained in:
parent
f3584eee43
commit
06bcf8a656
1 changed files with 8 additions and 3 deletions
|
@ -165,9 +165,14 @@ ApikeyModel.prototype.userApikeys = async function (uid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Keys are an array, remove sercrets with map() and decrypt prior to returning
|
* Keys are an array, remove secrets with map() and decrypt prior to returning
|
||||||
*/
|
*/
|
||||||
return keys.map((key) => this.asKeyData(key))
|
const list = []
|
||||||
|
for (const key of keys) {
|
||||||
|
list.push(await this.asKeyData(key))
|
||||||
|
}
|
||||||
|
|
||||||
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -176,7 +181,7 @@ ApikeyModel.prototype.userApikeys = async function (uid) {
|
||||||
ApikeyModel.prototype.asKeyData = async function (key) {
|
ApikeyModel.prototype.asKeyData = async function (key) {
|
||||||
delete key.secret
|
delete key.secret
|
||||||
delete key.aud
|
delete key.aud
|
||||||
key.name = this.decrypt(key.name)
|
key.name = await this.decrypt(key.name)
|
||||||
|
|
||||||
return key
|
return key
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue