@ractive-ch/tab-mcp 0.6.0 → 0.6.1

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.
package/main.js CHANGED
@@ -603,7 +603,7 @@ function installCrashLogging(logger, exit = (code) => process.exit(code)) {
603
603
  };
604
604
  }
605
605
  // package.json
606
- var version = "0.6.0";
606
+ var version = "0.6.1";
607
607
 
608
608
  // src/address.ts
609
609
  var BASE32_ALPHABET = "abcdefghijklmnopqrstuvwxyz234567";
@@ -1854,6 +1854,26 @@ function newId(prefix) {
1854
1854
  function hashToken(token) {
1855
1855
  return new Bun.CryptoHasher("sha256").update(token).digest().toBase64({ alphabet: "base64url", omitPadding: true });
1856
1856
  }
1857
+ async function issueAccessToken(store, grant, options) {
1858
+ const now = options.now ?? Date.now();
1859
+ const token = newToken("access");
1860
+ const record = {
1861
+ hash: hashToken(token),
1862
+ kind: "access",
1863
+ grantId: grant.grantId ?? newId("g"),
1864
+ addressId: grant.addressId,
1865
+ clientId: grant.clientId,
1866
+ clientName: grant.clientName,
1867
+ scopes: grant.scopes ?? ["tools"],
1868
+ grantCreatedAt: grant.grantCreatedAt ?? now,
1869
+ issuedAt: now,
1870
+ expiresAt: now + options.ttlMs
1871
+ };
1872
+ if (grant.subject !== undefined)
1873
+ record.subject = grant.subject;
1874
+ await store.put(record);
1875
+ return { token, record };
1876
+ }
1857
1877
  async function issueTokenPair(store, grant, options) {
1858
1878
  const now = options.now ?? Date.now();
1859
1879
  const accessToken = newToken("access");
@@ -4851,6 +4871,13 @@ var FORWARDED_HEADERS = new Set([
4851
4871
  "traceparent",
4852
4872
  "tracestate"
4853
4873
  ]);
4874
+ function developmentUrl(host, port) {
4875
+ if (host === "127.0.0.1")
4876
+ return `http://127.0.0.1:${port}`;
4877
+ if (host === "::1" || host === "[::1]")
4878
+ return `http://[::1]:${port}`;
4879
+ return `http://localhost:${port}`;
4880
+ }
4854
4881
  var HEALTH_STORE_TIMEOUT_MS = 1000;
4855
4882
  var HEALTH_REUSE_MS = 1000;
4856
4883
  var HEALTH_HUNG_RETRY_MS = 30000;
@@ -5717,7 +5744,7 @@ function startRelay(options, hooks) {
5717
5744
  let closing = false;
5718
5745
  const port = server.port ?? config.port;
5719
5746
  if (publicUrl === "")
5720
- publicUrl = `http://localhost:${port}`;
5747
+ publicUrl = developmentUrl(config.host, port);
5721
5748
  const sweep = setInterval(() => {
5722
5749
  auth.sweep();
5723
5750
  store.deleteExpired(Date.now()).then((n) => {
@@ -5866,5 +5893,5 @@ var shutdown = () => {
5866
5893
  process.on("SIGTERM", shutdown);
5867
5894
  process.on("SIGINT", shutdown);
5868
5895
 
5869
- //# debugId=0F130F38D40E142464756E2164756E21
5896
+ //# debugId=D1FDCC539AD03DF264756E2164756E21
5870
5897
  //# sourceMappingURL=main.js.map