Skip to content

Commit c57d482

Browse files
tsunoyutunetheweb
andauthored
Add support for FedCM, Passkey, and WebAuthn well-known files (#158)
* updated /.well-known/assetlinks.json parsing * updated /.well-known/assetlinks.json parsing and test URLs * Update .markdown-lint.yml * Update pull_request_template.md * Update pull_request_template.md * Update wpt-test.yml * FedCM, passkey, Related Origin Requests * Update dist/well-known.js * Update .github/pull_request_template.md * Restore example.com * Update assetlink.json relation to check array to correctly reflect the setup. * Restore test website example.com * correct lint error for .github/pull_request_template.md * Update /.well-known/web-identity error handling * Update /.well-known/passkey-endpoints error handling * Update /.well-known/webauthn error handling * Removed redundant properties * Update responding with default results. --------- Co-authored-by: Barry Pollard <[email protected]> Co-authored-by: Barry Pollard <[email protected]>
1 parent 8750d94 commit c57d482

File tree

1 file changed

+54
-2
lines changed

1 file changed

+54
-2
lines changed

dist/well-known.js

+54-2
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ return Promise.all([
8686
let hasDeepLinking = false;
8787
let hasCredentialSharing = false;
8888
data.forEach(statement => {
89-
if (statement.relation === 'delegate_permission/common.handle_all_urls') {
89+
if (statement.relation.includes('delegate_permission/common.handle_all_urls')) {
9090
hasDeepLinking = true;
91-
} else if (statement.relation === 'delegate_permission/common.get_login_creds') {
91+
}
92+
if (statement.relation.includes('delegate_permission/common.get_login_creds')) {
9293
hasCredentialSharing = true;
9394
}
9495
});
@@ -115,6 +116,57 @@ return Promise.all([
115116
return data;
116117
});
117118
}),
119+
// FedCM
120+
parseResponse('/.well-known/web-identity', r => {
121+
return r.text().then(text => {
122+
let result = {
123+
provider_urls: [],
124+
accounts_endpoint: null,
125+
login_url: null
126+
};
127+
try {
128+
let data = JSON.parse(text);
129+
result.provider_urls = Array.isArray(data.provider_urls) && data.provider_urls.length > 0 ? data.provider_urls : [];
130+
result.accounts_endpoint = data.accounts_endpoint || null;
131+
result.login_url = data.login_url || null;
132+
} catch (e) {
133+
// Failed to parse JSON
134+
}
135+
return result;
136+
});
137+
}),
138+
// Passkey
139+
parseResponse('/.well-known/passkey-endpoints', r => {
140+
return r.text().then(text => {
141+
let result = {
142+
enroll: null,
143+
manage: null
144+
};
145+
try {
146+
let data = JSON.parse(text);
147+
result.enroll = data.enroll || null;
148+
result.manage = data.manage || null;
149+
} catch (e) {
150+
// Failed to parse JSON
151+
}
152+
return result;
153+
});
154+
}),
155+
// Related Origin Requests
156+
parseResponse('/.well-known/webauthn', r => {
157+
return r.text().then(text => {
158+
let result = {
159+
origins: []
160+
};
161+
try {
162+
let data = JSON.parse(text);
163+
result.origins = Array.isArray(data.origins) && data.origins.length > 0 ? data.origins : [];
164+
} catch (e) {
165+
// Failed to parse JSON
166+
}
167+
return result;
168+
});
169+
}),
118170
// security
119171
parseResponse('/robots.txt', r => {
120172
return r.text().then(text => {

0 commit comments

Comments
 (0)