pirc-extension 0.3.11 → 0.3.13
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.
- {pirc-extension-0.3.11 → pirc-extension-0.3.13}/NOTICE +29 -5
- {pirc-extension-0.3.11 → pirc-extension-0.3.13}/package.json +1 -1
- {pirc-extension-0.3.11 → pirc-extension-0.3.13}/pirc.js +255 -43
- {pirc-extension-0.3.11 → pirc-extension-0.3.13}/LICENSE +0 -0
- {pirc-extension-0.3.11 → pirc-extension-0.3.13}/README.md +0 -0
- {pirc-extension-0.3.11 → pirc-extension-0.3.13}/loader.js +0 -0
- {pirc-extension-0.3.11 → pirc-extension-0.3.13}/pi-parts.js +0 -0
- {pirc-extension-0.3.11 → pirc-extension-0.3.13}/third_party/bufbuild-protobuf/LICENSE +0 -0
- {pirc-extension-0.3.11 → pirc-extension-0.3.13}/third_party/bufbuild-protobuf/LICENSE-Apache-2.0 +0 -0
- {pirc-extension-0.3.11 → pirc-extension-0.3.13}/third_party/ws/LICENSE +0 -0
|
@@ -4,7 +4,7 @@ Copyright (c) 2026 Justino Ltd
|
|
|
4
4
|
PiRC is open source, under three licences by part:
|
|
5
5
|
|
|
6
6
|
- MIT (LICENSE): the pi extension (extension/), the code it shares
|
|
7
|
-
with clients (proto/, protocol/, relay-client/, cases/), the push
|
|
7
|
+
with clients (proto/, protocol/, crypto/, relay-client/, cases/), the push
|
|
8
8
|
gateway (relay/cmd/pirc-gateway, relay/internal/gateway), and the
|
|
9
9
|
rest of the repository.
|
|
10
10
|
- AGPL-3.0 only: the relay (relay/cmd/pirc-relay, relay/internal/server,
|
|
@@ -18,9 +18,32 @@ do not cover (TRADEMARKS.md).
|
|
|
18
18
|
Code adapted from other projects
|
|
19
19
|
--------------------------------
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
Anything adapted keeps its project's copyright notice and is listed here
|
|
22
|
+
and in docs/design.md, section 11, with the upstream commit it came from.
|
|
23
|
+
|
|
24
|
+
- third_party/dart-cryptography/: the Dart package cryptography 2.9.0, as
|
|
25
|
+
published on pub.dev (https://github.com/dint-dev/cryptography),
|
|
26
|
+
Copyright 2019-2020 Gohilla. Apache-2.0. Two lines changed, to fix
|
|
27
|
+
Ed25519's point comparison (README.pirc.md and equals-y.patch there).
|
|
28
|
+
The mobile app uses it in place of the published package.
|
|
29
|
+
|
|
30
|
+
Test vectors from other projects
|
|
31
|
+
--------------------------------
|
|
32
|
+
|
|
33
|
+
cases/e2e/ holds test data from elsewhere, in no release:
|
|
34
|
+
|
|
35
|
+
- ed25519.json: the 12 vectors of ed25519-speccheck, commit
|
|
36
|
+
65519336fda78a3d016e947df6d82848aca0c9da
|
|
37
|
+
(https://github.com/novifinancial/ed25519-speccheck), Copyright (c)
|
|
38
|
+
Facebook, Inc. and its affiliates. Apache-2.0:
|
|
39
|
+
third_party/ed25519-speccheck/
|
|
40
|
+
- hpke.json: one vector of the CFRG's HPKE test-vectors.json, commit
|
|
41
|
+
b1f7cb0cdeab6906c61b3d6574e8bdfdbe1cd3fb
|
|
42
|
+
(https://github.com/cfrg/draft-irtf-cfrg-hpke), published with
|
|
43
|
+
RFC 9180.
|
|
44
|
+
- cpace.json: the test vectors of draft-irtf-cfrg-cpace-21, appendix B.1,
|
|
45
|
+
code components of an IETF document under the Revised BSD License
|
|
46
|
+
(IETF Trust Legal Provisions, section 4).
|
|
24
47
|
|
|
25
48
|
Third-party code in PiRC's releases
|
|
26
49
|
-----------------------------------
|
|
@@ -65,7 +88,8 @@ Geist, Geist Mono and IBM Plex Sans, are under the SIL Open Font License
|
|
|
65
88
|
1.1 and are listed there with it.
|
|
66
89
|
|
|
67
90
|
The mobile app (app/): its Dart and Flutter packages, among them image,
|
|
68
|
-
re_highlight, mobile_scanner
|
|
91
|
+
re_highlight, mobile_scanner, qr and cryptography (from
|
|
92
|
+
third_party/dart-cryptography/, above), and Flutter's engine and framework,
|
|
69
93
|
each with its licence in full, are listed in the NOTICES file that
|
|
70
94
|
Flutter's build writes from the packages themselves and ships inside every
|
|
71
95
|
build of the app (flutter_assets/NOTICES.Z, read by the framework's
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// PiRC extension 0.3.
|
|
1
|
+
// PiRC extension 0.3.13. Third-party code in this file: @bufbuild/protobuf@2.16.0, ws@8.22.0; see NOTICE.
|
|
2
2
|
import { createRequire as __pircCreateRequire } from "node:module";
|
|
3
3
|
const require = __pircCreateRequire(import.meta.url);
|
|
4
4
|
var __create = Object.create;
|
|
@@ -13,6 +13,14 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
13
13
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
14
14
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
15
15
|
});
|
|
16
|
+
var __esm = (fn, res, err) => function __init() {
|
|
17
|
+
if (err) throw err[0];
|
|
18
|
+
try {
|
|
19
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
20
|
+
} catch (e) {
|
|
21
|
+
throw err = [e], e;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
16
24
|
var __commonJS = (cb, mod) => function __require2() {
|
|
17
25
|
try {
|
|
18
26
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
@@ -3720,6 +3728,34 @@ var require_websocket_server = __commonJS({
|
|
|
3720
3728
|
}
|
|
3721
3729
|
});
|
|
3722
3730
|
|
|
3731
|
+
// no-hosted:./hosted/anchor.ts
|
|
3732
|
+
var anchor_exports = {};
|
|
3733
|
+
var init_anchor = __esm({
|
|
3734
|
+
"no-hosted:./hosted/anchor.ts"() {
|
|
3735
|
+
}
|
|
3736
|
+
});
|
|
3737
|
+
|
|
3738
|
+
// no-hosted:./hosted/transport.ts
|
|
3739
|
+
var transport_exports = {};
|
|
3740
|
+
var init_transport = __esm({
|
|
3741
|
+
"no-hosted:./hosted/transport.ts"() {
|
|
3742
|
+
}
|
|
3743
|
+
});
|
|
3744
|
+
|
|
3745
|
+
// no-hosted:@pirc/relay-client/hosted
|
|
3746
|
+
var hosted_exports = {};
|
|
3747
|
+
var init_hosted = __esm({
|
|
3748
|
+
"no-hosted:@pirc/relay-client/hosted"() {
|
|
3749
|
+
}
|
|
3750
|
+
});
|
|
3751
|
+
|
|
3752
|
+
// no-hosted:./hosted/join.ts
|
|
3753
|
+
var join_exports = {};
|
|
3754
|
+
var init_join = __esm({
|
|
3755
|
+
"no-hosted:./hosted/join.ts"() {
|
|
3756
|
+
}
|
|
3757
|
+
});
|
|
3758
|
+
|
|
3723
3759
|
// extension/src/index.ts
|
|
3724
3760
|
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
3725
3761
|
|
|
@@ -7137,10 +7173,10 @@ var import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
|
7137
7173
|
var wrapper_default = import_websocket.default;
|
|
7138
7174
|
|
|
7139
7175
|
// protocol/gen/pirc/v1alpha1/common_pb.ts
|
|
7140
|
-
var file_pirc_v1alpha1_common = /* @__PURE__ */ fileDesc("
|
|
7176
|
+
var file_pirc_v1alpha1_common = /* @__PURE__ */ fileDesc("ChpwaXJjL3YxYWxwaGExL2NvbW1vbi5wcm90bxINcGlyYy52MWFscGhhMSJHCgpTZXNzaW9uUmVmEhAKCGhvc3Rfa2V5GAEgASgMEhIKCnNlc3Npb25faWQYAiABKAkSEwoLaW5zdGFuY2VfaWQYAyABKAkiVAoFRXJyb3ISJgoEY29kZRgBIAEoDjIYLnBpcmMudjFhbHBoYTEuRXJyb3JDb2RlEg8KB21lc3NhZ2UYAiABKAkSEgoKcmVxdWVzdF9pZBgDIAEoCSrTAwoJRXJyb3JDb2RlEhoKFkVSUk9SX0NPREVfVU5TUEVDSUZJRUQQABIeChpFUlJPUl9DT0RFX1VOQVVUSEVOVElDQVRFRBABEiAKHEVSUk9SX0NPREVfUEVSTUlTU0lPTl9ERU5JRUQQAhIiCh5FUlJPUl9DT0RFX1ZFUlNJT05fVU5TVVBQT1JURUQQAxIWChJFUlJPUl9DT0RFX0lOVkFMSUQQBBIYChRFUlJPUl9DT0RFX1RPT19MQVJHRRAFEiAKHEVSUk9SX0NPREVfU0VTU0lPTl9OT1RfRk9VTkQQBhIbChdFUlJPUl9DT0RFX1NFU1NJT05fR09ORRAHEhMKD0VSUk9SX0NPREVfQlVTWRAIEhYKEkVSUk9SX0NPREVfVElNRU9VVBAJEhwKGEVSUk9SX0NPREVfVE9LRU5fSU5WQUxJRBAKEhsKF0VSUk9SX0NPREVfUkFURV9MSU1JVEVEEAsSFwoTRVJST1JfQ09ERV9JTlRFUk5BTBAMEhgKFEVSUk9SX0NPREVfUElfRkFJTEVEEA0SHwobRVJST1JfQ09ERV9BUFBST1ZBTF9QRU5ESU5HEA4SFwoTRVJST1JfQ09ERV9DT05GTElDVBAPQqwBChFjb20ucGlyYy52MWFscGhhMUILQ29tbW9uUHJvdG9QAVo1cGlyYy5kZXYvcmVsYXkvaW50ZXJuYWwvcGIvcGlyYy92MWFscGhhMTtwaXJjdjFhbHBoYTGiAgNQWFiqAg1QaXJjLlYxYWxwaGExygINUGlyY1xWMWFscGhhMeICGVBpcmNcVjFhbHBoYTFcR1BCTWV0YWRhdGHqAg5QaXJjOjpWMWFscGhhMWIGcHJvdG8z");
|
|
7141
7177
|
|
|
7142
7178
|
// protocol/gen/pirc/v1alpha1/relay_pb.ts
|
|
7143
|
-
var file_pirc_v1alpha1_relay = /* @__PURE__ */ fileDesc("
|
|
7179
|
+
var file_pirc_v1alpha1_relay = /* @__PURE__ */ fileDesc("ChlwaXJjL3YxYWxwaGExL3JlbGF5LnByb3RvEg1waXJjLnYxYWxwaGExIpoMCgVGcmFtZRIlCgVoZWxsbxgBIAEoCzIULnBpcmMudjFhbHBoYTEuSGVsbG9IABItCgljaGFsbGVuZ2UYAiABKAsyGC5waXJjLnYxYWxwaGExLkNoYWxsZW5nZUgAEiMKBGF1dGgYAyABKAsyEy5waX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xYWxwaGExXEdQQk1ldGFkYXRh6gIOUGlyYzo6VjFhbHBoYTFiBnByb3RvMw", [file_google_protobuf_duration, file_google_protobuf_timestamp, file_pirc_v1alpha1_common]);
|
|
7144
7180
|
var FrameSchema = /* @__PURE__ */ messageDesc(file_pirc_v1alpha1_relay, 0);
|
|
7145
7181
|
|
|
7146
7182
|
// protocol/gen/pirc/v1alpha1/session_pb.ts
|
|
@@ -7492,6 +7528,11 @@ function saveRelay(relay) {
|
|
|
7492
7528
|
const { removed: _, ...f } = readFile(configPath());
|
|
7493
7529
|
write({ ...f, relay });
|
|
7494
7530
|
}
|
|
7531
|
+
var HOSTED_MARKER = "pirc-e2e:anchor";
|
|
7532
|
+
function clearRelay() {
|
|
7533
|
+
const { relay: _, removed: __, ...f } = readFile(configPath());
|
|
7534
|
+
write(f);
|
|
7535
|
+
}
|
|
7495
7536
|
function saveRemoved(at) {
|
|
7496
7537
|
write({ ...readFile(configPath()), removed: at.toISOString() });
|
|
7497
7538
|
}
|
|
@@ -8154,47 +8195,53 @@ async function tmuxPlace(env) {
|
|
|
8154
8195
|
return place({ kind: "tmux", group, window, windowNumber: Number(windowNumber) });
|
|
8155
8196
|
}
|
|
8156
8197
|
function herdrSession(path) {
|
|
8157
|
-
const
|
|
8158
|
-
let buf = "";
|
|
8198
|
+
const open = /* @__PURE__ */ new Set();
|
|
8159
8199
|
let n = 0;
|
|
8160
|
-
|
|
8161
|
-
const failAll = (e) => {
|
|
8162
|
-
for (const w of waiting.values()) w.reject(e);
|
|
8163
|
-
waiting.clear();
|
|
8164
|
-
};
|
|
8165
|
-
socket.setEncoding("utf8");
|
|
8166
|
-
socket.on("data", (d) => {
|
|
8167
|
-
buf += d;
|
|
8168
|
-
let i;
|
|
8169
|
-
while ((i = buf.indexOf("\n")) >= 0) {
|
|
8170
|
-
const line = buf.slice(0, i);
|
|
8171
|
-
buf = buf.slice(i + 1);
|
|
8172
|
-
let m;
|
|
8173
|
-
try {
|
|
8174
|
-
m = JSON.parse(line);
|
|
8175
|
-
} catch {
|
|
8176
|
-
continue;
|
|
8177
|
-
}
|
|
8178
|
-
const w = m.id ? waiting.get(m.id) : void 0;
|
|
8179
|
-
if (!w) continue;
|
|
8180
|
-
waiting.delete(m.id);
|
|
8181
|
-
if (m.result) w.resolve(m.result);
|
|
8182
|
-
else w.reject(new Error(`herdr: ${m.error?.message ?? "no result"}`));
|
|
8183
|
-
}
|
|
8184
|
-
});
|
|
8185
|
-
socket.on("error", (e) => failAll(e));
|
|
8186
|
-
socket.on("close", () => failAll(new Error("herdr closed the connection")));
|
|
8200
|
+
let closed = false;
|
|
8187
8201
|
return {
|
|
8188
8202
|
ask(method, params) {
|
|
8189
8203
|
const id = `pirc-${++n}`;
|
|
8190
8204
|
return new Promise((resolve, reject) => {
|
|
8191
|
-
|
|
8205
|
+
if (closed) return reject(new Error("herdr did not answer in time"));
|
|
8206
|
+
const socket = createConnection(path);
|
|
8207
|
+
open.add(socket);
|
|
8208
|
+
let buf = "";
|
|
8209
|
+
let done = false;
|
|
8210
|
+
const finish = (err, result) => {
|
|
8211
|
+
if (done) return;
|
|
8212
|
+
done = true;
|
|
8213
|
+
open.delete(socket);
|
|
8214
|
+
socket.destroy();
|
|
8215
|
+
if (err) reject(err);
|
|
8216
|
+
else resolve(result);
|
|
8217
|
+
};
|
|
8218
|
+
socket.setEncoding("utf8");
|
|
8219
|
+
socket.on("data", (d) => {
|
|
8220
|
+
buf += d;
|
|
8221
|
+
let i;
|
|
8222
|
+
while ((i = buf.indexOf("\n")) >= 0) {
|
|
8223
|
+
const line = buf.slice(0, i);
|
|
8224
|
+
buf = buf.slice(i + 1);
|
|
8225
|
+
let m;
|
|
8226
|
+
try {
|
|
8227
|
+
m = JSON.parse(line);
|
|
8228
|
+
} catch {
|
|
8229
|
+
continue;
|
|
8230
|
+
}
|
|
8231
|
+
if (m.id !== id) continue;
|
|
8232
|
+
if (m.result) finish(void 0, m.result);
|
|
8233
|
+
else finish(new Error(`herdr: ${m.error?.message ?? "no result"}`));
|
|
8234
|
+
}
|
|
8235
|
+
});
|
|
8236
|
+
socket.on("error", (e) => finish(new Error(`herdr: ${e.message}`)));
|
|
8237
|
+
socket.on("close", () => finish(new Error(closed ? "herdr did not answer in time" : "herdr closed the connection")));
|
|
8192
8238
|
socket.write(`${JSON.stringify({ id, method, params })}
|
|
8193
8239
|
`);
|
|
8194
8240
|
});
|
|
8195
8241
|
},
|
|
8196
8242
|
close() {
|
|
8197
|
-
|
|
8243
|
+
closed = true;
|
|
8244
|
+
for (const s of open) s.destroy();
|
|
8198
8245
|
}
|
|
8199
8246
|
};
|
|
8200
8247
|
}
|
|
@@ -9524,6 +9571,9 @@ var Questions = class {
|
|
|
9524
9571
|
}
|
|
9525
9572
|
};
|
|
9526
9573
|
|
|
9574
|
+
// extension/src/hosted/enabled.ts
|
|
9575
|
+
var HOSTED = true ? false : true;
|
|
9576
|
+
|
|
9527
9577
|
// extension/src/host.ts
|
|
9528
9578
|
var isChange = (c) => c !== void 0 && Object.hasOwn(REQUESTS, c) && REQUESTS[c] === "change";
|
|
9529
9579
|
var IDEMPOTENCY_ENTRIES = 1e3;
|
|
@@ -9540,6 +9590,13 @@ var Host = class _Host {
|
|
|
9540
9590
|
config;
|
|
9541
9591
|
key;
|
|
9542
9592
|
conn;
|
|
9593
|
+
// In a hosted account: the anchor, and why it no longer lets this host
|
|
9594
|
+
// serve, if so.
|
|
9595
|
+
anchor;
|
|
9596
|
+
anchorProblem;
|
|
9597
|
+
// Bumped by every connect, so that a hosted connect still reading the
|
|
9598
|
+
// anchor gives way to a later one.
|
|
9599
|
+
connects = 0;
|
|
9543
9600
|
state = { kind: "stopped" };
|
|
9544
9601
|
live;
|
|
9545
9602
|
// A session paused by a reload, until it starts again.
|
|
@@ -9588,6 +9645,7 @@ var Host = class _Host {
|
|
|
9588
9645
|
const host = new _Host(p?.instanceId ?? instanceId, versions);
|
|
9589
9646
|
if (!p) return host;
|
|
9590
9647
|
for (const [id, seq] of p.seqs ?? []) host.seqs.set(id, seq);
|
|
9648
|
+
for (const [k, v] of p.replies ?? []) if (v !== "pending" && typeof v === "object") host.replies.set(k, v);
|
|
9591
9649
|
for (const [id, n] of p.notices ?? []) host.notices.set(id, n);
|
|
9592
9650
|
for (const live of [p.suspended, p.live]) {
|
|
9593
9651
|
if (!live) continue;
|
|
@@ -9687,6 +9745,74 @@ var Host = class _Host {
|
|
|
9687
9745
|
connect(token) {
|
|
9688
9746
|
this.conn?.stop();
|
|
9689
9747
|
this.conn = void 0;
|
|
9748
|
+
this.anchor = void 0;
|
|
9749
|
+
this.anchorProblem = void 0;
|
|
9750
|
+
const attempt = ++this.connects;
|
|
9751
|
+
if (HOSTED) {
|
|
9752
|
+
void this.connectHosted(attempt).then((hosted) => {
|
|
9753
|
+
if (!hosted && attempt === this.connects) this.connectSelfHosted(token);
|
|
9754
|
+
}, (e) => {
|
|
9755
|
+
this.fail("hosted", e);
|
|
9756
|
+
this.showStatus();
|
|
9757
|
+
});
|
|
9758
|
+
return;
|
|
9759
|
+
}
|
|
9760
|
+
this.connectSelfHosted(token);
|
|
9761
|
+
}
|
|
9762
|
+
// A machine whose anchor says it joined a hosted account: true when it
|
|
9763
|
+
// has one, connected or not.
|
|
9764
|
+
async connectHosted(attempt) {
|
|
9765
|
+
const { Anchor } = await Promise.resolve().then(() => (init_anchor(), anchor_exports));
|
|
9766
|
+
const anchor = await Anchor.read();
|
|
9767
|
+
if (!anchor) return false;
|
|
9768
|
+
if (attempt !== this.connects) return true;
|
|
9769
|
+
this.anchor = anchor;
|
|
9770
|
+
try {
|
|
9771
|
+
this.config = loadConfig();
|
|
9772
|
+
} catch (e) {
|
|
9773
|
+
this.fail("config", e);
|
|
9774
|
+
}
|
|
9775
|
+
if (process.env.PIRC_RELAY) {
|
|
9776
|
+
this.fail("hosted", new Error("PIRC_RELAY is set: a computer in a hosted account does not connect while it is; unset it"));
|
|
9777
|
+
this.showStatus();
|
|
9778
|
+
return true;
|
|
9779
|
+
}
|
|
9780
|
+
const state = anchor.state((this.key ??= loadOrCreateKey(this.config?.keyFile ?? "")).publicKey, (await anchor.refresh()).forks);
|
|
9781
|
+
if (state.kind !== "joined") {
|
|
9782
|
+
this.onAnchor(state);
|
|
9783
|
+
return true;
|
|
9784
|
+
}
|
|
9785
|
+
const key2 = this.key;
|
|
9786
|
+
const { HostedTransport } = await Promise.resolve().then(() => (init_transport(), transport_exports));
|
|
9787
|
+
if (attempt !== this.connects) return true;
|
|
9788
|
+
this.conn = new HostedTransport(
|
|
9789
|
+
{ anchor, signer: { publicKey: key2.publicKey, sign: async (m) => signWith(key2, m) }, instanceId: this.instanceId },
|
|
9790
|
+
{
|
|
9791
|
+
onFrame: (f) => this.onFrame(f),
|
|
9792
|
+
onState: (s) => this.onState(s),
|
|
9793
|
+
onAnchor: (s) => this.onAnchor(s),
|
|
9794
|
+
log: (m) => this.log(`hosted: ${m}`),
|
|
9795
|
+
fail: (where, e) => this.fail(where, e)
|
|
9796
|
+
}
|
|
9797
|
+
);
|
|
9798
|
+
this.conn.start();
|
|
9799
|
+
return true;
|
|
9800
|
+
}
|
|
9801
|
+
// The anchor no longer lets this host serve. Removed: the anchor goes,
|
|
9802
|
+
// as on a phone its keys (docs/e2e.md, section 3, Removal); a fork or a
|
|
9803
|
+
// failed join: the anchor stays, and /pirc join is needed.
|
|
9804
|
+
onAnchor(s) {
|
|
9805
|
+
this.anchorProblem = s;
|
|
9806
|
+
this.conn?.stop();
|
|
9807
|
+
this.conn = void 0;
|
|
9808
|
+
this.log(`hosted: ${s.kind}`);
|
|
9809
|
+
if (s.kind === "removed") {
|
|
9810
|
+
void Promise.resolve().then(() => (init_anchor(), anchor_exports)).then(({ Anchor }) => Anchor.remove(), (e) => this.fail("hosted", e));
|
|
9811
|
+
}
|
|
9812
|
+
this.state = { kind: "stopped" };
|
|
9813
|
+
this.showStatus();
|
|
9814
|
+
}
|
|
9815
|
+
connectSelfHosted(token) {
|
|
9690
9816
|
let config;
|
|
9691
9817
|
try {
|
|
9692
9818
|
config = loadConfig();
|
|
@@ -9742,8 +9868,17 @@ var Host = class _Host {
|
|
|
9742
9868
|
}
|
|
9743
9869
|
statusText() {
|
|
9744
9870
|
const s = this.state;
|
|
9745
|
-
|
|
9746
|
-
|
|
9871
|
+
switch (this.anchorProblem?.kind) {
|
|
9872
|
+
case "removed":
|
|
9873
|
+
return "pirc: removed from the account";
|
|
9874
|
+
case "fork":
|
|
9875
|
+
return "pirc: stopped: the account's list has forked";
|
|
9876
|
+
case "join-failed":
|
|
9877
|
+
return "pirc: the join did not take";
|
|
9878
|
+
}
|
|
9879
|
+
if (!this.anchor && !this.config?.relay) return "pirc: not enrolled";
|
|
9880
|
+
if (!this.anchor && this.config?.relay?.startsWith("pirc-e2e:")) return "pirc: left the account";
|
|
9881
|
+
if (!this.anchor && this.config?.removed) return "pirc: removed from the relay";
|
|
9747
9882
|
switch (s.kind) {
|
|
9748
9883
|
case "ready":
|
|
9749
9884
|
return "pirc: online";
|
|
@@ -9762,7 +9897,13 @@ var Host = class _Host {
|
|
|
9762
9897
|
statusReport() {
|
|
9763
9898
|
const lines = [this.statusText()];
|
|
9764
9899
|
const c = this.config;
|
|
9765
|
-
|
|
9900
|
+
const a = this.anchor;
|
|
9901
|
+
if (a) {
|
|
9902
|
+
lines.push(`account ${a.account.accountId.slice(0, 16)} on ${a.account.origin}, end-to-end encrypted`);
|
|
9903
|
+
lines.push(`joined ${a.account.joinedAt}, approved by ${a.account.approverName ? `'${a.account.approverName}'` : a.account.approver.slice(0, 16)}`);
|
|
9904
|
+
lines.push(`list version ${a.latest.body.number}`);
|
|
9905
|
+
if (this.key) lines.push(`key ${Buffer.from(this.key.publicKey).toString("base64url")}`);
|
|
9906
|
+
} else if (c) {
|
|
9766
9907
|
lines.push(`config ${c.path}`);
|
|
9767
9908
|
if (c.relay) lines.push(`relay ${c.relay}`);
|
|
9768
9909
|
lines.push(`key ${c.keyFile}${this.key ? ` (${Buffer.from(this.key.publicKey).toString("base64url")})` : ""}`);
|
|
@@ -9774,10 +9915,27 @@ var Host = class _Host {
|
|
|
9774
9915
|
if (range) lines.push(range);
|
|
9775
9916
|
if (this.dialogs.problem) lines.push(this.dialogs.problem);
|
|
9776
9917
|
if (this.lastError) lines.push(`last error: ${this.lastError}`);
|
|
9777
|
-
|
|
9778
|
-
if (
|
|
9918
|
+
const p = this.anchorProblem;
|
|
9919
|
+
if (p?.kind === "removed") lines.push("a client removed this computer from the account; to join again: /pirc join");
|
|
9920
|
+
if (p?.kind === "fork") lines.push(`two versions ${p.number} of the account's list, neither withdrawn: this computer cannot tell which is its account's, so it serves nothing until /pirc join is run again here`);
|
|
9921
|
+
if (p?.kind === "join-failed") lines.push("the version that added this computer was withdrawn; join again with /pirc join");
|
|
9922
|
+
if (!a && c?.removed) lines.push(`removed from the relay ${c.removed}; to join again: /pirc enrol <relay-url> [token]`);
|
|
9923
|
+
if (!a && !c?.relay) lines.push("enrol with: /pirc enrol <relay-url> [token]; without a token, approve this key in the web app or with pirc-relay approve");
|
|
9779
9924
|
return lines.join("\n");
|
|
9780
9925
|
}
|
|
9926
|
+
// This machine's key as a signer, and its name, for /pirc join.
|
|
9927
|
+
joinIdentity() {
|
|
9928
|
+
const config = loadConfig();
|
|
9929
|
+
const key2 = this.key ??= loadOrCreateKey(config.keyFile);
|
|
9930
|
+
return { signer: { publicKey: key2.publicKey, sign: async (m) => signWith(key2, m) }, name: config.label };
|
|
9931
|
+
}
|
|
9932
|
+
// Says something at pi's terminal, through the session's context.
|
|
9933
|
+
notify(message, type) {
|
|
9934
|
+
try {
|
|
9935
|
+
this.live?.ctx.ui.notify(message, type);
|
|
9936
|
+
} catch {
|
|
9937
|
+
}
|
|
9938
|
+
}
|
|
9781
9939
|
// The footer shows only what needs attention: online, the usual state,
|
|
9782
9940
|
// takes no line.
|
|
9783
9941
|
showStatus() {
|
|
@@ -9904,11 +10062,11 @@ var Host = class _Host {
|
|
|
9904
10062
|
};
|
|
9905
10063
|
|
|
9906
10064
|
// extension/src/index.ts
|
|
9907
|
-
var EXTENSION_VERSION = true ? "0.3.
|
|
9908
|
-
var LOAD = true ? "0.3.
|
|
10065
|
+
var EXTENSION_VERSION = true ? "0.3.13" : "dev";
|
|
10066
|
+
var LOAD = true ? "0.3.13" : `dev ${randomBytes4(4).toString("hex")}`;
|
|
9909
10067
|
var KEY = /* @__PURE__ */ Symbol.for("pirc.extension");
|
|
9910
10068
|
var proc = globalThis[KEY] ??= {};
|
|
9911
|
-
var USAGE = "usage: /pirc [status | enrol <relay-url> [token] | reconnect]";
|
|
10069
|
+
var USAGE = HOSTED ? "usage: /pirc [status | enrol <relay-url> [token] | join <hosted-relay> | leave | reconnect]" : "usage: /pirc [status | enrol <relay-url> [token] | reconnect]";
|
|
9912
10070
|
async function index_default(pi) {
|
|
9913
10071
|
const twice = claimLoad(pi.events, packageRoot(import.meta.url));
|
|
9914
10072
|
if (twice) {
|
|
@@ -10026,7 +10184,7 @@ async function index_default(pi) {
|
|
|
10026
10184
|
});
|
|
10027
10185
|
}
|
|
10028
10186
|
pi.registerCommand("pirc", {
|
|
10029
|
-
description: "PiRC: status, enrol <relay-url> [token], reconnect",
|
|
10187
|
+
description: HOSTED ? "PiRC: status, enrol <relay-url> [token], join <hosted-relay>, leave, reconnect" : "PiRC: status, enrol <relay-url> [token], reconnect",
|
|
10030
10188
|
handler: async (args, ctx) => {
|
|
10031
10189
|
const [sub = "status", ...rest] = args.trim().split(/\s+/).filter(Boolean);
|
|
10032
10190
|
switch (sub) {
|
|
@@ -10037,6 +10195,9 @@ async function index_default(pi) {
|
|
|
10037
10195
|
case "enroll": {
|
|
10038
10196
|
const [url, token] = rest;
|
|
10039
10197
|
if (!url || rest.length > 2) return ctx.ui.notify(USAGE, "error");
|
|
10198
|
+
if (HOSTED && await Promise.resolve().then(() => (init_anchor(), anchor_exports)).then(({ Anchor }) => Anchor.read())) {
|
|
10199
|
+
return ctx.ui.notify("pirc: this computer is in a hosted account: /pirc leave first", "error");
|
|
10200
|
+
}
|
|
10040
10201
|
try {
|
|
10041
10202
|
relayURL(url);
|
|
10042
10203
|
saveRelay(url);
|
|
@@ -10051,12 +10212,63 @@ async function index_default(pi) {
|
|
|
10051
10212
|
proc.host.connect();
|
|
10052
10213
|
ctx.ui.notify("pirc: reconnecting", "info");
|
|
10053
10214
|
return;
|
|
10215
|
+
case "join":
|
|
10216
|
+
if (!HOSTED) return ctx.ui.notify(USAGE, "error");
|
|
10217
|
+
return joinCommand(rest, (m, t) => ctx.ui.notify(m, t));
|
|
10218
|
+
case "leave":
|
|
10219
|
+
if (!HOSTED) return ctx.ui.notify(USAGE, "error");
|
|
10220
|
+
return leaveCommand((m, t) => ctx.ui.notify(m, t));
|
|
10054
10221
|
default:
|
|
10055
10222
|
ctx.ui.notify(USAGE, "error");
|
|
10056
10223
|
}
|
|
10057
10224
|
}
|
|
10058
10225
|
});
|
|
10059
10226
|
}
|
|
10227
|
+
async function joinCommand(args, say) {
|
|
10228
|
+
const [origin] = args;
|
|
10229
|
+
if (!origin || args.length > 1) return say(USAGE, "error");
|
|
10230
|
+
if (process.env.PIRC_RELAY) return say("pirc: PIRC_RELAY is set: unset it first, since every install of PiRC on this machine reads it, older ones included", "error");
|
|
10231
|
+
const { hostedOrigin } = await Promise.resolve().then(() => (init_hosted(), hosted_exports));
|
|
10232
|
+
try {
|
|
10233
|
+
hostedOrigin(origin);
|
|
10234
|
+
} catch (err) {
|
|
10235
|
+
return say(`pirc: ${err.message}`, "error");
|
|
10236
|
+
}
|
|
10237
|
+
const { join: join5 } = await Promise.resolve().then(() => (init_join(), join_exports));
|
|
10238
|
+
proc.joining?.cancel();
|
|
10239
|
+
const host = proc.host;
|
|
10240
|
+
const me = host.joinIdentity();
|
|
10241
|
+
const j = join5({
|
|
10242
|
+
origin,
|
|
10243
|
+
signer: me.signer,
|
|
10244
|
+
name: me.name,
|
|
10245
|
+
log: (m) => host.log(m),
|
|
10246
|
+
onCode: (shown2, until) => {
|
|
10247
|
+
const at = until.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
10248
|
+
say(`pirc: type ${shown2} into a PiRC app of your account, under Add a device. Whoever types this code gets full control of this computer: never read it out to anyone. It works once, until ${at}.`, "warning");
|
|
10249
|
+
}
|
|
10250
|
+
});
|
|
10251
|
+
proc.joining = j;
|
|
10252
|
+
try {
|
|
10253
|
+
const { approverName } = await j.done;
|
|
10254
|
+
saveRelay(HOSTED_MARKER);
|
|
10255
|
+
host.connect();
|
|
10256
|
+
host.notify(`pirc: joined the account, approved by ${approverName ? `'${approverName}'` : "a client"}`, "info");
|
|
10257
|
+
} catch (err) {
|
|
10258
|
+
host.notify(`pirc: the join failed: ${err.message}. Run /pirc join again for a new code.`, "error");
|
|
10259
|
+
} finally {
|
|
10260
|
+
if (proc.joining === j) proc.joining = void 0;
|
|
10261
|
+
}
|
|
10262
|
+
}
|
|
10263
|
+
async function leaveCommand(say) {
|
|
10264
|
+
const { Anchor } = await Promise.resolve().then(() => (init_anchor(), anchor_exports));
|
|
10265
|
+
if (!await Anchor.read()) return say("pirc: this computer is in no hosted account", "error");
|
|
10266
|
+
proc.joining?.cancel();
|
|
10267
|
+
Anchor.remove();
|
|
10268
|
+
clearRelay();
|
|
10269
|
+
proc.host.connect();
|
|
10270
|
+
say("pirc: left the account; remove this computer from the account's list in a PiRC app", "info");
|
|
10271
|
+
}
|
|
10060
10272
|
export {
|
|
10061
10273
|
index_default as default
|
|
10062
10274
|
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pirc-extension-0.3.11 → pirc-extension-0.3.13}/third_party/bufbuild-protobuf/LICENSE-Apache-2.0
RENAMED
|
File without changes
|
|
File without changes
|