Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7df24c0
Make sure metadata statements are fresh
MasterKale Sep 25, 2026
5898c94
Add convenience MDS types
MasterKale Oct 8, 2026
cc083e6
Add new convenienceMDSServers arg to initialize
MasterKale Oct 8, 2026
283cee6
Add missing logger arg docs
MasterKale Oct 8, 2026
e30d2d1
Add internal cache for convenience metadata
MasterKale Oct 8, 2026
5c98694
Add conveniencePayloads args for local payloads
MasterKale Oct 8, 2026
5f233df
Add cacheConvenienceMDS to centralize caching
MasterKale Oct 8, 2026
f199e1c
Add a method to download convenience MDS data
MasterKale Oct 8, 2026
9d75078
Load local payloads first
MasterKale Oct 8, 2026
f8cfd2e
Download convenience metadata from live servers
MasterKale Oct 8, 2026
19b010b
Make some minor code quality tweaks
MasterKale Oct 8, 2026
0e1e237
Update MetadataService interface definition
MasterKale Oct 8, 2026
eb7fb52
Refactor MDS caching to use helper method
MasterKale Oct 8, 2026
4a8c542
Cache convenience metadata from standard MDS data
MasterKale Oct 8, 2026
68b3da1
Define getProviderMetadata()
MasterKale Oct 8, 2026
057a94f
Update existing MDS tests
MasterKale Oct 8, 2026
23b127e
Oops these are the actual new C-MDS types
MasterKale Oct 8, 2026
a4b4b6a
Add tests for new initialize args
MasterKale Oct 8, 2026
cd493a2
Be more judicious about cache resets in initialize
MasterKale Oct 8, 2026
5675357
Tighten up typing on caches
MasterKale Oct 8, 2026
8f31744
Fix a missing 0 from CMDS nextUpdates
MasterKale Oct 8, 2026
19f4e52
Add getProviderMetadata() tests
MasterKale Oct 8, 2026
2ad4125
Codify and test server data overwriting local data
MasterKale Oct 8, 2026
697ec81
Tweak some comments
MasterKale Oct 9, 2026
58416e5
Add a mechanism for delaying API refreshes
MasterKale Oct 9, 2026
04ff084
Delay next C-MDS refresh after HTTP 304 and 429
MasterKale Oct 9, 2026
1609674
Use same refresh interval on initial C-MDS pull
MasterKale Oct 9, 2026
c237be2
Gracefully handle unexpected C-MDS HTTP statuses
MasterKale Oct 9, 2026
7a4a565
Fix tests and add new ones for delay intervals
MasterKale Oct 9, 2026
35f9b6e
Expand `fetch()` helper functionality
MasterKale Oct 9, 2026
290cb02
Time out C-MDS fetch after 10 seconds
MasterKale Oct 9, 2026
e262879
Harden delayNextRefresh for cache miss
MasterKale Oct 9, 2026
63c6614
Clear existing server entries before re-caching
MasterKale Oct 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/server/src/helpers/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
* A simple method for requesting data via standard `fetch`. Should work
* across multiple runtimes.
*/
export function fetch(url: string): Promise<Response> {
return _fetchInternals.stubThis(url);
export function fetch(...args: Parameters<typeof globalThis.fetch>): Promise<Response> {
return _fetchInternals.stubThis(...args);
}

/**
* Make it possible to stub the return value during testing
* @ignore Don't include this in docs output
*/
export const _fetchInternals = {
stubThis: (url: string) => globalThis.fetch(url),
stubThis: (...args: Parameters<typeof globalThis.fetch>) => globalThis.fetch(...args),
};
2 changes: 1 addition & 1 deletion packages/server/src/helpers/isCertRevoked.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ Deno.test('should check all CRL URLs in issuer cert for revocation status', asyn
using _mockFetch = stub(
_fetchInternals,
'stubThis',
(url: string) => {
(url: RequestInfo | URL) => {
if (url === CRL_URL) {
return Promise.resolve(new Response(crl1.rawData));
} else {
Expand Down
35 changes: 35 additions & 0 deletions packages/server/src/metadata/convenienceMDSTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import type { DataURLPNGOrSVGString, DataURLSVGString, FriendlyNames } from './mdsTypes.ts';

/**
* Passkey Provider metadata, including localized names, and light and dark mode icons.
*
* See https://fidoalliance.org/specs/mds/fido-convenience-metadata-service-v1.0-ps-20250521.html#sctn-convenience-details
*/
export type ProviderMetadata = {
friendlyNames?: FriendlyNames;
icon?: DataURLPNGOrSVGString;
iconDark?: DataURLSVGString;
providerLogoLight?: DataURLSVGString;
providerLogoDark?: DataURLSVGString;
};

/**
* A dictionary of payload data within a Convenience MDS blob. Except for the `"no"` property,
* keys in this dictionary are AAGUIDs that map to `ProviderMetadata` dictionaries.
*
* Example:
* ```json
* {
* "no": 1,
* "12345678-1234-1234-1234-12345678": {...},
* "87654321-4321-4321-4321-87654321": {...}
* }
* ```
*
* See https://fidoalliance.org/specs/mds/fido-convenience-metadata-service-v1.0-ps-20250521.html#sctn-cmds-pe
*
* @property no - A serial number that increments whenever the convenience metadata payload is updated
*/
export type ConvenienceMDSPayload =
& { no: number }
& { [aaguid: string]: ProviderMetadata };
47 changes: 46 additions & 1 deletion packages/server/src/metadata/mdsTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,14 @@ export type MetadataStatement = {
tcDisplayPNGCharacteristics?: DisplayPNGCharacteristicsDescriptor[];
attestationRootCertificates: string[];
ecdaaTrustAnchors?: EcdaaTrustAnchor[];
icon?: string;
supportedExtensions?: ExtensionDescriptor[];
authenticatorGetInfo?: AuthenticatorGetInfo;
// Same values as in Convenience Metadata
friendlyNames?: FriendlyNames;
icon?: DataURLPNGOrSVGString;
iconDark?: DataURLSVGString;
providerLogoLight?: DataURLSVGString;
providerLogoDark?: DataURLSVGString;
};

/**
Expand Down Expand Up @@ -314,3 +319,43 @@ export type AuthenticatorGetInfo = {
pinProtocols?: number[];
algorithms?: { type: 'public-key'; alg: number }[];
};

/**
* Localized names, typically a company's trade name for a given region.
*
* Example:
* ```json
* {
* "en-US": "SimpleWebAuthn",
* "ja-JP": "シンプルウェブオースン"
* }
* ```
*
* See https://fidoalliance.org/specs/mds/fido-convenience-metadata-service-v1.0-ps-20250521.html#sctn-types-fn
*/
export type FriendlyNames = {
[ietfLanguageCode: string]: string;
};

/**
* A `data:` URL-encoded string containing base64-encoded PNG or SVG data.
*
* Example:
* ```json
* "data:image/svg+xml;base64,..."
* ```
* ```json
* "data:image/png;base64,..."
* ```
*/
export type DataURLPNGOrSVGString = string;

/**
* A `data:` URL-encoded string containing base64-encoded SVG data.
*
* Example:
* ```json
* "data:image/svg+xml;base64,..."
* ```
*/
export type DataURLSVGString = string;
Loading
Loading