mirror of
https://codeberg.org/keyoxide/keyoxide-web.git
synced 2024-12-22 14:59:29 -07:00
fix: Add checks for users in keys
This commit is contained in:
parent
01389957fb
commit
f418b6cf8f
2 changed files with 43 additions and 21 deletions
|
@ -196,6 +196,11 @@ const doVerification = async (data) => {
|
|||
}
|
||||
}
|
||||
|
||||
// Return early if no users in key
|
||||
if (!data.keyData.users) {
|
||||
return data
|
||||
}
|
||||
|
||||
for (let iUser = 0; iUser < data.keyData.users.length; iUser++) {
|
||||
const user = data.keyData.users[iUser]
|
||||
|
||||
|
@ -225,6 +230,7 @@ const doVerification = async (data) => {
|
|||
const sanitize = (data) => {
|
||||
const dataClone = JSON.parse(JSON.stringify(data))
|
||||
|
||||
if (dataClone.keyData.users) {
|
||||
for (let iUser = 0; iUser < dataClone.keyData.users.length; iUser++) {
|
||||
const user = dataClone.keyData.users[iUser]
|
||||
|
||||
|
@ -252,6 +258,7 @@ const sanitize = (data) => {
|
|||
data.keyData.users[iUser].claims[iClaim] = claim
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const valid = apiProfileValidate(data)
|
||||
if (!valid) {
|
||||
|
@ -262,6 +269,11 @@ const sanitize = (data) => {
|
|||
}
|
||||
|
||||
const addSummaryToClaims = (data) => {
|
||||
// Return early if no users in key
|
||||
if (!data.keyData.users) {
|
||||
return data
|
||||
}
|
||||
|
||||
// To be removed when data is added by DOIP library
|
||||
for (let userIndex = 0; userIndex < data.keyData.users.length; userIndex++) {
|
||||
const user = data.keyData.users[userIndex]
|
||||
|
|
|
@ -199,6 +199,11 @@ const doVerification = async (data) => {
|
|||
}
|
||||
}
|
||||
|
||||
// Return early if no users in key
|
||||
if (!data.keyData.users) {
|
||||
return data
|
||||
}
|
||||
|
||||
for (let iUser = 0; iUser < data.keyData.users.length; iUser++) {
|
||||
const user = data.keyData.users[iUser]
|
||||
|
||||
|
@ -235,6 +240,11 @@ const sanitize = (data) => {
|
|||
}
|
||||
|
||||
const addSummaryToClaims = (data) => {
|
||||
// Return early if no users in key
|
||||
if (!data.keyData.users) {
|
||||
return data
|
||||
}
|
||||
|
||||
// To be removed when data is added by DOIP library
|
||||
for (let userIndex = 0; userIndex < data.keyData.users.length; userIndex++) {
|
||||
const user = data.keyData.users[userIndex]
|
||||
|
|
Loading…
Reference in a new issue