sigelo-contact 0.1.14 → 0.1.21
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/README.md +13 -10
- package/call.mjs +831 -0
- package/carrier.mjs +1013 -112
- package/control.mjs +81 -22
- package/device.mjs +1 -1
- package/enrol.mjs +214 -35
- package/gen-carrier.mjs +4 -4
- package/gen-device.mjs +2 -2
- package/gen-envelope.mjs +3 -3
- package/gen-invite.mjs +3 -3
- package/gen-short.mjs +3 -3
- package/group.mjs +28 -9
- package/invite.mjs +63 -13
- package/kdf.mjs +1 -1
- package/link.mjs +1 -1
- package/package.json +34 -7
- package/page.mjs +1018 -81
- package/photo.mjs +37 -0
- package/platform-node.mjs +110 -13
- package/prekeys.mjs +10 -2
- package/public.mjs +93 -0
- package/relays.mjs +1 -1
- package/restore.mjs +3 -3
- package/rtc-web.mjs +109 -0
- package/short.mjs +19 -3
- package/store.mjs +126 -10
- package/test-carrier.mjs +121 -18
- package/test-device.mjs +1 -1
- package/test-enrol.mjs +123 -8
- package/test-envelope.mjs +16 -3
- package/test-file.mjs +5 -5
- package/test-group.mjs +48 -7
- package/test-invite.mjs +15 -2
- package/test-link.mjs +6 -6
- package/test-platform.mjs +5 -5
- package/test-presence.mjs +5 -5
- package/test-push.mjs +136 -0
- package/test-relay-lane.mjs +323 -0
- package/test-short.mjs +35 -12
- package/test-tier.mjs +6 -6
- package/test-transfer-web.mjs +313 -0
- package/test-transfer.mjs +51 -11
- package/test-voice.mjs +161 -0
- package/test-ws.mjs +5 -5
- package/transfer-engine.mjs +858 -0
- package/transfer-node.mjs +254 -641
- package/transfer-web.mjs +80 -0
- package/transfer.mjs +25 -6
- package/voice-web.mjs +113 -0
- package/voice.mjs +70 -0
- package/words-lock.mjs +25 -10
package/test-voice.mjs
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Voice messages (design/transfer.md "Voice"; voice.mjs, voice-web.mjs, transfer-node.mjs voiceFiles): the
|
|
3
|
+
// sigelo-voice/0 message's shape and checks, the line the CLI and MCP print, a group msg's voice, the
|
|
4
|
+
// recorder over a fake MediaRecorder (format, duration, waveform, cancel, the refusals), and the
|
|
5
|
+
// computer's recordings on disk (pieces, kept outside the files received, read back only from its own).
|
|
6
|
+
// node apps/contact/test-voice.mjs → ALL PASS (n)
|
|
7
|
+
import { existsSync, mkdtempSync, readFileSync, rmSync, statSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
8
|
+
import { tmpdir } from 'node:os';
|
|
9
|
+
import { join } from 'node:path';
|
|
10
|
+
import { VOICE_LABEL, VOICE_MAX_S, checkVoice, clock, peaksOf, voiceItems, voiceLine, voiceName } from './voice.mjs';
|
|
11
|
+
import { canRecord, downsample, record, recorderType, sniff } from './voice-web.mjs';
|
|
12
|
+
import { GROUP_V, checkBody } from './group.mjs';
|
|
13
|
+
import { voiceFiles } from './transfer-node.mjs';
|
|
14
|
+
import { sendable } from './platform-node.mjs';
|
|
15
|
+
|
|
16
|
+
let count = 0;
|
|
17
|
+
const fails = [];
|
|
18
|
+
const ok = (cond, what, more) => { count++; if (!cond) fails.push(more === undefined ? what : `${what} (${String(more).slice(0, 600)})`); };
|
|
19
|
+
const checkOf = (f) => { try { f(); return 'accepted'; } catch (e) { return e.check ?? `exception ${e.constructor.name}: ${e.message}`; } };
|
|
20
|
+
const failure = async (f) => { try { await f(); return 'accepted'; } catch (e) { return e.check ?? `exception ${e.message}`; } };
|
|
21
|
+
|
|
22
|
+
// ---- the message
|
|
23
|
+
const SHA = 'ab'.repeat(32), WAVE = Buffer.from([0, 40, 255, 128]).toString('base64');
|
|
24
|
+
const V = { name: 'voice-20261117-142301.webm', size: 21000, type: 'audio/webm', sha256: SHA, duration_s: 42, waveform: WAVE };
|
|
25
|
+
ok(VOICE_LABEL === 'sigelo-voice/0' && VOICE_MAX_S === 300, 'the label sigelo-voice/0; at most 300 s');
|
|
26
|
+
ok(JSON.stringify(checkVoice(V)) === JSON.stringify(V), 'a voice message with a waveform: accepted as it is');
|
|
27
|
+
const { waveform: _w, ...noWave } = V;
|
|
28
|
+
ok(checkOf(() => checkVoice(noWave)) === 'accepted' && !('waveform' in checkVoice(noWave)), 'the waveform is optional');
|
|
29
|
+
const bad = [
|
|
30
|
+
[null, 'not an object'], [[], 'an array'], [{ ...V, data: 'AAAA' }, 'audio inline (data)'], [{ ...V, extra: 1 }, 'an extra key'],
|
|
31
|
+
[{ ...V, type: 'audio/mpeg' }, 'type audio/mpeg'], [{ ...V, type: 'audio/webm;codecs=opus' }, 'a type with its codecs'],
|
|
32
|
+
[{ ...V, name: '' }, 'an empty name'], [{ ...V, name: '../x.webm' }, 'a name with a slash'], [{ ...V, name: 'x'.repeat(256) }, 'a name of 256'],
|
|
33
|
+
[{ ...V, size: 0 }, 'size 0'], [{ ...V, size: 16 * 2 ** 20 + 1 }, 'size over 16 MiB'], [{ ...V, size: 1.5 }, 'a float size'],
|
|
34
|
+
[{ ...V, sha256: 'AB'.repeat(32) }, 'sha256 upper case'], [{ ...V, sha256: 'ab' }, 'sha256 short'],
|
|
35
|
+
[{ ...V, duration_s: 0 }, 'duration 0'], [{ ...V, duration_s: 301 }, 'duration 301'], [{ ...V, duration_s: 4.2 }, 'a float duration (no floats)'],
|
|
36
|
+
[{ ...V, waveform: '' }, 'an empty waveform'], [{ ...V, waveform: Buffer.alloc(65).toString('base64') }, 'a waveform of 65 bytes'],
|
|
37
|
+
[{ ...V, waveform: [1, 2] }, 'a waveform as a list'], [{ ...V, waveform: 'a!==' }, 'a waveform not base64'],
|
|
38
|
+
];
|
|
39
|
+
for (const [x, what] of bad) ok(checkOf(() => checkVoice(x)) === 'voice', `checkVoice refuses ${what}: check voice`, checkOf(() => checkVoice(x)));
|
|
40
|
+
ok(checkOf(() => checkVoice({ ...V, waveform: Buffer.alloc(64, 7).toString('base64') })) === 'accepted', 'a waveform of 64 bytes: accepted');
|
|
41
|
+
ok(peaksOf(V).join() === '0,40,255,128' && peaksOf(noWave).length === 0, 'peaksOf: the waveform as numbers, [] without one');
|
|
42
|
+
ok(clock(42) === '0:42' && clock(300) === '5:00' && clock(61) === '1:01', 'clock: m:ss');
|
|
43
|
+
ok(voiceName(new Date(2026, 10, 17, 14, 23, 1), 'audio/webm') === 'voice-20261117-142301.webm' && voiceName(new Date(2026, 0, 2, 3, 4, 5), 'audio/mp4') === 'voice-20260102-030405.m4a'
|
|
44
|
+
&& voiceName(new Date(2026, 0, 2, 3, 4, 5), 'audio/ogg').endsWith('.ogg'), 'voiceName: voice-<date>-<time>.<webm|m4a|ogg>');
|
|
45
|
+
ok(voiceLine(V) === '[voice 0:42 voice-20261117-142301.webm]', 'voiceLine: [voice 0:42 <name>]');
|
|
46
|
+
|
|
47
|
+
// ---- what the CLI and the MCP print
|
|
48
|
+
{
|
|
49
|
+
const batch = { messages: [{ id: 'a', from: 'did:x', label: VOICE_LABEL, content: V }, { id: 'b', label: '', content: 'hi' }, { id: 'c', label: VOICE_LABEL, content: { ...V, duration_s: 0 } },
|
|
50
|
+
{ id: 'd', label: 'sigelo-group/1', content: 'Voice message', voice: V }], events: [{ type: 'paired' }] };
|
|
51
|
+
const r = voiceItems(batch);
|
|
52
|
+
ok(r.messages[0].text === '[voice 0:42 voice-20261117-142301.webm]' && r.messages[0].voice.sha256 === SHA && r.messages[0].content === V, 'voiceItems: a voice message gains text [voice 0:42 name] and its fields (voice); content kept');
|
|
53
|
+
ok(r.messages[1] === batch.messages[1] && r.events === batch.events, 'voiceItems: other messages and the events as they were');
|
|
54
|
+
ok(r.messages[2].voice_error?.includes('duration_s') && r.messages[2].text === undefined, 'voiceItems: one that does not check says why (voice_error), no line');
|
|
55
|
+
const caps = { label: 'sigelo-host-caps/0', content: { v: 'sigelo-host-caps/0', model: { value: 'x' } } };
|
|
56
|
+
const rc = voiceItems({ messages: [caps], events: [] }).messages[0];
|
|
57
|
+
ok(rc.data === 'sigelo-host-caps/0' && /data, not a message/.test(rc.text) && rc.content === caps.content, 'voiceItems: a sigelo-host-caps/0 message is marked data with one line, content kept');
|
|
58
|
+
ok(r.messages[3].text === voiceLine(V) && r.messages[3].voice.duration_s === 42, 'voiceItems: a group msg with a voice gets the line too');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ---- a group's msg
|
|
62
|
+
{
|
|
63
|
+
const D0 = 'did:sigelo:z' + '1'.repeat(44), msg = { v: GROUP_V, typ: 'msg', gid: '0'.repeat(32), mid: '1'.repeat(16), iat: 1_800_000_000, from: D0, text: 'Voice message' };
|
|
64
|
+
ok(checkOf(() => checkBody({ ...msg, voice: V })) === 'accepted', 'a group msg with a voice: accepted');
|
|
65
|
+
ok(checkOf(() => checkBody({ ...msg, voice: { ...V, duration_s: 999 } })) === 'group_message', 'a group msg with a bad voice: group_message');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// ---- the recorder over a fake MediaRecorder
|
|
69
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
70
|
+
const WEBM = Uint8Array.from([0x1a, 0x45, 0xdf, 0xa3, 1, 2, 3, 4, 5, 6]), MP4 = Uint8Array.from([0, 0, 0, 24, 0x66, 0x74, 0x79, 0x70, 0x4d, 0x34, 0x41]);
|
|
71
|
+
function fakeEnv({ supported = ['audio/webm;codecs=opus'], bytes = WEBM, deny = null, audio = true, level = 60 } = {}) {
|
|
72
|
+
const env = { stopped: 0, asked: null, made: null };
|
|
73
|
+
class Rec {
|
|
74
|
+
static isTypeSupported(t) { return supported.includes(t); }
|
|
75
|
+
constructor(stream, o) { this.mimeType = o?.mimeType ?? 'audio/webm'; this.state = 'inactive'; this.opts = o; env.made = this; }
|
|
76
|
+
start(ms) { this.state = 'recording'; this.slice = ms; }
|
|
77
|
+
stop() { this.state = 'inactive'; setTimeout(() => { this.ondataavailable?.({ data: new Blob([bytes.subarray(0, 4)]) }); this.ondataavailable?.({ data: new Blob([bytes.subarray(4)]) }); this.onstop?.(); }, 5); }
|
|
78
|
+
}
|
|
79
|
+
class AC {
|
|
80
|
+
createAnalyser() { return { fftSize: 0, getByteTimeDomainData(b) { b.fill(128); b[3] = 128 + level; } }; }
|
|
81
|
+
createMediaStreamSource() { return { connect() {} }; }
|
|
82
|
+
close() { env.closed = true; }
|
|
83
|
+
}
|
|
84
|
+
Object.assign(env, {
|
|
85
|
+
navigator: { mediaDevices: { getUserMedia: async (c) => { env.asked = c; if (deny) throw Object.assign(new Error(deny), { name: deny }); return { getTracks: () => [{ stop: () => { env.stopped++; } }] }; } } },
|
|
86
|
+
MediaRecorder: Rec, Blob, ...(audio && { AudioContext: AC }),
|
|
87
|
+
});
|
|
88
|
+
return env;
|
|
89
|
+
}
|
|
90
|
+
{
|
|
91
|
+
ok(recorderType(fakeEnv().MediaRecorder) === 'audio/webm;codecs=opus' && recorderType(fakeEnv({ supported: ['audio/mp4', 'audio/ogg;codecs=opus'] }).MediaRecorder) === 'audio/mp4'
|
|
92
|
+
&& recorderType(fakeEnv({ supported: ['audio/ogg;codecs=opus'] }).MediaRecorder) === 'audio/ogg;codecs=opus' && recorderType(fakeEnv({ supported: [] }).MediaRecorder) === null,
|
|
93
|
+
'the format: webm/opus where the recorder has it, else mp4 (AAC), else ogg/opus, else its own');
|
|
94
|
+
ok(canRecord(fakeEnv()) && !canRecord({ navigator: {} }) && !canRecord({}), 'canRecord: getUserMedia and MediaRecorder both');
|
|
95
|
+
ok(sniff(WEBM) === 'audio/webm' && sniff(MP4) === 'audio/mp4' && sniff(Uint8Array.from([0x4f, 0x67, 0x67, 0x53, 0])) === 'audio/ogg' && sniff(Uint8Array.from([1, 2, 3, 4, 5])) === null, 'sniff: webm, mp4, ogg by their first bytes');
|
|
96
|
+
const d = downsample(Array.from({ length: 640 }, (_, i) => (i === 5 ? 250 : i % 10)));
|
|
97
|
+
ok(d.length === 64 && d[0] === 250 && d[1] === 9, 'downsample: 640 levels → 64 peaks, the loudest of each stretch', [...d.slice(0, 3)]);
|
|
98
|
+
ok(downsample([1, 2, 3]).join() === '1,2,3', 'downsample: fewer than 64 kept as they are');
|
|
99
|
+
|
|
100
|
+
let t = 1_000_000;
|
|
101
|
+
const env = fakeEnv(), ticks = [];
|
|
102
|
+
const r = await record({ env, now: () => t, onTick: (x) => ticks.push(x) });
|
|
103
|
+
ok(env.asked?.audio === true && env.made?.opts?.mimeType === 'audio/webm;codecs=opus' && env.made.state === 'recording', 'record: getUserMedia({audio: true}), MediaRecorder with webm/opus, started at once');
|
|
104
|
+
await sleep(450);
|
|
105
|
+
t += 42_400;
|
|
106
|
+
ok(ticks.length >= 2 && ticks.at(-1).level === 120, 'record: ticks with the level while it records', JSON.stringify(ticks.slice(-1)));
|
|
107
|
+
const out = await r.stop();
|
|
108
|
+
ok(out.type === 'audio/webm' && out.bytes.length === WEBM.length && out.duration_s === 42 && /^voice-\d{8}-\d{6}\.webm$/.test(out.name), `stop: the bytes, audio/webm, 42 s, voice-<date>.webm (${out.name})`);
|
|
109
|
+
ok(typeof out.waveform === 'string' && checkOf(() => checkVoice({ name: out.name, size: out.bytes.length, type: out.type, sha256: SHA, duration_s: out.duration_s, waveform: out.waveform })) === 'accepted',
|
|
110
|
+
'stop: a waveform that checks as sigelo-voice/0\'s');
|
|
111
|
+
ok(env.stopped === 1 && env.closed === true, 'stop: the microphone let go (the track stopped, the audio context closed)');
|
|
112
|
+
|
|
113
|
+
// MP4 where the recorder says webm: the bytes decide.
|
|
114
|
+
const e2 = fakeEnv({ supported: ['audio/mp4'], bytes: MP4, audio: false });
|
|
115
|
+
const r2 = await record({ env: e2 });
|
|
116
|
+
const o2 = await r2.stop();
|
|
117
|
+
ok(o2.type === 'audio/mp4' && o2.name.endsWith('.m4a') && o2.duration_s === 1 && o2.waveform === undefined, 'AAC (WebKit): audio/mp4, .m4a; under a second counts 1; no Web Audio: no waveform');
|
|
118
|
+
// The five minutes: it stops by itself.
|
|
119
|
+
let t3 = 0;
|
|
120
|
+
const r3 = await record({ env: fakeEnv(), now: () => t3, max: 300 });
|
|
121
|
+
t3 = 301_000;
|
|
122
|
+
await sleep(450);
|
|
123
|
+
const o3 = await r3.done;
|
|
124
|
+
ok(o3?.duration_s === 300, 'at 5:00 it stops by itself (300 s)', JSON.stringify(o3?.duration_s));
|
|
125
|
+
// Cancel: nothing kept.
|
|
126
|
+
const e4 = fakeEnv(), r4 = await record({ env: e4 });
|
|
127
|
+
r4.cancel();
|
|
128
|
+
ok((await r4.stop()) === null && e4.stopped === 1, 'cancel: nothing kept, the microphone let go');
|
|
129
|
+
ok(await failure(() => record({ env: fakeEnv({ deny: 'NotAllowedError' }) })) === 'mic_permission', 'the microphone refused: mic_permission');
|
|
130
|
+
ok(await failure(() => record({ env: fakeEnv({ deny: 'NotFoundError' }) })) === 'no_mic', 'no microphone: no_mic');
|
|
131
|
+
ok(await failure(() => record({ env: { navigator: {} } })) === 'no_recorder', 'no MediaRecorder: no_recorder');
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// ---- the computer's recordings (the `ui` server's hooks.transfers.rec)
|
|
135
|
+
{
|
|
136
|
+
const dir = mkdtempSync(join(tmpdir(), 'sigelo-voice-')), identity = join(dir, 'me.local.json');
|
|
137
|
+
writeFileSync(identity, '{}');
|
|
138
|
+
const R = voiceFiles(identity), rec = 'cd'.repeat(16);
|
|
139
|
+
await R.write(rec, 0, WEBM.subarray(0, 6));
|
|
140
|
+
await R.write(rec, 6, WEBM.subarray(6));
|
|
141
|
+
const { path } = await R.keep(rec, 'voice-20261117-142301.webm');
|
|
142
|
+
ok(path === join(dir, 'me.local.voice', 'voice-20261117-142301.webm') && Buffer.compare(readFileSync(path), Buffer.from(WEBM)) === 0 && (statSync(path).mode & 0o777) === 0o600,
|
|
143
|
+
'pieces at their offsets, kept whole as <identity>.voice/<name>, 0600', path);
|
|
144
|
+
ok(checkOf(() => sendable(path, { base: join(dir, 'me.local'), files: join(dir, 'me.local.files'), log: join(dir, 'me.local.inbox.log') }, 16 * 2 ** 20)) === 'accepted',
|
|
145
|
+
'the kept recording is sendable (not one of the identity\'s files)');
|
|
146
|
+
await R.write(rec, 0, WEBM);
|
|
147
|
+
const again = await R.keep(rec, 'voice-20261117-142301.webm');
|
|
148
|
+
ok(again.path.endsWith('voice-20261117-142301 (2).webm'), 'the same name again: (2)');
|
|
149
|
+
ok(await failure(() => R.keep('ef'.repeat(16), 'x.webm')) === 'voice' && await failure(() => R.write('nothex', 0, WEBM)) === 'usage', 'keep with no pieces: voice; a rec not 32 hex: usage');
|
|
150
|
+
mkdirSync(join(dir, 'me.local.files', 'bo-1'), { recursive: true });
|
|
151
|
+
const landed = join(dir, 'me.local.files', 'bo-1', 'abcd-voice.webm');
|
|
152
|
+
writeFileSync(landed, WEBM);
|
|
153
|
+
ok(Buffer.compare(Buffer.from(await R.read(landed)), Buffer.from(WEBM)) === 0, 'read: a voice message that landed under the identity\'s files');
|
|
154
|
+
ok(await failure(() => R.read(identity)) === 'voice' && await failure(() => R.read(join(dir, 'me.local.files', '..', 'me.local.json'))) === 'voice', 'read: nothing else (the identity, a path climbing out)');
|
|
155
|
+
rmSync(dir, { recursive: true, force: true });
|
|
156
|
+
ok(!existsSync(dir), 'cleaned');
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
for (const f of fails) console.log('FAIL ' + f);
|
|
160
|
+
if (fails.length) { console.log(`${fails.length} FAILED, ${count - fails.length} passed`); process.exit(1); }
|
|
161
|
+
console.log(`ALL PASS (${count})`);
|
package/test-ws.mjs
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
// the same through a stand-in nginx with TLS, whose relay.json names the WebSocket endpoint. Also:
|
|
8
8
|
// endpointOf and proxyFor (NO_PROXY), SIGELO_RELAY_TRANSPORT, and a message refused because the
|
|
9
9
|
// reader's queue is full, told as the reader's side (quota_storage, side "reader").
|
|
10
|
-
// node contact/test-ws.mjs → ALL PASS (n)
|
|
11
|
-
// The relay is its own AGPL package: SIGELO_RELAY_DIR, else
|
|
10
|
+
// node apps/contact/test-ws.mjs → ALL PASS (n)
|
|
11
|
+
// The relay is its own AGPL package: SIGELO_RELAY_DIR, else ../../relay; without it, SKIP after the
|
|
12
12
|
// part that needs none.
|
|
13
13
|
import { spawn } from 'node:child_process';
|
|
14
14
|
import { createHash, generateKeyPairSync, randomBytes, sign as cryptoSign } from 'node:crypto';
|
|
@@ -97,8 +97,8 @@ const checkOf = (f) => { try { f(); return 'accepted'; } catch (e) { return e.ch
|
|
|
97
97
|
ok(checkOf(() => new Carrier({ identity: () => ({}), store: 'a', state: 'b', transport: 'ws' })).includes('transport'), 'the constructor refuses another transport');
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
const RELAY_DIR = process.env.SIGELO_RELAY_DIR ?? join(HERE, '..', 'relay');
|
|
101
|
-
if (!existsSync(join(RELAY_DIR, 'server.mjs'))) report(': the part without a relay; SKIP the rest, no relay checkout beside contact/ (set SIGELO_RELAY_DIR)');
|
|
100
|
+
const RELAY_DIR = process.env.SIGELO_RELAY_DIR ?? join(HERE, '..', '..', 'relay');
|
|
101
|
+
if (!existsSync(join(RELAY_DIR, 'server.mjs'))) report(': the part without a relay; SKIP the rest, no relay checkout beside apps/contact/ (set SIGELO_RELAY_DIR)');
|
|
102
102
|
const { startRelay } = await import(pathToFileURL(join(RELAY_DIR, 'server.mjs')).href);
|
|
103
103
|
const { relayPolicy, TIERS } = await import(pathToFileURL(join(RELAY_DIR, 'allowance.mjs')).href);
|
|
104
104
|
|
|
@@ -213,7 +213,7 @@ try {
|
|
|
213
213
|
// refusal is y's side (quota_storage, side "reader"), not its relay or its own allowance.
|
|
214
214
|
const tiny = { ...TIERS.free, storage: 200000, maxMessage: 64 * 1024, retentionDays: 7 };
|
|
215
215
|
const q = await startRelay({ host: HOST, db: join(dir, 'quota.db'), httpPort: 0, tcpPort: 0, loginRate: 100000, verifyBudget: 1e9, log: () => {},
|
|
216
|
-
policy: (ctx) => relayPolicy(ctx, { pow: { bits: 4, loadBits: 8, loadPerHour: 1000 }, freeQueue: 64 * 1024 * 1024, tiers: { free: tiny, pro: TIERS.pro } }) });
|
|
216
|
+
policy: (ctx) => relayPolicy(ctx, { pow: { bits: 4, loadBits: 8, loadPerHour: 1000, cost: { m: 8, t: 1, p: 1 } }, freeQueue: 64 * 1024 * 1024, tiers: { free: tiny, pro: TIERS.pro } }) });
|
|
217
217
|
const endpoints = { [HOST]: { mqtt: `mqtt://127.0.0.1:${q.ports.tcp}`, http: `http://127.0.0.1:${q.ports.http}` } };
|
|
218
218
|
const x = make(dir, agent('qx'), { endpoints }), y = make(dir, agent('qy'), { endpoints });
|
|
219
219
|
const r = await pairAndTalk(x, y, 'quota');
|