@nema-project/nema 0.1.4 → 0.1.6

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/dist/github/gh.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  } from "../chunks/chunk-WT3XUFWU.js";
4
4
  import {
5
5
  parseGhCommand
6
- } from "../chunks/chunk-HEIQINX3.js";
6
+ } from "../chunks/chunk-W4DUBATU.js";
7
7
 
8
8
  // github/gh.js
9
9
  import { commandSpec, windowsRuntimeEnv } from "../platform.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  HookSignal,
3
3
  ReportInput
4
- } from "../chunks/chunk-HEIQINX3.js";
4
+ } from "../chunks/chunk-W4DUBATU.js";
5
5
 
6
6
  // report/commands.js
7
7
  import { repoInfo } from "./git.js";
@@ -10,7 +10,13 @@ import { createHash, createHmac, timingSafeEqual } from "node:crypto";
10
10
  var LOCAL_INSTANCE_PROTOCOL = "nema-local-v1";
11
11
  var sha256 = (value) => createHash("sha256").update(value).digest();
12
12
  var homeHashFor = (identity) => sha256(identity).toString("hex");
13
- var controlPortFor = (identity) => 2e4 + sha256(identity).readUInt32BE(0) % 25e3;
13
+ var controlPortFor = (identity) => 2e4 + sha256(identity).readUInt32BE(0) % 12768;
14
+ var legacyControlPortFor = (identity) => 2e4 + sha256(identity).readUInt32BE(0) % 25e3;
15
+ function acceptedControlPorts(identity) {
16
+ const current = controlPortFor(identity);
17
+ const legacy = legacyControlPortFor(identity);
18
+ return current === legacy ? [current] : [current, legacy];
19
+ }
14
20
  var controlOriginFor = (port) => `http://127.0.0.1:${port}`;
15
21
  var homeIdentityFor = (canonicalHome, platform = process.platform) => platform === "win32" ? canonicalHome.toLowerCase() : canonicalHome;
16
22
  function instanceHmac(secret, tuple) {
@@ -99,11 +105,12 @@ async function discoverDesktopOrigin(home = defaultDesktopHome()) {
99
105
  const canonical = realpathSync.native(home);
100
106
  const identity = homeIdentityFor(canonical);
101
107
  const homeHash = homeHashFor(identity);
102
- const port = controlPortFor(identity);
103
- const controlOrigin = controlOriginFor(port);
108
+ const accepted = acceptedControlPorts(identity).map(controlOriginFor);
104
109
  const descriptor = readDescriptor(path.join(canonical, "instance.json"));
105
- if (!descriptor || descriptor.homeHash !== homeHash || descriptor.controlOrigin !== controlOrigin)
110
+ if (!descriptor || descriptor.homeHash !== homeHash || !accepted.includes(descriptor.controlOrigin))
106
111
  return null;
112
+ const controlOrigin = descriptor.controlOrigin;
113
+ const port = Number(new URL(controlOrigin).port);
107
114
  const challenge = randomBytes(32).toString("hex");
108
115
  const response = await getProof(port, challenge);
109
116
  if (!response || response.status !== 200 || !response.body || typeof response.body !== "object")
package/dist/repos/git.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  } from "../chunks/chunk-WT3XUFWU.js";
4
4
  import {
5
5
  isBranchName
6
- } from "../chunks/chunk-HEIQINX3.js";
6
+ } from "../chunks/chunk-W4DUBATU.js";
7
7
 
8
8
  // repos/git.js
9
9
  import { execFile } from "node:child_process";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  GH_COMMAND_TOOLS
3
- } from "../chunks/chunk-HEIQINX3.js";
3
+ } from "../chunks/chunk-W4DUBATU.js";
4
4
 
5
5
  // repos/handlers.js
6
6
  import { lstat, rm, unlink } from "node:fs/promises";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nema-project/nema",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "bin": {