1- import type { KeytraceResponse } from " #shared/types/keytrace" ;
1+ import type { KeytraceResponse } from ' #shared/types/keytrace'
22
33const MOCK_KEYTRACE_PROFILES : Record < string , KeytraceResponse > = {
4- " npmx.dev" : {
4+ ' npmx.dev' : {
55 profile : {
6- name : " npmx Team" ,
7- avatar : " https://api.dicebear.com/9.x/shapes/svg?seed=npmx" ,
6+ name : ' npmx Team' ,
7+ avatar : ' https://api.dicebear.com/9.x/shapes/svg?seed=npmx' ,
88 banner :
9- "https://images.unsplash.com/photo-1515879218367-8466d910aaa4?auto=format&fit=crop&w=1400&q=80" ,
10- description :
11- "Open source developers building better tooling around package discovery." ,
9+ 'https://images.unsplash.com/photo-1515879218367-8466d910aaa4?auto=format&fit=crop&w=1400&q=80' ,
10+ description : 'Open source developers building better tooling around package discovery.' ,
1211 } ,
1312 accounts : [
1413 {
15- platform : " github" ,
16- username : " npmx-dev" ,
17- displayName : " npmx-dev" ,
18- avatar : " https://avatars.githubusercontent.com/u/178563400?v=4" ,
19- url : " https://github.com/npmx-dev" ,
20- status : " verified" ,
21- proofMethod : " github" ,
22- addedAt : " 2026-03-10T12:00:00.000Z" ,
23- lastCheckedAt : " 2026-04-20T09:30:00.000Z" ,
14+ platform : ' github' ,
15+ username : ' npmx-dev' ,
16+ displayName : ' npmx-dev' ,
17+ avatar : ' https://avatars.githubusercontent.com/u/178563400?v=4' ,
18+ url : ' https://github.com/npmx-dev' ,
19+ status : ' verified' ,
20+ proofMethod : ' github' ,
21+ addedAt : ' 2026-03-10T12:00:00.000Z' ,
22+ lastCheckedAt : ' 2026-04-20T09:30:00.000Z' ,
2423 } ,
2524 {
26- platform : " npm" ,
27- username : " npmx" ,
28- displayName : " npmx" ,
29- avatar : " https://api.dicebear.com/9.x/identicon/svg?seed=npmx" ,
30- url : " https://www.npmjs.com/~npmx" ,
31- status : " stale" ,
32- proofMethod : " npm" ,
33- addedAt : " 2026-02-18T15:20:00.000Z" ,
34- lastCheckedAt : " 2026-03-05T08:00:00.000Z" ,
35- failureReason : " Proof has not been re-verified recently." ,
25+ platform : ' npm' ,
26+ username : ' npmx' ,
27+ displayName : ' npmx' ,
28+ avatar : ' https://api.dicebear.com/9.x/identicon/svg?seed=npmx' ,
29+ url : ' https://www.npmjs.com/~npmx' ,
30+ status : ' stale' ,
31+ proofMethod : ' npm' ,
32+ addedAt : ' 2026-02-18T15:20:00.000Z' ,
33+ lastCheckedAt : ' 2026-03-05T08:00:00.000Z' ,
34+ failureReason : ' Proof has not been re-verified recently.' ,
3635 } ,
3736 {
38- platform : "mastodon" ,
39- username : "@npmx@fosstodon.org" ,
40- displayName : "npmx" ,
41- avatar :
42- "https://api.dicebear.com/9.x/identicon/svg?seed=fosstodon-npmx" ,
43- url : "https://fosstodon.org/@npmx" ,
44- status : "failed" ,
45- proofMethod : "mastodon" ,
46- addedAt : "2026-01-22T11:40:00.000Z" ,
47- lastCheckedAt : "2026-04-19T22:15:00.000Z" ,
48- failureReason :
49- "Linked proof URL could not be resolved during verification." ,
37+ platform : 'mastodon' ,
38+ username : '@npmx@fosstodon.org' ,
39+ displayName : 'npmx' ,
40+ avatar : 'https://api.dicebear.com/9.x/identicon/svg?seed=fosstodon-npmx' ,
41+ url : 'https://fosstodon.org/@npmx' ,
42+ status : 'failed' ,
43+ proofMethod : 'mastodon' ,
44+ addedAt : '2026-01-22T11:40:00.000Z' ,
45+ lastCheckedAt : '2026-04-19T22:15:00.000Z' ,
46+ failureReason : 'Linked proof URL could not be resolved during verification.' ,
5047 } ,
5148 ] ,
5249 } ,
53- " empty.dev" : {
50+ ' empty.dev' : {
5451 profile : {
55- name : " Empty Developer" ,
56- avatar : " https://api.dicebear.com/9.x/initials/svg?seed=empty.dev" ,
57- description : " A profile with no linked accounts yet." ,
52+ name : ' Empty Developer' ,
53+ avatar : ' https://api.dicebear.com/9.x/initials/svg?seed=empty.dev' ,
54+ description : ' A profile with no linked accounts yet.' ,
5855 } ,
5956 accounts : [ ] ,
6057 } ,
61- } ;
58+ }
6259
6360function domainToDisplayName ( domain : string ) : string {
64- const firstSegment = domain . split ( "." ) [ 0 ] || domain ;
65- return firstSegment . charAt ( 0 ) . toUpperCase ( ) + firstSegment . slice ( 1 ) ;
61+ const firstSegment = domain . split ( '.' ) [ 0 ] || domain
62+ return firstSegment . charAt ( 0 ) . toUpperCase ( ) + firstSegment . slice ( 1 )
6663}
6764
6865function buildFallbackProfile ( domain : string ) : KeytraceResponse {
@@ -74,52 +71,52 @@ function buildFallbackProfile(domain: string): KeytraceResponse {
7471 } ,
7572 accounts : [
7673 {
77- platform : " github" ,
74+ platform : ' github' ,
7875 username : domain ,
7976 displayName : domain ,
8077 avatar : `https://api.dicebear.com/9.x/identicon/svg?seed=github-${ encodeURIComponent ( domain ) } ` ,
8178 url : `https://github.com/${ domain } ` ,
82- status : " verified" ,
83- proofMethod : " github" ,
84- addedAt : " 2026-04-01T10:00:00.000Z" ,
85- lastCheckedAt : " 2026-04-21T10:00:00.000Z" ,
79+ status : ' verified' ,
80+ proofMethod : ' github' ,
81+ addedAt : ' 2026-04-01T10:00:00.000Z' ,
82+ lastCheckedAt : ' 2026-04-21T10:00:00.000Z' ,
8683 } ,
8784 {
88- platform : " npm" ,
85+ platform : ' npm' ,
8986 username : domain ,
9087 displayName : domain ,
9188 avatar : `https://api.dicebear.com/9.x/identicon/svg?seed=npm-${ encodeURIComponent ( domain ) } ` ,
9289 url : `https://www.npmjs.com/~${ domain } ` ,
93- status : " unverified" ,
94- proofMethod : " npm" ,
95- addedAt : " 2026-04-01T10:00:00.000Z" ,
96- lastCheckedAt : " 2026-04-01T10:00:00.000Z" ,
97- failureReason : " Proof exists but has not been verified yet." ,
90+ status : ' unverified' ,
91+ proofMethod : ' npm' ,
92+ addedAt : ' 2026-04-01T10:00:00.000Z' ,
93+ lastCheckedAt : ' 2026-04-01T10:00:00.000Z' ,
94+ failureReason : ' Proof exists but has not been verified yet.' ,
9895 } ,
9996 {
100- platform : " mastodon" ,
97+ platform : ' mastodon' ,
10198 username : `@${ domain } @mastodon.social` ,
10299 displayName : domain ,
103100 avatar : `https://api.dicebear.com/9.x/identicon/svg?seed=mastodon-${ encodeURIComponent ( domain ) } ` ,
104101 url : `https://mastodon.social/@${ encodeURIComponent ( domain ) } ` ,
105- status : " stale" ,
106- proofMethod : " mastodon" ,
107- addedAt : " 2026-04-01T10:00:00.000Z" ,
108- lastCheckedAt : " 2026-04-08T10:00:00.000Z" ,
109- failureReason : " Verification check is out of date." ,
102+ status : ' stale' ,
103+ proofMethod : ' mastodon' ,
104+ addedAt : ' 2026-04-01T10:00:00.000Z' ,
105+ lastCheckedAt : ' 2026-04-08T10:00:00.000Z' ,
106+ failureReason : ' Verification check is out of date.' ,
110107 } ,
111108 ] ,
112- } ;
109+ }
113110}
114111
115- export default defineEventHandler ( ( event ) => {
116- const domain = getRouterParam ( event , " domain" ) ?. trim ( ) . toLowerCase ( ) ;
112+ export default defineEventHandler ( event => {
113+ const domain = getRouterParam ( event , ' domain' ) ?. trim ( ) . toLowerCase ( )
117114 if ( ! domain ) {
118115 throw createError ( {
119116 statusCode : 400 ,
120- message : " Domain is required" ,
121- } ) ;
117+ message : ' Domain is required' ,
118+ } )
122119 }
123120
124- return MOCK_KEYTRACE_PROFILES [ domain ] ?? buildFallbackProfile ( domain ) ;
125- } ) ;
121+ return MOCK_KEYTRACE_PROFILES [ domain ] ?? buildFallbackProfile ( domain )
122+ } )
0 commit comments