@keytrace/runner 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/README.md +139 -0
  2. package/dist/actions/css-select.d.ts +6 -0
  3. package/dist/actions/css-select.d.ts.map +1 -0
  4. package/dist/actions/css-select.js +14 -0
  5. package/dist/actions/css-select.js.map +1 -0
  6. package/dist/actions/dns-txt.d.ts +6 -0
  7. package/dist/actions/dns-txt.d.ts.map +1 -0
  8. package/dist/actions/dns-txt.js +17 -0
  9. package/dist/actions/dns-txt.js.map +1 -0
  10. package/dist/actions/http-get.d.ts +6 -0
  11. package/dist/actions/http-get.d.ts.map +1 -0
  12. package/dist/actions/http-get.js +19 -0
  13. package/dist/actions/http-get.js.map +1 -0
  14. package/dist/actions/index.d.ts +6 -0
  15. package/dist/actions/index.d.ts.map +1 -0
  16. package/dist/actions/index.js +6 -0
  17. package/dist/actions/index.js.map +1 -0
  18. package/dist/actions/json-path.d.ts +12 -0
  19. package/dist/actions/json-path.d.ts.map +1 -0
  20. package/dist/actions/json-path.js +26 -0
  21. package/dist/actions/json-path.js.map +1 -0
  22. package/dist/actions/regex-match.d.ts +6 -0
  23. package/dist/actions/regex-match.d.ts.map +1 -0
  24. package/dist/actions/regex-match.js +14 -0
  25. package/dist/actions/regex-match.js.map +1 -0
  26. package/dist/claim.d.ts +38 -0
  27. package/dist/claim.d.ts.map +1 -0
  28. package/dist/claim.js +253 -0
  29. package/dist/claim.js.map +1 -0
  30. package/dist/constants.d.ts +17 -0
  31. package/dist/constants.d.ts.map +1 -0
  32. package/dist/constants.js +17 -0
  33. package/dist/constants.js.map +1 -0
  34. package/dist/expect.d.ts +12 -0
  35. package/dist/expect.d.ts.map +1 -0
  36. package/dist/expect.js +33 -0
  37. package/dist/expect.js.map +1 -0
  38. package/dist/fetchers/activitypub.d.ts +25 -0
  39. package/dist/fetchers/activitypub.d.ts.map +1 -0
  40. package/dist/fetchers/activitypub.js +32 -0
  41. package/dist/fetchers/activitypub.js.map +1 -0
  42. package/dist/fetchers/dns.d.ts +21 -0
  43. package/dist/fetchers/dns.d.ts.map +1 -0
  44. package/dist/fetchers/dns.js +61 -0
  45. package/dist/fetchers/dns.js.map +1 -0
  46. package/dist/fetchers/http.d.ts +10 -0
  47. package/dist/fetchers/http.d.ts.map +1 -0
  48. package/dist/fetchers/http.js +30 -0
  49. package/dist/fetchers/http.js.map +1 -0
  50. package/dist/fetchers/index.d.ts +16 -0
  51. package/dist/fetchers/index.d.ts.map +1 -0
  52. package/dist/fetchers/index.js +22 -0
  53. package/dist/fetchers/index.js.map +1 -0
  54. package/dist/index.d.ts +21 -0
  55. package/dist/index.d.ts.map +1 -0
  56. package/dist/index.js +26 -0
  57. package/dist/index.js.map +1 -0
  58. package/dist/interpolate.d.ts +12 -0
  59. package/dist/interpolate.d.ts.map +1 -0
  60. package/dist/interpolate.js +23 -0
  61. package/dist/interpolate.js.map +1 -0
  62. package/dist/profile.d.ts +42 -0
  63. package/dist/profile.d.ts.map +1 -0
  64. package/dist/profile.js +176 -0
  65. package/dist/profile.js.map +1 -0
  66. package/dist/recipes/dns-txt.d.ts +9 -0
  67. package/dist/recipes/dns-txt.d.ts.map +1 -0
  68. package/dist/recipes/dns-txt.js +45 -0
  69. package/dist/recipes/dns-txt.js.map +1 -0
  70. package/dist/recipes/github-gist.d.ts +9 -0
  71. package/dist/recipes/github-gist.d.ts.map +1 -0
  72. package/dist/recipes/github-gist.js +52 -0
  73. package/dist/recipes/github-gist.js.map +1 -0
  74. package/dist/recipes/index.d.ts +3 -0
  75. package/dist/recipes/index.d.ts.map +1 -0
  76. package/dist/recipes/index.js +3 -0
  77. package/dist/recipes/index.js.map +1 -0
  78. package/dist/runner.d.ts +7 -0
  79. package/dist/runner.d.ts.map +1 -0
  80. package/dist/runner.js +100 -0
  81. package/dist/runner.js.map +1 -0
  82. package/dist/serviceProviders/activitypub.d.ts +10 -0
  83. package/dist/serviceProviders/activitypub.d.ts.map +1 -0
  84. package/dist/serviceProviders/activitypub.js +73 -0
  85. package/dist/serviceProviders/activitypub.js.map +1 -0
  86. package/dist/serviceProviders/bsky.d.ts +10 -0
  87. package/dist/serviceProviders/bsky.d.ts.map +1 -0
  88. package/dist/serviceProviders/bsky.js +63 -0
  89. package/dist/serviceProviders/bsky.js.map +1 -0
  90. package/dist/serviceProviders/dns.d.ts +10 -0
  91. package/dist/serviceProviders/dns.d.ts.map +1 -0
  92. package/dist/serviceProviders/dns.js +65 -0
  93. package/dist/serviceProviders/dns.js.map +1 -0
  94. package/dist/serviceProviders/github.d.ts +10 -0
  95. package/dist/serviceProviders/github.d.ts.map +1 -0
  96. package/dist/serviceProviders/github.js +100 -0
  97. package/dist/serviceProviders/github.js.map +1 -0
  98. package/dist/serviceProviders/index.d.ts +26 -0
  99. package/dist/serviceProviders/index.d.ts.map +1 -0
  100. package/dist/serviceProviders/index.js +55 -0
  101. package/dist/serviceProviders/index.js.map +1 -0
  102. package/dist/serviceProviders/npm.d.ts +10 -0
  103. package/dist/serviceProviders/npm.d.ts.map +1 -0
  104. package/dist/serviceProviders/npm.js +99 -0
  105. package/dist/serviceProviders/npm.js.map +1 -0
  106. package/dist/serviceProviders/types.d.ts +106 -0
  107. package/dist/serviceProviders/types.d.ts.map +1 -0
  108. package/dist/serviceProviders/types.js +2 -0
  109. package/dist/serviceProviders/types.js.map +1 -0
  110. package/dist/types.d.ts +165 -0
  111. package/dist/types.d.ts.map +1 -0
  112. package/dist/types.js +12 -0
  113. package/dist/types.js.map +1 -0
  114. package/package.json +37 -0
  115. package/src/actions/css-select.ts +14 -0
  116. package/src/actions/dns-txt.ts +16 -0
  117. package/src/actions/http-get.ts +19 -0
  118. package/src/actions/index.ts +5 -0
  119. package/src/actions/json-path.ts +29 -0
  120. package/src/actions/regex-match.ts +13 -0
  121. package/src/claim.ts +293 -0
  122. package/src/constants.ts +19 -0
  123. package/src/expect.ts +36 -0
  124. package/src/fetchers/activitypub.ts +53 -0
  125. package/src/fetchers/dns.ts +82 -0
  126. package/src/fetchers/http.ts +38 -0
  127. package/src/fetchers/index.ts +30 -0
  128. package/src/index.ts +57 -0
  129. package/src/interpolate.ts +20 -0
  130. package/src/profile.ts +229 -0
  131. package/src/recipes/dns-txt.ts +46 -0
  132. package/src/recipes/github-gist.ts +53 -0
  133. package/src/recipes/index.ts +2 -0
  134. package/src/runner.ts +116 -0
  135. package/src/serviceProviders/activitypub.ts +84 -0
  136. package/src/serviceProviders/bsky.ts +73 -0
  137. package/src/serviceProviders/dns.ts +75 -0
  138. package/src/serviceProviders/github.ts +112 -0
  139. package/src/serviceProviders/index.ts +65 -0
  140. package/src/serviceProviders/npm.ts +116 -0
  141. package/src/serviceProviders/types.ts +121 -0
  142. package/src/types.ts +181 -0
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The ATProto collection NSID for identity claims
3
+ */
4
+ export declare const COLLECTION_NSID = "dev.keytrace.claim";
5
+ /**
6
+ * Default timeout for fetcher operations in milliseconds
7
+ */
8
+ export declare const DEFAULT_TIMEOUT = 5000;
9
+ /**
10
+ * PLC directory URL for resolving did:plc DIDs
11
+ */
12
+ export declare const PLC_DIRECTORY_URL = "https://plc.directory";
13
+ /**
14
+ * Fallback public ATProto API URL (used only when PDS resolution fails)
15
+ */
16
+ export declare const PUBLIC_API_URL = "https://public.api.bsky.app";
17
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,eAAe,uBAAuB,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,iBAAiB,0BAA0B,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,cAAc,gCAAgC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The ATProto collection NSID for identity claims
3
+ */
4
+ export const COLLECTION_NSID = "dev.keytrace.claim";
5
+ /**
6
+ * Default timeout for fetcher operations in milliseconds
7
+ */
8
+ export const DEFAULT_TIMEOUT = 5000;
9
+ /**
10
+ * PLC directory URL for resolving did:plc DIDs
11
+ */
12
+ export const PLC_DIRECTORY_URL = "https://plc.directory";
13
+ /**
14
+ * Fallback public ATProto API URL (used only when PDS resolution fails)
15
+ */
16
+ export const PUBLIC_API_URL = "https://public.api.bsky.app";
17
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,oBAAoB,CAAC;AAEpD;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAEzD;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,6BAA6B,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Parse an expect string and compare against a value.
3
+ *
4
+ * Supported formats:
5
+ * "equals:{value}" - exact string match
6
+ * "contains:{value}" - substring match
7
+ */
8
+ export declare function checkExpect(expectStr: string, actual: unknown): {
9
+ pass: boolean;
10
+ message: string;
11
+ };
12
+ //# sourceMappingURL=expect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../src/expect.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CA4BlG"}
package/dist/expect.js ADDED
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Parse an expect string and compare against a value.
3
+ *
4
+ * Supported formats:
5
+ * "equals:{value}" - exact string match
6
+ * "contains:{value}" - substring match
7
+ */
8
+ export function checkExpect(expectStr, actual) {
9
+ const colonIdx = expectStr.indexOf(":");
10
+ if (colonIdx === -1) {
11
+ return {
12
+ pass: false,
13
+ message: `Invalid expect format: "${expectStr}" (expected "type:value")`,
14
+ };
15
+ }
16
+ const type = expectStr.slice(0, colonIdx);
17
+ const expected = expectStr.slice(colonIdx + 1);
18
+ const actualStr = String(actual ?? "");
19
+ switch (type) {
20
+ case "equals":
21
+ return actualStr === expected ? { pass: true, message: `Value equals "${expected}"` } : { pass: false, message: `Expected "${expected}" but got "${actualStr}"` };
22
+ case "contains":
23
+ return actualStr.includes(expected)
24
+ ? { pass: true, message: `Value contains "${expected}"` }
25
+ : {
26
+ pass: false,
27
+ message: `Expected value to contain "${expected}" but got "${actualStr}"`,
28
+ };
29
+ default:
30
+ return { pass: false, message: `Unknown expect type: "${type}"` };
31
+ }
32
+ }
33
+ //# sourceMappingURL=expect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expect.js","sourceRoot":"","sources":["../src/expect.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,SAAiB,EAAE,MAAe;IAC5D,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC,IAAI,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;QACpB,OAAO;YACL,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,2BAA2B,SAAS,2BAA2B;SACzE,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC1C,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;IAC/C,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;IAEvC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,QAAQ;YACX,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,QAAQ,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,QAAQ,cAAc,SAAS,GAAG,EAAE,CAAC;QAEpK,KAAK,UAAU;YACb,OAAO,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBACjC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,mBAAmB,QAAQ,GAAG,EAAE;gBACzD,CAAC,CAAC;oBACE,IAAI,EAAE,KAAK;oBACX,OAAO,EAAE,8BAA8B,QAAQ,cAAc,SAAS,GAAG;iBAC1E,CAAC;QAER;YACE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,yBAAyB,IAAI,GAAG,EAAE,CAAC;IACtE,CAAC;AACH,CAAC"}
@@ -0,0 +1,25 @@
1
+ export interface ActivityPubActor {
2
+ id: string;
3
+ type: string;
4
+ preferredUsername?: string;
5
+ name?: string;
6
+ summary?: string;
7
+ attachment?: Array<{
8
+ type: string;
9
+ name?: string;
10
+ value?: string;
11
+ }>;
12
+ attributedTo?: string;
13
+ }
14
+ export interface ActivityPubFetchOptions {
15
+ timeout?: number;
16
+ }
17
+ /**
18
+ * Fetch an ActivityPub actor document
19
+ */
20
+ export declare function fetchActor(uri: string, options?: ActivityPubFetchOptions): Promise<ActivityPubActor>;
21
+ /**
22
+ * Fetch data from an ActivityPub URL (alias for http fetch with AP headers)
23
+ */
24
+ export declare function fetch(uri: string, options?: ActivityPubFetchOptions): Promise<unknown>;
25
+ //# sourceMappingURL=activitypub.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activitypub.d.ts","sourceRoot":"","sources":["../../src/fetchers/activitypub.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,KAAK,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,uBAA4B,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAsB9G;AAED;;GAEG;AACH,wBAAsB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,uBAA4B,GAAG,OAAO,CAAC,OAAO,CAAC,CAEhG"}
@@ -0,0 +1,32 @@
1
+ import { DEFAULT_TIMEOUT } from "../constants.js";
2
+ /**
3
+ * Fetch an ActivityPub actor document
4
+ */
5
+ export async function fetchActor(uri, options = {}) {
6
+ const timeout = options.timeout ?? DEFAULT_TIMEOUT;
7
+ const controller = new AbortController();
8
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
9
+ try {
10
+ const response = await globalThis.fetch(uri, {
11
+ headers: {
12
+ Accept: 'application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
13
+ "User-Agent": "keytrace-runner/1.0",
14
+ },
15
+ signal: controller.signal,
16
+ });
17
+ if (!response.ok) {
18
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
19
+ }
20
+ return (await response.json());
21
+ }
22
+ finally {
23
+ clearTimeout(timeoutId);
24
+ }
25
+ }
26
+ /**
27
+ * Fetch data from an ActivityPub URL (alias for http fetch with AP headers)
28
+ */
29
+ export async function fetch(uri, options = {}) {
30
+ return fetchActor(uri, options);
31
+ }
32
+ //# sourceMappingURL=activitypub.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activitypub.js","sourceRoot":"","sources":["../../src/fetchers/activitypub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAoBlD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAW,EAAE,UAAmC,EAAE;IACjF,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,eAAe,CAAC;IACnD,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IAEhE,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE;YAC3C,OAAO,EAAE;gBACP,MAAM,EAAE,iGAAiG;gBACzG,YAAY,EAAE,qBAAqB;aACpC;YACD,MAAM,EAAE,UAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,QAAQ,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAqB,CAAC;IACrD,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,GAAW,EAAE,UAAmC,EAAE;IAC5E,OAAO,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,21 @@
1
+ export interface DnsFetchResult {
2
+ domain: string;
3
+ records: {
4
+ txt: string[];
5
+ };
6
+ /** Debug info showing which locations were checked */
7
+ _locations?: {
8
+ root: string[];
9
+ _keytrace: string[];
10
+ };
11
+ }
12
+ export interface DnsFetchOptions {
13
+ timeout?: number;
14
+ }
15
+ /**
16
+ * Fetch DNS TXT records for a domain.
17
+ * Checks both the root domain and _keytrace subdomain.
18
+ * Returns null in environments where DNS resolution is not available.
19
+ */
20
+ export declare function fetch(domain: string, options?: DnsFetchOptions): Promise<DnsFetchResult | null>;
21
+ //# sourceMappingURL=dns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dns.d.ts","sourceRoot":"","sources":["../../src/fetchers/dns.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE;QACP,GAAG,EAAE,MAAM,EAAE,CAAC;KACf,CAAC;IACF,sDAAsD;IACtD,UAAU,CAAC,EAAE;QACX,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,SAAS,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAgBD;;;;GAIG;AACH,wBAAsB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CA4CzG"}
@@ -0,0 +1,61 @@
1
+ import { DEFAULT_TIMEOUT } from "../constants.js";
2
+ /**
3
+ * Check if the Node.js `dns` module is available.
4
+ * This is more reliable than checking `typeof window` since SSR frameworks
5
+ * and edge runtimes can have `window` defined or `dns` unavailable.
6
+ */
7
+ async function hasDnsModule() {
8
+ try {
9
+ await import("dns");
10
+ return true;
11
+ }
12
+ catch {
13
+ return false;
14
+ }
15
+ }
16
+ /**
17
+ * Fetch DNS TXT records for a domain.
18
+ * Checks both the root domain and _keytrace subdomain.
19
+ * Returns null in environments where DNS resolution is not available.
20
+ */
21
+ export async function fetch(domain, options = {}) {
22
+ if (!(await hasDnsModule())) {
23
+ console.debug("DNS fetching is not available in this environment");
24
+ return null;
25
+ }
26
+ const timeout = options.timeout ?? DEFAULT_TIMEOUT;
27
+ try {
28
+ const dns = await import("dns");
29
+ const dnsPromises = dns.promises;
30
+ const timeoutPromise = new Promise((_, reject) => {
31
+ setTimeout(() => reject(new Error("DNS timeout")), timeout);
32
+ });
33
+ // Check both root domain and _keytrace subdomain
34
+ const rootDomain = domain;
35
+ const keytraceDomain = `_keytrace.${domain}`;
36
+ const fetchPromise = Promise.all([
37
+ dnsPromises.resolveTxt(rootDomain).catch(() => []),
38
+ dnsPromises.resolveTxt(keytraceDomain).catch(() => []),
39
+ ]).then(([rootRecords, keytraceRecords]) => ({
40
+ domain,
41
+ records: {
42
+ txt: [...rootRecords.flat(), ...keytraceRecords.flat()],
43
+ },
44
+ // Include which locations were checked for debugging
45
+ _locations: {
46
+ root: rootRecords.flat(),
47
+ _keytrace: keytraceRecords.flat(),
48
+ },
49
+ }));
50
+ return await Promise.race([fetchPromise, timeoutPromise]);
51
+ }
52
+ catch (error) {
53
+ if (error instanceof Error && error.message === "DNS timeout") {
54
+ throw error;
55
+ }
56
+ // DNS lookup failed (NXDOMAIN, etc.)
57
+ console.debug(`DNS lookup failed for ${domain}: ${error instanceof Error ? error.message : "Unknown error"}`);
58
+ return null;
59
+ }
60
+ }
61
+ //# sourceMappingURL=dns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dns.js","sourceRoot":"","sources":["../../src/fetchers/dns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAkBlD;;;;GAIG;AACH,KAAK,UAAU,YAAY;IACzB,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,MAAc,EAAE,UAA2B,EAAE;IACvE,IAAI,CAAC,CAAC,MAAM,YAAY,EAAE,CAAC,EAAE,CAAC;QAC5B,OAAO,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACnE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,eAAe,CAAC;IAEnD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC;QAChC,MAAM,WAAW,GAAG,GAAG,CAAC,QAAQ,CAAC;QAEjC,MAAM,cAAc,GAAG,IAAI,OAAO,CAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;YACtD,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;QAEH,iDAAiD;QACjD,MAAM,UAAU,GAAG,MAAM,CAAC;QAC1B,MAAM,cAAc,GAAG,aAAa,MAAM,EAAE,CAAC;QAE7C,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC;YAC/B,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC;YAClD,WAAW,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC;SACvD,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,eAAe,CAAC,EAAE,EAAE,CAAC,CAAC;YAC3C,MAAM;YACN,OAAO,EAAE;gBACP,GAAG,EAAE,CAAC,GAAG,WAAW,CAAC,IAAI,EAAE,EAAE,GAAG,eAAe,CAAC,IAAI,EAAE,CAAC;aACxD;YACD,qDAAqD;YACrD,UAAU,EAAE;gBACV,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE;gBACxB,SAAS,EAAE,eAAe,CAAC,IAAI,EAAE;aAClC;SACF,CAAC,CAAC,CAAC;QAEJ,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC;IAC5D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,KAAK,aAAa,EAAE,CAAC;YAC9D,MAAM,KAAK,CAAC;QACd,CAAC;QACD,qCAAqC;QACrC,OAAO,CAAC,KAAK,CAAC,yBAAyB,MAAM,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;QAC9G,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ export interface HttpFetchOptions {
2
+ format: "json" | "text";
3
+ headers?: Record<string, string>;
4
+ timeout?: number;
5
+ }
6
+ /**
7
+ * Fetch data from an HTTP/HTTPS URL
8
+ */
9
+ export declare function fetch(url: string, options: HttpFetchOptions): Promise<unknown>;
10
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/fetchers/http.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAsB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,CA0BpF"}
@@ -0,0 +1,30 @@
1
+ import { DEFAULT_TIMEOUT } from "../constants.js";
2
+ /**
3
+ * Fetch data from an HTTP/HTTPS URL
4
+ */
5
+ export async function fetch(url, options) {
6
+ const timeout = options.timeout ?? DEFAULT_TIMEOUT;
7
+ const controller = new AbortController();
8
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
9
+ try {
10
+ const response = await globalThis.fetch(url, {
11
+ headers: {
12
+ "User-Agent": "keytrace-runner/1.0",
13
+ Accept: options.format === "json" ? "application/json" : "text/plain",
14
+ ...options.headers,
15
+ },
16
+ signal: controller.signal,
17
+ });
18
+ if (!response.ok) {
19
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
20
+ }
21
+ if (options.format === "json") {
22
+ return await response.json();
23
+ }
24
+ return await response.text();
25
+ }
26
+ finally {
27
+ clearTimeout(timeoutId);
28
+ }
29
+ }
30
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/fetchers/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAQlD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,GAAW,EAAE,OAAyB;IAChE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,eAAe,CAAC;IACnD,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IAEhE,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE;YAC3C,OAAO,EAAE;gBACP,YAAY,EAAE,qBAAqB;gBACnC,MAAM,EAAE,OAAO,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,YAAY;gBACrE,GAAG,OAAO,CAAC,OAAO;aACnB;YACD,MAAM,EAAE,UAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,QAAQ,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QACrE,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YAC9B,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC/B,CAAC;QACD,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC"}
@@ -0,0 +1,16 @@
1
+ import * as http from "./http.js";
2
+ import * as dns from "./dns.js";
3
+ import * as activitypub from "./activitypub.js";
4
+ export interface Fetcher {
5
+ fetch: (uri: string, options?: any) => Promise<unknown>;
6
+ }
7
+ /**
8
+ * Get a fetcher by name
9
+ */
10
+ export declare function get(name: string): Fetcher | undefined;
11
+ /**
12
+ * Get all available fetchers
13
+ */
14
+ export declare function getAll(): Record<string, Fetcher>;
15
+ export { http, dns, activitypub };
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fetchers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAGhD,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACzD;AAQD;;GAEG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAErD;AAED;;GAEG;AACH,wBAAgB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEhD;AAED,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,22 @@
1
+ import * as http from "./http.js";
2
+ import * as dns from "./dns.js";
3
+ import * as activitypub from "./activitypub.js";
4
+ const fetchers = {
5
+ http,
6
+ dns,
7
+ activitypub,
8
+ };
9
+ /**
10
+ * Get a fetcher by name
11
+ */
12
+ export function get(name) {
13
+ return fetchers[name];
14
+ }
15
+ /**
16
+ * Get all available fetchers
17
+ */
18
+ export function getAll() {
19
+ return { ...fetchers };
20
+ }
21
+ export { http, dns, activitypub };
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fetchers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAOhD,MAAM,QAAQ,GAA4B;IACxC,IAAI;IACJ,GAAG;IACH,WAAW;CACZ,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,GAAG,CAAC,IAAY;IAC9B,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,MAAM;IACpB,OAAO,EAAE,GAAG,QAAQ,EAAE,CAAC;AACzB,CAAC;AAED,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,21 @@
1
+ export { runRecipe } from "./runner.js";
2
+ export type { Recipe, RecipeParam, RecipeInstructions, RecipeVerification, VerificationStep, ClaimContext, VerificationResult, StepResult, RunnerConfig, FetchFn, ClaimVerificationResult, ProfileData, ClaimData, VerifyOptions, IdentityMetadata, ProofDetails, ProofTargetResult, } from "./types.js";
3
+ export { ClaimStatus } from "./types.js";
4
+ export { interpolate } from "./interpolate.js";
5
+ export { checkExpect } from "./expect.js";
6
+ export { httpGet } from "./actions/http-get.js";
7
+ export { jsonPath } from "./actions/json-path.js";
8
+ export { cssSelect } from "./actions/css-select.js";
9
+ export { regexMatch } from "./actions/regex-match.js";
10
+ export { dnsTxt } from "./actions/dns-txt.js";
11
+ export { githubGistRecipe } from "./recipes/github-gist.js";
12
+ export { dnsTxtRecipe } from "./recipes/dns-txt.js";
13
+ export { createClaim, matchClaim, verifyClaim, isClaimAmbiguous, getMatchedProvider, isValidDid } from "./claim.js";
14
+ export type { ClaimState } from "./claim.js";
15
+ export { fetchProfile, resolvePds, verifyAllClaims, getProfileSummary, getClaimsByStatus } from "./profile.js";
16
+ export type { FetchedProfile } from "./profile.js";
17
+ export { COLLECTION_NSID, DEFAULT_TIMEOUT, PUBLIC_API_URL, PLC_DIRECTORY_URL } from "./constants.js";
18
+ export * as serviceProviders from "./serviceProviders/index.js";
19
+ export type { ServiceProvider, ServiceProviderMatch, ServiceProviderUI, ProofTarget, ProofRequest, ProcessedURI } from "./serviceProviders/types.js";
20
+ export * as fetchers from "./fetchers/index.js";
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,YAAY,EACV,MAAM,EACN,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,OAAO,EACP,uBAAuB,EACvB,WAAW,EACX,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACpH,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC/G,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGrG,OAAO,KAAK,gBAAgB,MAAM,6BAA6B,CAAC;AAChE,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGrJ,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ // Core runner
2
+ export { runRecipe } from "./runner.js";
3
+ export { ClaimStatus } from "./types.js";
4
+ // Template interpolation
5
+ export { interpolate } from "./interpolate.js";
6
+ // Expect matchers
7
+ export { checkExpect } from "./expect.js";
8
+ // Individual actions
9
+ export { httpGet } from "./actions/http-get.js";
10
+ export { jsonPath } from "./actions/json-path.js";
11
+ export { cssSelect } from "./actions/css-select.js";
12
+ export { regexMatch } from "./actions/regex-match.js";
13
+ export { dnsTxt } from "./actions/dns-txt.js";
14
+ // Built-in recipes
15
+ export { githubGistRecipe } from "./recipes/github-gist.js";
16
+ export { dnsTxtRecipe } from "./recipes/dns-txt.js";
17
+ // Claim & Profile (from runner)
18
+ export { createClaim, matchClaim, verifyClaim, isClaimAmbiguous, getMatchedProvider, isValidDid } from "./claim.js";
19
+ export { fetchProfile, resolvePds, verifyAllClaims, getProfileSummary, getClaimsByStatus } from "./profile.js";
20
+ // Constants
21
+ export { COLLECTION_NSID, DEFAULT_TIMEOUT, PUBLIC_API_URL, PLC_DIRECTORY_URL } from "./constants.js";
22
+ // Service providers
23
+ export * as serviceProviders from "./serviceProviders/index.js";
24
+ // Fetchers
25
+ export * as fetchers from "./fetchers/index.js";
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAsBxC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,yBAAyB;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,kBAAkB;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,qBAAqB;AACrB,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,mBAAmB;AACnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,gCAAgC;AAChC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEpH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAG/G,YAAY;AACZ,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAErG,oBAAoB;AACpB,OAAO,KAAK,gBAAgB,MAAM,6BAA6B,CAAC;AAGhE,WAAW;AACX,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { ClaimContext } from "./types.js";
2
+ /**
3
+ * Interpolate {variable} placeholders in a template string using claim context.
4
+ *
5
+ * Replaces:
6
+ * {claimId} - from context.claimId
7
+ * {did} - from context.did
8
+ * {handle} - from context.handle
9
+ * {anyKey} - from context.params[anyKey]
10
+ */
11
+ export declare function interpolate(template: string, context: ClaimContext): string;
12
+ //# sourceMappingURL=interpolate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interpolate.d.ts","sourceRoot":"","sources":["../src/interpolate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,MAAM,CAQ3E"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Interpolate {variable} placeholders in a template string using claim context.
3
+ *
4
+ * Replaces:
5
+ * {claimId} - from context.claimId
6
+ * {did} - from context.did
7
+ * {handle} - from context.handle
8
+ * {anyKey} - from context.params[anyKey]
9
+ */
10
+ export function interpolate(template, context) {
11
+ return template.replace(/\{([^}]+)\}/g, (_match, key) => {
12
+ if (key === "claimId")
13
+ return context.claimId;
14
+ if (key === "did")
15
+ return context.did;
16
+ if (key === "handle")
17
+ return context.handle;
18
+ if (key in context.params)
19
+ return context.params[key];
20
+ return `{${key}}`;
21
+ });
22
+ }
23
+ //# sourceMappingURL=interpolate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interpolate.js","sourceRoot":"","sources":["../src/interpolate.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,QAAgB,EAAE,OAAqB;IACjE,OAAO,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,GAAW,EAAE,EAAE;QAC9D,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO,OAAO,CAAC,OAAO,CAAC;QAC9C,IAAI,GAAG,KAAK,KAAK;YAAE,OAAO,OAAO,CAAC,GAAG,CAAC;QACtC,IAAI,GAAG,KAAK,QAAQ;YAAE,OAAO,OAAO,CAAC,MAAM,CAAC;QAC5C,IAAI,GAAG,IAAI,OAAO,CAAC,MAAM;YAAE,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACtD,OAAO,IAAI,GAAG,GAAG,CAAC;IACpB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { type ClaimState } from "./claim.js";
2
+ import type { ProfileData, ClaimData, VerifyOptions } from "./types.js";
3
+ /**
4
+ * A fetched profile with resolved claims
5
+ */
6
+ export interface FetchedProfile extends ProfileData {
7
+ claims: ClaimData[];
8
+ claimInstances: ClaimState[];
9
+ }
10
+ /**
11
+ * Resolve the PDS endpoint from a DID document.
12
+ * For did:plc, fetches from plc.directory.
13
+ * For did:web, fetches from the well-known DID path.
14
+ * Falls back to PUBLIC_API_URL on failure.
15
+ */
16
+ export declare function resolvePds(did: string): Promise<string>;
17
+ /**
18
+ * Fetch a profile from ATProto by DID or handle
19
+ */
20
+ export declare function fetchProfile(didOrHandle: string, serviceUrl?: string): Promise<FetchedProfile>;
21
+ /**
22
+ * Verify all claims in a profile
23
+ */
24
+ export declare function verifyAllClaims(profile: FetchedProfile, opts?: VerifyOptions): Promise<void>;
25
+ /**
26
+ * Get verification summary for a profile
27
+ */
28
+ export declare function getProfileSummary(profile: FetchedProfile): {
29
+ total: number;
30
+ verified: number;
31
+ failed: number;
32
+ pending: number;
33
+ };
34
+ /**
35
+ * Get claims grouped by status
36
+ */
37
+ export declare function getClaimsByStatus(profile: FetchedProfile): {
38
+ verified: ClaimState[];
39
+ failed: ClaimState[];
40
+ pending: ClaimState[];
41
+ };
42
+ //# sourceMappingURL=profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAGvE,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAoB,MAAM,YAAY,CAAC;AAmB1F;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,cAAc,EAAE,UAAU,EAAE,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA2B7D;AAsFD;;GAEG;AACH,wBAAsB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAkCpG;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAElG;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAQA;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG;IAC1D,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,OAAO,EAAE,UAAU,EAAE,CAAC;CACvB,CAOA"}