@linkshell/wire 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 LinkShell Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,12 @@
1
- # Temporary Holding Version
1
+ # @linkshell/wire
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The LinkShell v2 wire protocol, shared by the host, the relay and the apps:
4
+
5
+ - the session model and ACP-shaped session updates,
6
+ - JSON-RPC methods and notifications between devices and a computer,
7
+ - end-to-end encryption (Ed25519 identities, X25519 channel keys, XChaCha20-Poly1305),
8
+ - the relay frames and a relay client for Node and React Native.
9
+
10
+ Most people want the CLI instead: `npm install -g linkshell-cli`.
11
+
12
+ MIT License
@@ -0,0 +1,65 @@
1
+ export declare function utf8(text: string): Uint8Array;
2
+ export declare function fromUtf8(bytes: Uint8Array): string;
3
+ /** Unpadded base64url. */
4
+ export declare function toBase64(bytes: Uint8Array): string;
5
+ export declare function fromBase64(text: string): Uint8Array;
6
+ export declare function randomBytes(length: number): Uint8Array;
7
+ /** The public half, as shared with the gateway and peers. */
8
+ export interface PublicIdentity {
9
+ id: string;
10
+ /** Ed25519, base64url. */
11
+ signKey: string;
12
+ /** X25519, base64url. */
13
+ boxKey: string;
14
+ }
15
+ /** Full identity, secrets included. Stored 0600 on machines, in the keychain on devices. */
16
+ export interface Identity extends PublicIdentity {
17
+ signSecret: string;
18
+ boxSecret: string;
19
+ }
20
+ /** An id is the first 16 bytes of SHA-256 of the Ed25519 key: bound to the key, short enough to show. */
21
+ export declare function idOf(signKey: string): string;
22
+ export declare function createIdentity(): Identity;
23
+ export declare function publicIdentity(identity: Identity): PublicIdentity;
24
+ export declare function sign(identity: Identity, message: string): string;
25
+ export declare function verifySignature(signKey: string, message: string, signature: string): boolean;
26
+ /** What an identity signs to log in to a gateway: its challenge, bound to purpose. */
27
+ export declare function gatewayChallengeMessage(nonce: string): string;
28
+ /** Proves to a machine that the claiming device saw its pairing code (the QR's secret). */
29
+ export declare function pairingProof(secret: string, device: PublicIdentity): string;
30
+ /** The pairing secret behind a typed code, for devices that didn't scan the QR. */
31
+ export declare function codeSecret(code: string): string;
32
+ export declare function checkPairingProof(secret: string, device: PublicIdentity, proof: string): boolean;
33
+ export interface ChannelKeys {
34
+ send: Uint8Array;
35
+ receive: Uint8Array;
36
+ }
37
+ /** A fresh ephemeral X25519 key pair for one channel. */
38
+ export declare function ephemeralKey(): {
39
+ secret: Uint8Array;
40
+ public: string;
41
+ };
42
+ /**
43
+ * Derives both directions' keys. `initiator` is the device. Both sides pass
44
+ * their own statics and ephemeral secrets and the peer's public halves; the
45
+ * mix is symmetric so they arrive at the same pair of keys.
46
+ */
47
+ export declare function channelKeys(input: {
48
+ initiator: boolean;
49
+ local: Identity;
50
+ localEphemeral: Uint8Array;
51
+ remoteBoxKey: string;
52
+ remoteEphemeral: string;
53
+ }): ChannelKeys;
54
+ /**
55
+ * One direction-keyed, ordered, encrypted stream of text frames. Frames that
56
+ * fail to authenticate or arrive out of order are rejected.
57
+ */
58
+ export declare class SecureChannel {
59
+ private readonly keys;
60
+ private sent;
61
+ private received;
62
+ constructor(keys: ChannelKeys);
63
+ seal(text: string): string;
64
+ open(frame: string): string;
65
+ }
package/dist/crypto.js ADDED
@@ -0,0 +1,253 @@
1
+ import { xchacha20poly1305 } from "@noble/ciphers/chacha.js";
2
+ import { ed25519, x25519 } from "@noble/curves/ed25519.js";
3
+ import { hkdf } from "@noble/hashes/hkdf.js";
4
+ import { hmac } from "@noble/hashes/hmac.js";
5
+ import { sha256 } from "@noble/hashes/sha2.js";
6
+ // End-to-end encryption between a device and a machine, through a gateway
7
+ // that only ever sees ciphertext.
8
+ //
9
+ // Identity: every machine and device has an Ed25519 key (proves who it is to
10
+ // the gateway) and an X25519 key (agrees on channel keys). Its id is derived
11
+ // from the Ed25519 key, so an id can't be claimed without the key.
12
+ //
13
+ // Channel: the device opens with a fresh ephemeral key, the machine answers
14
+ // with one; both mix ee, es, se and ss Diffie-Hellman results (Noise-KK
15
+ // style), so only the two holders of the static keys agree on the keys, and a
16
+ // stolen static key doesn't decrypt past channels. Each direction has its own
17
+ // XChaCha20-Poly1305 key and a counter nonce that must strictly increase.
18
+ // UTF-8 by hand: not every JS engine LinkShell runs on has TextDecoder.
19
+ export function utf8(text) {
20
+ const out = [];
21
+ for (let i = 0; i < text.length; i++) {
22
+ let code = text.charCodeAt(i);
23
+ if (code >= 0xd800 && code <= 0xdbff && i + 1 < text.length) {
24
+ const next = text.charCodeAt(i + 1);
25
+ if (next >= 0xdc00 && next <= 0xdfff) {
26
+ code = 0x10000 + ((code - 0xd800) << 10) + (next - 0xdc00);
27
+ i++;
28
+ }
29
+ }
30
+ if (code < 0x80)
31
+ out.push(code);
32
+ else if (code < 0x800)
33
+ out.push(0xc0 | (code >> 6), 0x80 | (code & 63));
34
+ else if (code < 0x10000)
35
+ out.push(0xe0 | (code >> 12), 0x80 | ((code >> 6) & 63), 0x80 | (code & 63));
36
+ else
37
+ out.push(0xf0 | (code >> 18), 0x80 | ((code >> 12) & 63), 0x80 | ((code >> 6) & 63), 0x80 | (code & 63));
38
+ }
39
+ return Uint8Array.from(out);
40
+ }
41
+ export function fromUtf8(bytes) {
42
+ let out = "";
43
+ let chunk = [];
44
+ const flush = () => {
45
+ out += String.fromCharCode(...chunk);
46
+ chunk = [];
47
+ };
48
+ for (let i = 0; i < bytes.length;) {
49
+ const byte = bytes[i];
50
+ let code;
51
+ if (byte < 0x80) {
52
+ code = byte;
53
+ i += 1;
54
+ }
55
+ else if (byte >= 0xf0) {
56
+ code = ((byte & 7) << 18) | ((bytes[i + 1] & 63) << 12) | ((bytes[i + 2] & 63) << 6) | (bytes[i + 3] & 63);
57
+ i += 4;
58
+ }
59
+ else if (byte >= 0xe0) {
60
+ code = ((byte & 15) << 12) | ((bytes[i + 1] & 63) << 6) | (bytes[i + 2] & 63);
61
+ i += 3;
62
+ }
63
+ else {
64
+ code = ((byte & 31) << 6) | (bytes[i + 1] & 63);
65
+ i += 2;
66
+ }
67
+ if (code > 0xffff) {
68
+ code -= 0x10000;
69
+ chunk.push(0xd800 + (code >> 10), 0xdc00 + (code & 1023));
70
+ }
71
+ else
72
+ chunk.push(code);
73
+ if (chunk.length > 8000)
74
+ flush();
75
+ }
76
+ flush();
77
+ return out;
78
+ }
79
+ const encoder = { encode: utf8 };
80
+ // ── encoding (no Buffer / atob in every runtime) ─────────────────────
81
+ const B64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
82
+ const B64_INDEX = new Map([...B64].map((ch, i) => [ch, i]));
83
+ /** Unpadded base64url. */
84
+ export function toBase64(bytes) {
85
+ let out = "";
86
+ for (let i = 0; i < bytes.length; i += 3) {
87
+ const n = (bytes[i] << 16) | ((bytes[i + 1] ?? 0) << 8) | (bytes[i + 2] ?? 0);
88
+ out += B64[(n >> 18) & 63] + B64[(n >> 12) & 63];
89
+ if (i + 1 < bytes.length)
90
+ out += B64[(n >> 6) & 63];
91
+ if (i + 2 < bytes.length)
92
+ out += B64[n & 63];
93
+ }
94
+ return out;
95
+ }
96
+ export function fromBase64(text) {
97
+ const clean = text.replace(/=+$/, "").replace(/\+/g, "-").replace(/\//g, "_");
98
+ const out = new Uint8Array(Math.floor((clean.length * 3) / 4));
99
+ let bits = 0;
100
+ let value = 0;
101
+ let index = 0;
102
+ for (const ch of clean) {
103
+ const digit = B64_INDEX.get(ch);
104
+ if (digit === undefined)
105
+ throw new Error("invalid base64");
106
+ value = (value << 6) | digit;
107
+ bits += 6;
108
+ if (bits >= 8) {
109
+ bits -= 8;
110
+ out[index++] = (value >> bits) & 0xff;
111
+ }
112
+ }
113
+ return out.subarray(0, index);
114
+ }
115
+ function concat(...parts) {
116
+ const out = new Uint8Array(parts.reduce((sum, part) => sum + part.length, 0));
117
+ let offset = 0;
118
+ for (const part of parts) {
119
+ out.set(part, offset);
120
+ offset += part.length;
121
+ }
122
+ return out;
123
+ }
124
+ function equal(a, b) {
125
+ if (a.length !== b.length)
126
+ return false;
127
+ let diff = 0;
128
+ for (let i = 0; i < a.length; i++)
129
+ diff |= a[i] ^ b[i];
130
+ return diff === 0;
131
+ }
132
+ export function randomBytes(length) {
133
+ const bytes = new Uint8Array(length);
134
+ globalThis.crypto.getRandomValues(bytes);
135
+ return bytes;
136
+ }
137
+ /** An id is the first 16 bytes of SHA-256 of the Ed25519 key: bound to the key, short enough to show. */
138
+ export function idOf(signKey) {
139
+ return toBase64(sha256(fromBase64(signKey)).subarray(0, 16));
140
+ }
141
+ export function createIdentity() {
142
+ const signSecret = randomBytes(32);
143
+ const boxSecret = randomBytes(32);
144
+ const signKey = toBase64(ed25519.getPublicKey(signSecret));
145
+ return {
146
+ id: idOf(signKey),
147
+ signKey,
148
+ boxKey: toBase64(x25519.getPublicKey(boxSecret)),
149
+ signSecret: toBase64(signSecret),
150
+ boxSecret: toBase64(boxSecret),
151
+ };
152
+ }
153
+ export function publicIdentity(identity) {
154
+ return { id: identity.id, signKey: identity.signKey, boxKey: identity.boxKey };
155
+ }
156
+ export function sign(identity, message) {
157
+ return toBase64(ed25519.sign(encoder.encode(message), fromBase64(identity.signSecret)));
158
+ }
159
+ export function verifySignature(signKey, message, signature) {
160
+ try {
161
+ return ed25519.verify(fromBase64(signature), encoder.encode(message), fromBase64(signKey));
162
+ }
163
+ catch {
164
+ return false;
165
+ }
166
+ }
167
+ /** What an identity signs to log in to a gateway: its challenge, bound to purpose. */
168
+ export function gatewayChallengeMessage(nonce) {
169
+ return `linkshell-gateway-v2:${nonce}`;
170
+ }
171
+ // ── pairing ──────────────────────────────────────────────────────────
172
+ /** Proves to a machine that the claiming device saw its pairing code (the QR's secret). */
173
+ export function pairingProof(secret, device) {
174
+ return toBase64(hmac(sha256, fromBase64(secret), encoder.encode(`${device.id}.${device.boxKey}`)));
175
+ }
176
+ /** The pairing secret behind a typed code, for devices that didn't scan the QR. */
177
+ export function codeSecret(code) {
178
+ return toBase64(sha256(encoder.encode(`linkshell-pair-code:${code}`)));
179
+ }
180
+ export function checkPairingProof(secret, device, proof) {
181
+ try {
182
+ return equal(fromBase64(pairingProof(secret, device)), fromBase64(proof));
183
+ }
184
+ catch {
185
+ return false;
186
+ }
187
+ }
188
+ /** A fresh ephemeral X25519 key pair for one channel. */
189
+ export function ephemeralKey() {
190
+ const secret = randomBytes(32);
191
+ return { secret, public: toBase64(x25519.getPublicKey(secret)) };
192
+ }
193
+ /**
194
+ * Derives both directions' keys. `initiator` is the device. Both sides pass
195
+ * their own statics and ephemeral secrets and the peer's public halves; the
196
+ * mix is symmetric so they arrive at the same pair of keys.
197
+ */
198
+ export function channelKeys(input) {
199
+ const localStatic = fromBase64(input.local.boxSecret);
200
+ const remoteStatic = fromBase64(input.remoteBoxKey);
201
+ const remoteEphemeral = fromBase64(input.remoteEphemeral);
202
+ const ee = x25519.getSharedSecret(input.localEphemeral, remoteEphemeral);
203
+ const ss = x25519.getSharedSecret(localStatic, remoteStatic);
204
+ // "es" is initiator-ephemeral × responder-static; "se" the other way round.
205
+ const localEphRemoteStatic = x25519.getSharedSecret(input.localEphemeral, remoteStatic);
206
+ const localStaticRemoteEph = x25519.getSharedSecret(localStatic, remoteEphemeral);
207
+ const es = input.initiator ? localEphRemoteStatic : localStaticRemoteEph;
208
+ const se = input.initiator ? localStaticRemoteEph : localEphRemoteStatic;
209
+ const localEphPublic = x25519.getPublicKey(input.localEphemeral);
210
+ const [ie, re] = input.initiator ? [localEphPublic, remoteEphemeral] : [remoteEphemeral, localEphPublic];
211
+ const [is, rs] = input.initiator
212
+ ? [fromBase64(input.local.boxKey), remoteStatic]
213
+ : [remoteStatic, fromBase64(input.local.boxKey)];
214
+ const transcript = concat(encoder.encode("linkshell/v2/channel"), ie, re, is, rs);
215
+ const okm = hkdf(sha256, concat(ee, es, se, ss), sha256(transcript), encoder.encode("linkshell/v2/keys"), 64);
216
+ const toResponder = okm.subarray(0, 32);
217
+ const toInitiator = okm.subarray(32, 64);
218
+ return input.initiator ? { send: toResponder, receive: toInitiator } : { send: toInitiator, receive: toResponder };
219
+ }
220
+ function nonceFor(counter) {
221
+ const nonce = new Uint8Array(24);
222
+ const view = new DataView(nonce.buffer);
223
+ view.setUint32(16, Math.floor(counter / 2 ** 32));
224
+ view.setUint32(20, counter >>> 0);
225
+ return nonce;
226
+ }
227
+ /**
228
+ * One direction-keyed, ordered, encrypted stream of text frames. Frames that
229
+ * fail to authenticate or arrive out of order are rejected.
230
+ */
231
+ export class SecureChannel {
232
+ keys;
233
+ sent = 0;
234
+ received = 0;
235
+ constructor(keys) {
236
+ this.keys = keys;
237
+ }
238
+ seal(text) {
239
+ const counter = ++this.sent;
240
+ const box = xchacha20poly1305(this.keys.send, nonceFor(counter)).encrypt(encoder.encode(text));
241
+ return `${counter}.${toBase64(box)}`;
242
+ }
243
+ open(frame) {
244
+ const dot = frame.indexOf(".");
245
+ const counter = Number(frame.slice(0, dot));
246
+ if (!Number.isSafeInteger(counter) || counter <= this.received)
247
+ throw new Error("replayed or out-of-order frame");
248
+ const plain = xchacha20poly1305(this.keys.receive, nonceFor(counter)).decrypt(fromBase64(frame.slice(dot + 1)));
249
+ this.received = counter;
250
+ return fromUtf8(plain);
251
+ }
252
+ }
253
+ //# sourceMappingURL=crypto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.js","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,0EAA0E;AAC1E,kCAAkC;AAClC,EAAE;AACF,6EAA6E;AAC7E,6EAA6E;AAC7E,mEAAmE;AACnE,EAAE;AACF,4EAA4E;AAC5E,wEAAwE;AACxE,8EAA8E;AAC9E,8EAA8E;AAC9E,0EAA0E;AAE1E,wEAAwE;AACxE,MAAM,UAAU,IAAI,CAAC,IAAY;IAC/B,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,IAAI,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC9B,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YAC5D,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AJ,IAAI,CAAa;IAAG,CAAC;IAElD,IAAI,CAAC,IAAY;QACf,MAAM,OAAO,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC;QAC5B,MAAM,GAAG,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/F,OAAO,GAAG,OAAO,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;IACvC,CAAC;IAED,IAAI,CAAC,KAAa;QAChB,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,OAAO,IAAI,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAClH,MAAM,KAAK,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAChH,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ export * from "./model.js";
2
+ export * from "./updates.js";
3
+ export * from "./rpc.js";
4
+ export * from "./peer.js";
5
+ export * from "./shell.js";
6
+ export * from "./crypto.js";
7
+ export * from "./relay.js";
8
+ export * from "./relay-client.js";
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ export * from "./model.js";
2
+ export * from "./updates.js";
3
+ export * from "./rpc.js";
4
+ export * from "./peer.js";
5
+ export * from "./shell.js";
6
+ export * from "./crypto.js";
7
+ export * from "./relay.js";
8
+ export * from "./relay-client.js";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC"}