Skip to content

Commit b158dc8

Browse files
committed
Update /.well-known/webauthn error handling
1 parent 22329b9 commit b158dc8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

dist/well-known.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,16 @@ return Promise.all([
152152
// Related Origin Requests
153153
parseResponse('/.well-known/webauthn', r => {
154154
return r.json().then(data => {
155-
let origins = data.origins ||[];
156-
return { origins };
155+
let result = {
156+
origins: Array.isArray(data.origins) && data.origins.length > 0 ? data.origins : [],
157+
valid: Array.isArray(data.origins) && data.origins.length > 0
158+
};
159+
return result;
160+
}).catch(error => {
161+
return {
162+
error: `Failed to parse JSON: ${error.message}`,
163+
valid: false
164+
};
157165
});
158166
}),
159167
// security

0 commit comments

Comments
 (0)