@ours.network/messenger-server 1.0.31-nightly.19 → 1.0.31-nightly.20
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.
|
@@ -38,7 +38,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
38
38
|
var define_MESSENGER_BUILD_INFO_default;
|
|
39
39
|
var init_define_MESSENGER_BUILD_INFO = __esm({
|
|
40
40
|
"<define:__MESSENGER_BUILD_INFO__>"() {
|
|
41
|
-
define_MESSENGER_BUILD_INFO_default = { name: "@ours.network/messenger-server", version: "1.0.31-nightly.
|
|
41
|
+
define_MESSENGER_BUILD_INFO_default = { name: "@ours.network/messenger-server", version: "1.0.31-nightly.20", sha: "388e6a471fb581f710dcf25c704c973cf05670b7", dirty: true };
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
publicEngineError,
|
|
11
11
|
publicInternalError,
|
|
12
12
|
reportFailure
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-UNTKMIUK.js";
|
|
14
14
|
|
|
15
15
|
// node_modules/bn.js/lib/bn.js
|
|
16
16
|
var require_bn = __commonJS({
|
|
@@ -11763,6 +11763,10 @@ init_define_MESSENGER_BUILD_INFO();
|
|
|
11763
11763
|
import { existsSync as existsSync2, lstatSync, mkdirSync as mkdirSync2, readFileSync as readFileSync2, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
11764
11764
|
import { join as join2 } from "node:path";
|
|
11765
11765
|
import { randomUUID } from "node:crypto";
|
|
11766
|
+
function workspaceProfile(value) {
|
|
11767
|
+
const optional = (field) => field == null || field === "" ? null : profileName(field);
|
|
11768
|
+
return { fullName: optional(value.fullName), name: optional(value.name), surname: optional(value.surname) };
|
|
11769
|
+
}
|
|
11766
11770
|
function profileName(value) {
|
|
11767
11771
|
if (typeof value !== "string" || !value.trim() || value.length > 100 || /[\x00-\x1f\x7f]/.test(value)) throw Error("Name and Surname require printable text");
|
|
11768
11772
|
return value.trim();
|
|
@@ -11778,10 +11782,10 @@ function readHumanProfile(dir, cid) {
|
|
|
11778
11782
|
const stat2 = lstatSync(file);
|
|
11779
11783
|
if (!stat2.isFile() || stat2.isSymbolicLink() || stat2.nlink !== 1 || stat2.uid !== process.getuid?.() || (stat2.mode & 63) !== 0) throw Error("Private profile path required");
|
|
11780
11784
|
const row = JSON.parse(readFileSync2(file, "utf8"));
|
|
11781
|
-
return
|
|
11785
|
+
return workspaceProfile(row);
|
|
11782
11786
|
}
|
|
11783
11787
|
function writeHumanProfile(dir, cid, value) {
|
|
11784
|
-
const row =
|
|
11788
|
+
const row = workspaceProfile(value);
|
|
11785
11789
|
mkdirSync2(dir, { recursive: true, mode: 448 });
|
|
11786
11790
|
const directory = lstatSync(dir);
|
|
11787
11791
|
if (!directory.isDirectory() || directory.isSymbolicLink() || directory.uid !== process.getuid?.() || (directory.mode & 63) !== 0) throw Error("Private profile directory required");
|
|
@@ -21105,7 +21109,13 @@ var ROUTES = {
|
|
|
21105
21109
|
"GET /api/identity": async ({ client, deps }) => ({ ...publicIdentity(await client.currentIdentity()), humanProfile: readHumanProfile(deps.config.stateDir, deps.identityCid) }),
|
|
21106
21110
|
"POST /api/identity/profile": async ({ client, deps, body }) => {
|
|
21107
21111
|
if (!humanIdentity(await client.currentIdentity())) throw bad("Human profile requires the Human root or a permanent identity under it");
|
|
21108
|
-
|
|
21112
|
+
let profile;
|
|
21113
|
+
try {
|
|
21114
|
+
profile = workspaceProfile(body);
|
|
21115
|
+
} catch {
|
|
21116
|
+
throw bad("Profile requires printable text up to 100 characters");
|
|
21117
|
+
}
|
|
21118
|
+
return writeHumanProfile(deps.config.stateDir, deps.identityCid, profile);
|
|
21109
21119
|
},
|
|
21110
21120
|
// Who the person is on this host. A Messenger that runs as the Human root can sign the workspace proof
|
|
21111
21121
|
// itself; one that runs as the person's own identity under that root names the root the daemon describes
|
|
@@ -21113,7 +21123,7 @@ var ROUTES = {
|
|
|
21113
21123
|
"GET /api/workspace/enrollment-identity": async ({ client }) => {
|
|
21114
21124
|
const identity = await client.currentIdentity(), human = humanIdentity(identity);
|
|
21115
21125
|
if (!human) throw bad("Workspace proof requires the bound Human root or a permanent identity under it");
|
|
21116
|
-
return human.rootCid === void 0 ? { cid: identity.cid, preserveProfile: true } : { cid: identity.cid, rootCid: human.rootCid, preserveProfile: true };
|
|
21126
|
+
return human.rootCid === void 0 ? { cid: identity.cid, preserveProfile: true, optionalWorkspaceProfileV1: true } : { cid: identity.cid, rootCid: human.rootCid, preserveProfile: true, optionalWorkspaceProfileV1: true };
|
|
21117
21127
|
},
|
|
21118
21128
|
// First-party setup operation: daemon signs the command using this bound root.
|
|
21119
21129
|
"POST /api/workspace/unregister": async ({ client, body }) => {
|
|
@@ -21151,7 +21161,7 @@ var ROUTES = {
|
|
|
21151
21161
|
const preserveProfile = optBool(body, "preserveProfile") === true;
|
|
21152
21162
|
let humanProfile;
|
|
21153
21163
|
if (!preserveProfile) try {
|
|
21154
|
-
humanProfile =
|
|
21164
|
+
humanProfile = workspaceProfile(body);
|
|
21155
21165
|
} catch {
|
|
21156
21166
|
throw bad("Name and Surname require printable text up to 100 characters");
|
|
21157
21167
|
}
|
package/dist/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
normalizeBasePath,
|
|
8
8
|
operatorError,
|
|
9
9
|
reportFailure
|
|
10
|
-
} from "./chunks/chunk-
|
|
10
|
+
} from "./chunks/chunk-UNTKMIUK.js";
|
|
11
11
|
|
|
12
12
|
// src/cli.ts
|
|
13
13
|
init_define_MESSENGER_BUILD_INFO();
|
|
@@ -131,7 +131,7 @@ async function main() {
|
|
|
131
131
|
}
|
|
132
132
|
if (process.argv.length !== 3) throw new ConfigurationError("serve does not accept command-line options");
|
|
133
133
|
const cfg = loadConfig();
|
|
134
|
-
const { start } = await import("./chunks/server-
|
|
134
|
+
const { start } = await import("./chunks/server-NUFQF4R5.js");
|
|
135
135
|
const handle = await start(cfg, BUILD_INFO);
|
|
136
136
|
let closing = false;
|
|
137
137
|
const shutdown = (signal) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ours.network/messenger-server",
|
|
3
|
-
"version": "1.0.31-nightly.
|
|
3
|
+
"version": "1.0.31-nightly.20",
|
|
4
4
|
"description": "Self-hosted Messenger REST/SSE backend for one identity on a shared Ours daemon.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "FSL-1.1-Apache-2.0",
|