pirc-extension 0.3.11 → 0.3.12
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.12}/NOTICE +29 -5
- {pirc-extension-0.3.11 → pirc-extension-0.3.12}/package.json +1 -1
- {pirc-extension-0.3.11 → pirc-extension-0.3.12}/pirc.js +218 -12
- {pirc-extension-0.3.11 → pirc-extension-0.3.12}/LICENSE +0 -0
- {pirc-extension-0.3.11 → pirc-extension-0.3.12}/README.md +0 -0
- {pirc-extension-0.3.11 → pirc-extension-0.3.12}/loader.js +0 -0
- {pirc-extension-0.3.11 → pirc-extension-0.3.12}/pi-parts.js +0 -0
- {pirc-extension-0.3.11 → pirc-extension-0.3.12}/third_party/bufbuild-protobuf/LICENSE +0 -0
- {pirc-extension-0.3.11 → pirc-extension-0.3.12}/third_party/bufbuild-protobuf/LICENSE-Apache-2.0 +0 -0
- {pirc-extension-0.3.11 → pirc-extension-0.3.12}/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.12. 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
|
}
|
|
@@ -9524,6 +9565,9 @@ var Questions = class {
|
|
|
9524
9565
|
}
|
|
9525
9566
|
};
|
|
9526
9567
|
|
|
9568
|
+
// extension/src/hosted/enabled.ts
|
|
9569
|
+
var HOSTED = true ? false : true;
|
|
9570
|
+
|
|
9527
9571
|
// extension/src/host.ts
|
|
9528
9572
|
var isChange = (c) => c !== void 0 && Object.hasOwn(REQUESTS, c) && REQUESTS[c] === "change";
|
|
9529
9573
|
var IDEMPOTENCY_ENTRIES = 1e3;
|
|
@@ -9540,6 +9584,13 @@ var Host = class _Host {
|
|
|
9540
9584
|
config;
|
|
9541
9585
|
key;
|
|
9542
9586
|
conn;
|
|
9587
|
+
// In a hosted account: the anchor, and why it no longer lets this host
|
|
9588
|
+
// serve, if so.
|
|
9589
|
+
anchor;
|
|
9590
|
+
anchorProblem;
|
|
9591
|
+
// Bumped by every connect, so that a hosted connect still reading the
|
|
9592
|
+
// anchor gives way to a later one.
|
|
9593
|
+
connects = 0;
|
|
9543
9594
|
state = { kind: "stopped" };
|
|
9544
9595
|
live;
|
|
9545
9596
|
// A session paused by a reload, until it starts again.
|
|
@@ -9588,6 +9639,7 @@ var Host = class _Host {
|
|
|
9588
9639
|
const host = new _Host(p?.instanceId ?? instanceId, versions);
|
|
9589
9640
|
if (!p) return host;
|
|
9590
9641
|
for (const [id, seq] of p.seqs ?? []) host.seqs.set(id, seq);
|
|
9642
|
+
for (const [k, v] of p.replies ?? []) if (v !== "pending" && typeof v === "object") host.replies.set(k, v);
|
|
9591
9643
|
for (const [id, n] of p.notices ?? []) host.notices.set(id, n);
|
|
9592
9644
|
for (const live of [p.suspended, p.live]) {
|
|
9593
9645
|
if (!live) continue;
|
|
@@ -9687,6 +9739,74 @@ var Host = class _Host {
|
|
|
9687
9739
|
connect(token) {
|
|
9688
9740
|
this.conn?.stop();
|
|
9689
9741
|
this.conn = void 0;
|
|
9742
|
+
this.anchor = void 0;
|
|
9743
|
+
this.anchorProblem = void 0;
|
|
9744
|
+
const attempt = ++this.connects;
|
|
9745
|
+
if (HOSTED) {
|
|
9746
|
+
void this.connectHosted(attempt).then((hosted) => {
|
|
9747
|
+
if (!hosted && attempt === this.connects) this.connectSelfHosted(token);
|
|
9748
|
+
}, (e) => {
|
|
9749
|
+
this.fail("hosted", e);
|
|
9750
|
+
this.showStatus();
|
|
9751
|
+
});
|
|
9752
|
+
return;
|
|
9753
|
+
}
|
|
9754
|
+
this.connectSelfHosted(token);
|
|
9755
|
+
}
|
|
9756
|
+
// A machine whose anchor says it joined a hosted account: true when it
|
|
9757
|
+
// has one, connected or not.
|
|
9758
|
+
async connectHosted(attempt) {
|
|
9759
|
+
const { Anchor } = await Promise.resolve().then(() => (init_anchor(), anchor_exports));
|
|
9760
|
+
const anchor = await Anchor.read();
|
|
9761
|
+
if (!anchor) return false;
|
|
9762
|
+
if (attempt !== this.connects) return true;
|
|
9763
|
+
this.anchor = anchor;
|
|
9764
|
+
try {
|
|
9765
|
+
this.config = loadConfig();
|
|
9766
|
+
} catch (e) {
|
|
9767
|
+
this.fail("config", e);
|
|
9768
|
+
}
|
|
9769
|
+
if (process.env.PIRC_RELAY) {
|
|
9770
|
+
this.fail("hosted", new Error("PIRC_RELAY is set: a computer in a hosted account does not connect while it is; unset it"));
|
|
9771
|
+
this.showStatus();
|
|
9772
|
+
return true;
|
|
9773
|
+
}
|
|
9774
|
+
const state = anchor.state((this.key ??= loadOrCreateKey(this.config?.keyFile ?? "")).publicKey, (await anchor.refresh()).forks);
|
|
9775
|
+
if (state.kind !== "joined") {
|
|
9776
|
+
this.onAnchor(state);
|
|
9777
|
+
return true;
|
|
9778
|
+
}
|
|
9779
|
+
const key2 = this.key;
|
|
9780
|
+
const { HostedTransport } = await Promise.resolve().then(() => (init_transport(), transport_exports));
|
|
9781
|
+
if (attempt !== this.connects) return true;
|
|
9782
|
+
this.conn = new HostedTransport(
|
|
9783
|
+
{ anchor, signer: { publicKey: key2.publicKey, sign: async (m) => signWith(key2, m) }, instanceId: this.instanceId },
|
|
9784
|
+
{
|
|
9785
|
+
onFrame: (f) => this.onFrame(f),
|
|
9786
|
+
onState: (s) => this.onState(s),
|
|
9787
|
+
onAnchor: (s) => this.onAnchor(s),
|
|
9788
|
+
log: (m) => this.log(`hosted: ${m}`),
|
|
9789
|
+
fail: (where, e) => this.fail(where, e)
|
|
9790
|
+
}
|
|
9791
|
+
);
|
|
9792
|
+
this.conn.start();
|
|
9793
|
+
return true;
|
|
9794
|
+
}
|
|
9795
|
+
// The anchor no longer lets this host serve. Removed: the anchor goes,
|
|
9796
|
+
// as on a phone its keys (docs/e2e.md, section 3, Removal); a fork or a
|
|
9797
|
+
// failed join: the anchor stays, and /pirc join is needed.
|
|
9798
|
+
onAnchor(s) {
|
|
9799
|
+
this.anchorProblem = s;
|
|
9800
|
+
this.conn?.stop();
|
|
9801
|
+
this.conn = void 0;
|
|
9802
|
+
this.log(`hosted: ${s.kind}`);
|
|
9803
|
+
if (s.kind === "removed") {
|
|
9804
|
+
void Promise.resolve().then(() => (init_anchor(), anchor_exports)).then(({ Anchor }) => Anchor.remove(), (e) => this.fail("hosted", e));
|
|
9805
|
+
}
|
|
9806
|
+
this.state = { kind: "stopped" };
|
|
9807
|
+
this.showStatus();
|
|
9808
|
+
}
|
|
9809
|
+
connectSelfHosted(token) {
|
|
9690
9810
|
let config;
|
|
9691
9811
|
try {
|
|
9692
9812
|
config = loadConfig();
|
|
@@ -9742,8 +9862,17 @@ var Host = class _Host {
|
|
|
9742
9862
|
}
|
|
9743
9863
|
statusText() {
|
|
9744
9864
|
const s = this.state;
|
|
9745
|
-
|
|
9746
|
-
|
|
9865
|
+
switch (this.anchorProblem?.kind) {
|
|
9866
|
+
case "removed":
|
|
9867
|
+
return "pirc: removed from the account";
|
|
9868
|
+
case "fork":
|
|
9869
|
+
return "pirc: stopped: the account's list has forked";
|
|
9870
|
+
case "join-failed":
|
|
9871
|
+
return "pirc: the join did not take";
|
|
9872
|
+
}
|
|
9873
|
+
if (!this.anchor && !this.config?.relay) return "pirc: not enrolled";
|
|
9874
|
+
if (!this.anchor && this.config?.relay?.startsWith("pirc-e2e:")) return "pirc: left the account";
|
|
9875
|
+
if (!this.anchor && this.config?.removed) return "pirc: removed from the relay";
|
|
9747
9876
|
switch (s.kind) {
|
|
9748
9877
|
case "ready":
|
|
9749
9878
|
return "pirc: online";
|
|
@@ -9762,7 +9891,13 @@ var Host = class _Host {
|
|
|
9762
9891
|
statusReport() {
|
|
9763
9892
|
const lines = [this.statusText()];
|
|
9764
9893
|
const c = this.config;
|
|
9765
|
-
|
|
9894
|
+
const a = this.anchor;
|
|
9895
|
+
if (a) {
|
|
9896
|
+
lines.push(`account ${a.account.accountId.slice(0, 16)} on ${a.account.origin}, end-to-end encrypted`);
|
|
9897
|
+
lines.push(`joined ${a.account.joinedAt}, approved by ${a.account.approverName ? `'${a.account.approverName}'` : a.account.approver.slice(0, 16)}`);
|
|
9898
|
+
lines.push(`list version ${a.latest.body.number}`);
|
|
9899
|
+
if (this.key) lines.push(`key ${Buffer.from(this.key.publicKey).toString("base64url")}`);
|
|
9900
|
+
} else if (c) {
|
|
9766
9901
|
lines.push(`config ${c.path}`);
|
|
9767
9902
|
if (c.relay) lines.push(`relay ${c.relay}`);
|
|
9768
9903
|
lines.push(`key ${c.keyFile}${this.key ? ` (${Buffer.from(this.key.publicKey).toString("base64url")})` : ""}`);
|
|
@@ -9774,10 +9909,27 @@ var Host = class _Host {
|
|
|
9774
9909
|
if (range) lines.push(range);
|
|
9775
9910
|
if (this.dialogs.problem) lines.push(this.dialogs.problem);
|
|
9776
9911
|
if (this.lastError) lines.push(`last error: ${this.lastError}`);
|
|
9777
|
-
|
|
9778
|
-
if (
|
|
9912
|
+
const p = this.anchorProblem;
|
|
9913
|
+
if (p?.kind === "removed") lines.push("a client removed this computer from the account; to join again: /pirc join");
|
|
9914
|
+
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`);
|
|
9915
|
+
if (p?.kind === "join-failed") lines.push("the version that added this computer was withdrawn; join again with /pirc join");
|
|
9916
|
+
if (!a && c?.removed) lines.push(`removed from the relay ${c.removed}; to join again: /pirc enrol <relay-url> [token]`);
|
|
9917
|
+
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
9918
|
return lines.join("\n");
|
|
9780
9919
|
}
|
|
9920
|
+
// This machine's key as a signer, and its name, for /pirc join.
|
|
9921
|
+
joinIdentity() {
|
|
9922
|
+
const config = loadConfig();
|
|
9923
|
+
const key2 = this.key ??= loadOrCreateKey(config.keyFile);
|
|
9924
|
+
return { signer: { publicKey: key2.publicKey, sign: async (m) => signWith(key2, m) }, name: config.label };
|
|
9925
|
+
}
|
|
9926
|
+
// Says something at pi's terminal, through the session's context.
|
|
9927
|
+
notify(message, type) {
|
|
9928
|
+
try {
|
|
9929
|
+
this.live?.ctx.ui.notify(message, type);
|
|
9930
|
+
} catch {
|
|
9931
|
+
}
|
|
9932
|
+
}
|
|
9781
9933
|
// The footer shows only what needs attention: online, the usual state,
|
|
9782
9934
|
// takes no line.
|
|
9783
9935
|
showStatus() {
|
|
@@ -9904,11 +10056,11 @@ var Host = class _Host {
|
|
|
9904
10056
|
};
|
|
9905
10057
|
|
|
9906
10058
|
// extension/src/index.ts
|
|
9907
|
-
var EXTENSION_VERSION = true ? "0.3.
|
|
9908
|
-
var LOAD = true ? "0.3.
|
|
10059
|
+
var EXTENSION_VERSION = true ? "0.3.12" : "dev";
|
|
10060
|
+
var LOAD = true ? "0.3.12" : `dev ${randomBytes4(4).toString("hex")}`;
|
|
9909
10061
|
var KEY = /* @__PURE__ */ Symbol.for("pirc.extension");
|
|
9910
10062
|
var proc = globalThis[KEY] ??= {};
|
|
9911
|
-
var USAGE = "usage: /pirc [status | enrol <relay-url> [token] | reconnect]";
|
|
10063
|
+
var USAGE = HOSTED ? "usage: /pirc [status | enrol <relay-url> [token] | join <hosted-relay> | leave | reconnect]" : "usage: /pirc [status | enrol <relay-url> [token] | reconnect]";
|
|
9912
10064
|
async function index_default(pi) {
|
|
9913
10065
|
const twice = claimLoad(pi.events, packageRoot(import.meta.url));
|
|
9914
10066
|
if (twice) {
|
|
@@ -10026,7 +10178,7 @@ async function index_default(pi) {
|
|
|
10026
10178
|
});
|
|
10027
10179
|
}
|
|
10028
10180
|
pi.registerCommand("pirc", {
|
|
10029
|
-
description: "PiRC: status, enrol <relay-url> [token], reconnect",
|
|
10181
|
+
description: HOSTED ? "PiRC: status, enrol <relay-url> [token], join <hosted-relay>, leave, reconnect" : "PiRC: status, enrol <relay-url> [token], reconnect",
|
|
10030
10182
|
handler: async (args, ctx) => {
|
|
10031
10183
|
const [sub = "status", ...rest] = args.trim().split(/\s+/).filter(Boolean);
|
|
10032
10184
|
switch (sub) {
|
|
@@ -10037,6 +10189,9 @@ async function index_default(pi) {
|
|
|
10037
10189
|
case "enroll": {
|
|
10038
10190
|
const [url, token] = rest;
|
|
10039
10191
|
if (!url || rest.length > 2) return ctx.ui.notify(USAGE, "error");
|
|
10192
|
+
if (HOSTED && await Promise.resolve().then(() => (init_anchor(), anchor_exports)).then(({ Anchor }) => Anchor.read())) {
|
|
10193
|
+
return ctx.ui.notify("pirc: this computer is in a hosted account: /pirc leave first", "error");
|
|
10194
|
+
}
|
|
10040
10195
|
try {
|
|
10041
10196
|
relayURL(url);
|
|
10042
10197
|
saveRelay(url);
|
|
@@ -10051,12 +10206,63 @@ async function index_default(pi) {
|
|
|
10051
10206
|
proc.host.connect();
|
|
10052
10207
|
ctx.ui.notify("pirc: reconnecting", "info");
|
|
10053
10208
|
return;
|
|
10209
|
+
case "join":
|
|
10210
|
+
if (!HOSTED) return ctx.ui.notify(USAGE, "error");
|
|
10211
|
+
return joinCommand(rest, (m, t) => ctx.ui.notify(m, t));
|
|
10212
|
+
case "leave":
|
|
10213
|
+
if (!HOSTED) return ctx.ui.notify(USAGE, "error");
|
|
10214
|
+
return leaveCommand((m, t) => ctx.ui.notify(m, t));
|
|
10054
10215
|
default:
|
|
10055
10216
|
ctx.ui.notify(USAGE, "error");
|
|
10056
10217
|
}
|
|
10057
10218
|
}
|
|
10058
10219
|
});
|
|
10059
10220
|
}
|
|
10221
|
+
async function joinCommand(args, say) {
|
|
10222
|
+
const [origin] = args;
|
|
10223
|
+
if (!origin || args.length > 1) return say(USAGE, "error");
|
|
10224
|
+
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");
|
|
10225
|
+
const { hostedOrigin } = await Promise.resolve().then(() => (init_hosted(), hosted_exports));
|
|
10226
|
+
try {
|
|
10227
|
+
hostedOrigin(origin);
|
|
10228
|
+
} catch (err) {
|
|
10229
|
+
return say(`pirc: ${err.message}`, "error");
|
|
10230
|
+
}
|
|
10231
|
+
const { join: join5 } = await Promise.resolve().then(() => (init_join(), join_exports));
|
|
10232
|
+
proc.joining?.cancel();
|
|
10233
|
+
const host = proc.host;
|
|
10234
|
+
const me = host.joinIdentity();
|
|
10235
|
+
const j = join5({
|
|
10236
|
+
origin,
|
|
10237
|
+
signer: me.signer,
|
|
10238
|
+
name: me.name,
|
|
10239
|
+
log: (m) => host.log(m),
|
|
10240
|
+
onCode: (shown2, until) => {
|
|
10241
|
+
const at = until.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
10242
|
+
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");
|
|
10243
|
+
}
|
|
10244
|
+
});
|
|
10245
|
+
proc.joining = j;
|
|
10246
|
+
try {
|
|
10247
|
+
const { approverName } = await j.done;
|
|
10248
|
+
saveRelay(HOSTED_MARKER);
|
|
10249
|
+
host.connect();
|
|
10250
|
+
host.notify(`pirc: joined the account, approved by ${approverName ? `'${approverName}'` : "a client"}`, "info");
|
|
10251
|
+
} catch (err) {
|
|
10252
|
+
host.notify(`pirc: the join failed: ${err.message}. Run /pirc join again for a new code.`, "error");
|
|
10253
|
+
} finally {
|
|
10254
|
+
if (proc.joining === j) proc.joining = void 0;
|
|
10255
|
+
}
|
|
10256
|
+
}
|
|
10257
|
+
async function leaveCommand(say) {
|
|
10258
|
+
const { Anchor } = await Promise.resolve().then(() => (init_anchor(), anchor_exports));
|
|
10259
|
+
if (!await Anchor.read()) return say("pirc: this computer is in no hosted account", "error");
|
|
10260
|
+
proc.joining?.cancel();
|
|
10261
|
+
Anchor.remove();
|
|
10262
|
+
clearRelay();
|
|
10263
|
+
proc.host.connect();
|
|
10264
|
+
say("pirc: left the account; remove this computer from the account's list in a PiRC app", "info");
|
|
10265
|
+
}
|
|
10060
10266
|
export {
|
|
10061
10267
|
index_default as default
|
|
10062
10268
|
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pirc-extension-0.3.11 → pirc-extension-0.3.12}/third_party/bufbuild-protobuf/LICENSE-Apache-2.0
RENAMED
|
File without changes
|
|
File without changes
|