@minca/core 0.1.10 → 0.1.11
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 +1 -1
- package/dist/identity/abilities.js +1 -1
- package/dist/identity/contact-key.d.ts +15 -15
- package/dist/identity/contact-key.d.ts.map +1 -1
- package/dist/identity/contact-key.js +21 -28
- package/dist/identity/contact-key.js.map +1 -1
- package/dist/inbox/inbox.d.ts +140 -0
- package/dist/inbox/inbox.d.ts.map +1 -0
- package/dist/inbox/inbox.js +212 -0
- package/dist/inbox/inbox.js.map +1 -0
- package/dist/inbox/index.d.ts +9 -0
- package/dist/inbox/index.d.ts.map +1 -0
- package/dist/inbox/index.js +7 -0
- package/dist/inbox/index.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/network/mailbox.d.ts +4 -4
- package/dist/network/mailbox.d.ts.map +1 -1
- package/dist/network/mailbox.js +5 -5
- package/dist/network/mailbox.js.map +1 -1
- package/dist/node/actions.d.ts.map +1 -1
- package/dist/node/actions.js +28 -18
- package/dist/node/actions.js.map +1 -1
- package/dist/node/api.d.ts +11 -10
- package/dist/node/api.d.ts.map +1 -1
- package/dist/node/api.js +11 -10
- package/dist/node/api.js.map +1 -1
- package/dist/node/carrier.d.ts +11 -5
- package/dist/node/carrier.d.ts.map +1 -1
- package/dist/node/carrier.js +42 -1
- package/dist/node/carrier.js.map +1 -1
- package/dist/node/copy.d.ts +1 -1
- package/dist/node/copy.d.ts.map +1 -1
- package/dist/node/copy.js +10 -4
- package/dist/node/copy.js.map +1 -1
- package/dist/node/host.d.ts +2 -0
- package/dist/node/host.d.ts.map +1 -1
- package/dist/node/host.js +2 -0
- package/dist/node/host.js.map +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/node.d.ts.map +1 -1
- package/dist/node/node.js +496 -295
- package/dist/node/node.js.map +1 -1
- package/dist/node/remote.d.ts.map +1 -1
- package/dist/node/remote.js +0 -2
- package/dist/node/remote.js.map +1 -1
- package/dist/node/space-runtime.d.ts +2 -1
- package/dist/node/space-runtime.d.ts.map +1 -1
- package/dist/node/space-runtime.js +2 -2
- package/dist/node/space-runtime.js.map +1 -1
- package/dist/node/types.d.ts +72 -43
- package/dist/node/types.d.ts.map +1 -1
- package/dist/react/use-invite-link.d.ts +1 -1
- package/dist/react/use-invite-link.d.ts.map +1 -1
- package/dist/react/use-invite-link.js +18 -11
- package/dist/react/use-invite-link.js.map +1 -1
- package/dist/records/loose.d.ts +52 -0
- package/dist/records/loose.d.ts.map +1 -0
- package/dist/records/loose.js +86 -0
- package/dist/records/loose.js.map +1 -0
- package/dist/schema/version.d.ts +2 -0
- package/dist/schema/version.d.ts.map +1 -1
- package/dist/schema/version.js +2 -1
- package/dist/schema/version.js.map +1 -1
- package/dist/schemas/choosing.d.ts +19 -0
- package/dist/schemas/choosing.d.ts.map +1 -0
- package/dist/schemas/choosing.js +69 -0
- package/dist/schemas/choosing.js.map +1 -0
- package/dist/schemas/contacts.d.ts +34 -87
- package/dist/schemas/contacts.d.ts.map +1 -1
- package/dist/schemas/contacts.js +32 -76
- package/dist/schemas/contacts.js.map +1 -1
- package/dist/schemas/index.d.ts +2 -2
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +1 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/library/annotations.d.ts +17 -285
- package/dist/schemas/library/annotations.d.ts.map +1 -1
- package/dist/schemas/library/annotations.js +9 -65
- package/dist/schemas/library/annotations.js.map +1 -1
- package/dist/schemas/library/community.d.ts +9 -17
- package/dist/schemas/library/community.d.ts.map +1 -1
- package/dist/schemas/library/community.js +5 -5
- package/dist/schemas/library/community.js.map +1 -1
- package/dist/schemas/library/life.d.ts +3 -3
- package/dist/schemas/library/life.d.ts.map +1 -1
- package/dist/schemas/library/life.js +2 -2
- package/dist/schemas/library/life.js.map +1 -1
- package/dist/schemas/library/media.d.ts +148 -541
- package/dist/schemas/library/media.d.ts.map +1 -1
- package/dist/schemas/library/media.js +28 -64
- package/dist/schemas/library/media.js.map +1 -1
- package/dist/schemas/library/money.d.ts +8 -8
- package/dist/schemas/library/money.d.ts.map +1 -1
- package/dist/schemas/library/money.js +4 -4
- package/dist/schemas/library/money.js.map +1 -1
- package/dist/schemas/library/planning.d.ts +23 -87
- package/dist/schemas/library/planning.d.ts.map +1 -1
- package/dist/schemas/library/planning.js +10 -26
- package/dist/schemas/library/planning.js.map +1 -1
- package/dist/schemas/library/publishing.d.ts +14 -14
- package/dist/schemas/library/publishing.d.ts.map +1 -1
- package/dist/schemas/library/publishing.js +7 -7
- package/dist/schemas/library/publishing.js.map +1 -1
- package/dist/schemas/library/social.d.ts +2 -2
- package/dist/schemas/library/social.d.ts.map +1 -1
- package/dist/schemas/library/social.js +1 -1
- package/dist/schemas/library/social.js.map +1 -1
- package/dist/schemas/standard.d.ts +1 -1
- package/dist/schemas/standard.d.ts.map +1 -1
- package/dist/schemas/standard.js +3 -3
- package/dist/schemas/standard.js.map +1 -1
- package/dist/session/auth.js +1 -1
- package/dist/session/auth.js.map +1 -1
- package/dist/space/account-registry.d.ts +22 -0
- package/dist/space/account-registry.d.ts.map +1 -1
- package/dist/space/account-registry.js +18 -0
- package/dist/space/account-registry.js.map +1 -1
- package/dist/space/invitation.d.ts +61 -0
- package/dist/space/invitation.d.ts.map +1 -0
- package/dist/space/invitation.js +84 -0
- package/dist/space/invitation.js.map +1 -0
- package/dist/space/invite-link.d.ts +64 -0
- package/dist/space/invite-link.d.ts.map +1 -0
- package/dist/space/invite-link.js +212 -0
- package/dist/space/invite-link.js.map +1 -0
- package/dist/space/space-manager.d.ts +21 -6
- package/dist/space/space-manager.d.ts.map +1 -1
- package/dist/space/space-manager.js +40 -23
- package/dist/space/space-manager.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/docs/README.md +2 -2
- package/docs/actions.md +37 -37
- package/docs/automations.md +2 -2
- package/docs/blueprints-and-guides.md +44 -3
- package/docs/building-an-app.md +2 -2
- package/docs/contacts.md +48 -69
- package/docs/inbox.md +145 -0
- package/docs/node.md +36 -23
- package/docs/query-format.md +1 -1
- package/docs/spaces.md +33 -5
- package/docs/standard-library.md +111 -86
- package/package.json +5 -5
- package/dist/doors/doors.d.ts +0 -140
- package/dist/doors/doors.d.ts.map +0 -1
- package/dist/doors/doors.js +0 -226
- package/dist/doors/doors.js.map +0 -1
- package/dist/doors/index.d.ts +0 -9
- package/dist/doors/index.d.ts.map +0 -1
- package/dist/doors/index.js +0 -7
- package/dist/doors/index.js.map +0 -1
- package/docs/doors.md +0 -151
package/dist/doors/doors.js
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import { contactKeyPair, contactPublicKey, isContactPublicKey, signWithScalar, verifyWithPoint, } from '../identity/contact-key.js';
|
|
2
|
-
import { openValueFrom, sealValueTo } from '../identity/hpke.js';
|
|
3
|
-
import { didToPublicKey } from '../identity/did.js';
|
|
4
|
-
import { noteCovers, verifyNote, UCAN_CLOCK_SKEW_SECONDS } from '../identity/ucan.js';
|
|
5
|
-
import { ACCOUNT_REQUIREMENT } from '../identity/abilities.js';
|
|
6
|
-
import { canonicalize } from '../schema/version.js';
|
|
7
|
-
import { parseSpaceInvite } from '../space/space-manager.js';
|
|
8
|
-
import { checkSpace, soleFounder } from '../space/constitution.js';
|
|
9
|
-
import { checkRelays } from '../space/roles.js';
|
|
10
|
-
import { sha256 } from '../utils/hash.js';
|
|
11
|
-
import { isObject } from '../utils/guards.js';
|
|
12
|
-
import { base64UrlDecode, base64UrlEncode, utf8Decode, utf8Encode } from '../utils/encoding.js';
|
|
13
|
-
/** A door names at most this many relays: enough that one going away doesn't matter */
|
|
14
|
-
export const MAX_DOOR_RELAYS = 3;
|
|
15
|
-
/** How long a knock waits in a mailbox, and so how old one may be when opened */
|
|
16
|
-
export const KNOCK_TTL_SECONDS = 14 * 24 * 3600;
|
|
17
|
-
/**
|
|
18
|
-
* How far a knock's own time may be from when the relay took it. A knock is
|
|
19
|
-
* dropped as soon as it is signed, so its time is checked against the relay's
|
|
20
|
-
* — which the knocker can't choose — and a note that ran out can't be used by
|
|
21
|
-
* dating a knock back to when it was good.
|
|
22
|
-
*/
|
|
23
|
-
export const KNOCK_DROP_WINDOW_SECONDS = 600;
|
|
24
|
-
const MAX_NAME = 64;
|
|
25
|
-
const MAX_NOTE = 2000;
|
|
26
|
-
const MAX_INVITE = 6000;
|
|
27
|
-
const MAX_PROOF = 4096;
|
|
28
|
-
/** Cuts text to at most `max` characters without splitting one (a surrogate pair stays whole) */
|
|
29
|
-
export function clip(text, max) {
|
|
30
|
-
const chars = Array.from(text);
|
|
31
|
-
return chars.length <= max ? text : chars.slice(0, max).join('');
|
|
32
|
-
}
|
|
33
|
-
/** Encodes a door code: what goes in a link or a QR code */
|
|
34
|
-
export function encodeDoorCode(code) {
|
|
35
|
-
const problem = checkDoorCode({ v: 1, ...code });
|
|
36
|
-
if (problem)
|
|
37
|
-
throw new Error(problem);
|
|
38
|
-
return base64UrlEncode(utf8Encode(canonicalize({
|
|
39
|
-
v: 1,
|
|
40
|
-
key: code.key,
|
|
41
|
-
sign: code.sign,
|
|
42
|
-
relays: [...code.relays],
|
|
43
|
-
...(code.name ? { name: code.name } : {}),
|
|
44
|
-
})));
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Reads a door code, or a link carrying one after `#door=` or `door=`.
|
|
48
|
-
* @throws When it isn't one, saying why
|
|
49
|
-
*/
|
|
50
|
-
export function parseDoorCode(text) {
|
|
51
|
-
const trimmed = text.trim();
|
|
52
|
-
const found = /(?:^|[#?&])door=([A-Za-z0-9_-]+)/.exec(trimmed);
|
|
53
|
-
const raw = found ? found[1] : trimmed;
|
|
54
|
-
let parsed;
|
|
55
|
-
try {
|
|
56
|
-
parsed = JSON.parse(utf8Decode(base64UrlDecode(raw)));
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
throw new Error('That is not a door code — it may be cut short.');
|
|
60
|
-
}
|
|
61
|
-
if (!isDoorCode(parsed))
|
|
62
|
-
throw new Error(`That door code doesn't work: ${checkDoorCode(parsed)}`);
|
|
63
|
-
const code = parsed;
|
|
64
|
-
return Object.freeze({
|
|
65
|
-
v: 1,
|
|
66
|
-
key: code.key,
|
|
67
|
-
sign: code.sign,
|
|
68
|
-
relays: Object.freeze([...code.relays]),
|
|
69
|
-
...(code.name ? { name: code.name } : {}),
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
const isDoorCode = (value) => checkDoorCode(value) === null;
|
|
73
|
-
/** Why a value is not a door code, or null */
|
|
74
|
-
export function checkDoorCode(value) {
|
|
75
|
-
const code = value;
|
|
76
|
-
if (!isObject(code) || code.v !== 1)
|
|
77
|
-
return 'it is not a version 1 door';
|
|
78
|
-
if (!isContactPublicKey(code.key))
|
|
79
|
-
return 'its key is not a P-256 public key';
|
|
80
|
-
if (!isContactPublicKey(code.sign) || code.sign === code.key)
|
|
81
|
-
return 'its signing key is not a P-256 public key of its own';
|
|
82
|
-
if (!Array.isArray(code.relays) || code.relays.length === 0 || code.relays.length > MAX_DOOR_RELAYS) {
|
|
83
|
-
return `it names 1–${MAX_DOOR_RELAYS} relays`;
|
|
84
|
-
}
|
|
85
|
-
const relays = checkRelays(code.relays);
|
|
86
|
-
if (relays)
|
|
87
|
-
return relays;
|
|
88
|
-
if (code.name !== undefined && (typeof code.name !== 'string' || Array.from(code.name).length > MAX_NAME))
|
|
89
|
-
return `its name is text of at most ${MAX_NAME} characters`;
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* The mailbox topic of a door: a hash of its signing key. The relay can't tell
|
|
94
|
-
* whose door it is, and can check that whoever clears it holds that key.
|
|
95
|
-
*/
|
|
96
|
-
export async function doorTopic(sign) {
|
|
97
|
-
return base64UrlEncode(await sha256(utf8Encode(`minca/door-topic/v1|${sign}`)));
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* What a door's owner signs to clear knocks from a relay's mailbox: the topic,
|
|
101
|
-
* the relay's one-time challenge, and which knocks (`*` for all of them).
|
|
102
|
-
*/
|
|
103
|
-
export const purgeMessage = (topic, nonce, ids) => utf8Encode(`minca/door-purge/v1|${topic}|${nonce}|${ids ? [...ids].sort().join(',') : '*'}`);
|
|
104
|
-
/** Signs a relay's purge challenge with the door's signing key */
|
|
105
|
-
export function signPurge(signKey, topic, nonce, ids) {
|
|
106
|
-
return signWithScalar(signKey, purgeMessage(topic, nonce, ids));
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* The answer to a knock: the door's owner, signing with the door's signing key
|
|
110
|
-
* that the account which joined the space for two is theirs. Without it,
|
|
111
|
-
* whoever joined first — someone the invite was passed on to — would be taken
|
|
112
|
-
* for the person behind the door.
|
|
113
|
-
*/
|
|
114
|
-
const answerMessage = (pairSpace, did) => utf8Encode(`minca/knock-answer/v1|${pairSpace}|${did}`);
|
|
115
|
-
export function signAnswer(signKey, pairSpace, did) {
|
|
116
|
-
return signWithScalar(signKey, answerMessage(pairSpace, did));
|
|
117
|
-
}
|
|
118
|
-
export function checkAnswer(sign, pairSpace, did, signature) {
|
|
119
|
-
return verifyWithPoint(sign, answerMessage(pairSpace, did), signature);
|
|
120
|
-
}
|
|
121
|
-
/** A knock's id: the hash of its sealed blob, as relays file it */
|
|
122
|
-
export async function knockId(blob) {
|
|
123
|
-
return base64UrlEncode(await sha256(utf8Encode(blob)));
|
|
124
|
-
}
|
|
125
|
-
/** The HPKE label a knock is sealed under; bound to `{ door }`, the door key */
|
|
126
|
-
const KNOCK_LABEL = 'minca/knock/v1';
|
|
127
|
-
/**
|
|
128
|
-
* Makes a knock: the body, signed by the session key, sealed to the door key.
|
|
129
|
-
* @returns The sealed blob, for relays' mailboxes
|
|
130
|
-
*/
|
|
131
|
-
export async function sealKnock(door, knock, session, provider) {
|
|
132
|
-
const note = knock.note ? clip(knock.note.trim(), MAX_NOTE) : undefined;
|
|
133
|
-
const body = {
|
|
134
|
-
v: 2,
|
|
135
|
-
door,
|
|
136
|
-
from: knock.from,
|
|
137
|
-
name: clip(knock.name.trim(), MAX_NAME) || 'Someone',
|
|
138
|
-
invite: knock.invite,
|
|
139
|
-
...(note ? { note } : {}),
|
|
140
|
-
at: Math.floor(Date.now() / 1000),
|
|
141
|
-
session: session.did,
|
|
142
|
-
proof: session.proof,
|
|
143
|
-
};
|
|
144
|
-
const sig = base64UrlEncode(await provider.sign(session.key, utf8Encode(canonicalize(body))));
|
|
145
|
-
return sealValueTo(door, KNOCK_LABEL, { door }, { body, sig });
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Opens a knock left on a door, and checks it through: sealed to this door;
|
|
149
|
-
* signed by a session key that its account's note vouches for, for the whole
|
|
150
|
-
* account and not by an agent; signed when the relay took it; recent; and
|
|
151
|
-
* carrying an invite to a private space that account made.
|
|
152
|
-
* @param doorKey The door key's private scalar (`deriveDoorKeyBytes`)
|
|
153
|
-
* @param receivedAt When the relay took it, ms, as `fetch` says
|
|
154
|
-
* @returns The knock, or null when it is anything less
|
|
155
|
-
*/
|
|
156
|
-
export async function openKnock(doorKey, blob, receivedAt, provider) {
|
|
157
|
-
const door = contactPublicKey(doorKey);
|
|
158
|
-
const opened = await openValueFrom(await contactKeyPair(doorKey), KNOCK_LABEL, { door }, blob);
|
|
159
|
-
if (!isObject(opened))
|
|
160
|
-
return null;
|
|
161
|
-
const { body, sig } = opened;
|
|
162
|
-
if (!isObject(body) || typeof sig !== 'string')
|
|
163
|
-
return null;
|
|
164
|
-
if (body.v !== 2 || body.door !== door)
|
|
165
|
-
return null;
|
|
166
|
-
if (typeof body.from !== 'string' || typeof body.session !== 'string' || typeof body.name !== 'string')
|
|
167
|
-
return null;
|
|
168
|
-
if (Array.from(body.name).length > MAX_NAME)
|
|
169
|
-
return null;
|
|
170
|
-
if (typeof body.invite !== 'string' || body.invite.length > MAX_INVITE)
|
|
171
|
-
return null;
|
|
172
|
-
if (!isObject(body.proof) || canonicalize(body.proof).length > MAX_PROOF)
|
|
173
|
-
return null;
|
|
174
|
-
if (body.note !== undefined && (typeof body.note !== 'string' || Array.from(body.note).length > MAX_NOTE))
|
|
175
|
-
return null;
|
|
176
|
-
if (typeof body.at !== 'number' || !Number.isSafeInteger(body.at) || !Number.isFinite(receivedAt))
|
|
177
|
-
return null;
|
|
178
|
-
const now = Math.floor(Date.now() / 1000);
|
|
179
|
-
if (body.at > now + UCAN_CLOCK_SKEW_SECONDS || body.at < now - KNOCK_TTL_SECONDS)
|
|
180
|
-
return null;
|
|
181
|
-
// Signed when it was dropped, not dated back to when a note was still good.
|
|
182
|
-
const dropped = Math.floor(receivedAt / 1000);
|
|
183
|
-
if (body.at > dropped + UCAN_CLOCK_SKEW_SECONDS || body.at < dropped - KNOCK_DROP_WINDOW_SECONDS)
|
|
184
|
-
return null;
|
|
185
|
-
// Signed by the session key it names…
|
|
186
|
-
let signed = false;
|
|
187
|
-
try {
|
|
188
|
-
const key = await provider.importPublicKey(didToPublicKey(body.session).publicKeyBytes);
|
|
189
|
-
signed = await provider.verify(key, base64UrlDecode(sig), utf8Encode(canonicalize(body)));
|
|
190
|
-
}
|
|
191
|
-
catch {
|
|
192
|
-
return null;
|
|
193
|
-
}
|
|
194
|
-
if (!signed)
|
|
195
|
-
return null;
|
|
196
|
-
// …which the account it claims had delegated to when it signed.
|
|
197
|
-
const checked = await verifyNote(body.proof, provider, { at: body.at }).catch(() => null);
|
|
198
|
-
if (!checked?.valid || checked.audience !== body.session || checked.root !== body.from)
|
|
199
|
-
return null;
|
|
200
|
-
// Knocking makes a space and hands out its invite: only a note that may write
|
|
201
|
-
// for the whole account may. An app given one space, or a key the account
|
|
202
|
-
// trusts less, may not.
|
|
203
|
-
if (!noteCovers(checked.note, ACCOUNT_REQUIREMENT))
|
|
204
|
-
return null;
|
|
205
|
-
// A private space the knocker made, with its key: anything else isn't a space for two from them.
|
|
206
|
-
let invited;
|
|
207
|
-
try {
|
|
208
|
-
invited = parseSpaceInvite(body.invite);
|
|
209
|
-
}
|
|
210
|
-
catch {
|
|
211
|
-
return null;
|
|
212
|
-
}
|
|
213
|
-
if (soleFounder(invited.space) !== body.from || invited.space.visibility !== 'private' || !invited.key)
|
|
214
|
-
return null;
|
|
215
|
-
if ((await checkSpace(invited.space)) !== null)
|
|
216
|
-
return null;
|
|
217
|
-
return Object.freeze({
|
|
218
|
-
from: body.from,
|
|
219
|
-
name: clip(body.name, MAX_NAME) || 'Someone',
|
|
220
|
-
...(typeof body.note === 'string' && body.note ? { note: body.note } : {}),
|
|
221
|
-
invite: body.invite,
|
|
222
|
-
pairSpace: invited.space.id,
|
|
223
|
-
at: body.at * 1000,
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
//# sourceMappingURL=doors.js.map
|
package/dist/doors/doors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"doors.js","sourceRoot":"","sources":["../../src/doors/doors.ts"],"names":[],"mappings":"AAkCA,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,eAAe,GAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,uBAAuB,EAAmB,MAAM,qBAAqB,CAAC;AACvG,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,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C"}
|
package/dist/doors/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module doors
|
|
3
|
-
* Doors and knocks — see `doors.ts`, and `node.doors` for the API an app uses.
|
|
4
|
-
*/
|
|
5
|
-
export { encodeDoorCode, parseDoorCode, checkDoorCode, doorTopic, knockId, sealKnock, openKnock, signPurge, purgeMessage, signAnswer, checkAnswer, clip, KNOCK_DROP_WINDOW_SECONDS, MAX_DOOR_RELAYS, KNOCK_TTL_SECONDS, } from './doors.js';
|
|
6
|
-
export type { DoorCode, KnockBody, OpenedKnock } from './doors.js';
|
|
7
|
-
export { createMailboxClient } from '../network/mailbox.js';
|
|
8
|
-
export type { MailboxClient, MailboxOptions, MailItem } from '../network/mailbox.js';
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/doors/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,cAAc,EACd,aAAa,EACb,aAAa,EACb,SAAS,EACT,OAAO,EACP,SAAS,EACT,SAAS,EACT,SAAS,EACT,YAAY,EACZ,UAAU,EACV,WAAW,EACX,IAAI,EACJ,yBAAyB,EACzB,eAAe,EACf,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/doors/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module doors
|
|
3
|
-
* Doors and knocks — see `doors.ts`, and `node.doors` for the API an app uses.
|
|
4
|
-
*/
|
|
5
|
-
export { encodeDoorCode, parseDoorCode, checkDoorCode, doorTopic, knockId, sealKnock, openKnock, signPurge, purgeMessage, signAnswer, checkAnswer, clip, KNOCK_DROP_WINDOW_SECONDS, MAX_DOOR_RELAYS, KNOCK_TTL_SECONDS, } from './doors.js';
|
|
6
|
-
export { createMailboxClient } from '../network/mailbox.js';
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
package/dist/doors/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/doors/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,cAAc,EACd,aAAa,EACb,aAAa,EACb,SAAS,EACT,OAAO,EACP,SAAS,EACT,SAAS,EACT,SAAS,EACT,YAAY,EACZ,UAAU,EACV,WAAW,EACX,IAAI,EACJ,yBAAyB,EACzB,eAAe,EACf,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
|
package/docs/doors.md
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
# Doors
|
|
2
|
-
|
|
3
|
-
A door is an address an account hands out on purpose, so that someone it
|
|
4
|
-
shares no space with can ask to become a contact. The keys, the door code, the
|
|
5
|
-
topic, the relay mailbox and the sealed knock are protocol
|
|
6
|
-
([spec 07](https://github.com/leifriksheim/minca/blob/main/spec/07-doors.md)):
|
|
7
|
-
a relay and a door's owner check them.
|
|
8
|
-
|
|
9
|
-
What this page covers is a convention built on them, not part of the protocol:
|
|
10
|
-
where an account keeps its doors, how a knock becomes a space for two, and the
|
|
11
|
-
answer that tells the knocker who was behind the door. Peers that have never
|
|
12
|
-
heard of `std.door`, `std.knock` or `std.knock-answer` sync, store and judge
|
|
13
|
-
them like any other record. Only the devices of one account, and the two
|
|
14
|
-
people at either side of a door, have to agree on what follows.
|
|
15
|
-
|
|
16
|
-
## `std.door`
|
|
17
|
-
|
|
18
|
-
An account's doors are `std.door` records in its **contacts space**
|
|
19
|
-
([spec 03](https://github.com/leifriksheim/minca/blob/main/spec/03-spaces.md)),
|
|
20
|
-
which only the account can find and every one of its devices holds.
|
|
21
|
-
|
|
22
|
-
| Field | Type | |
|
|
23
|
-
| -------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
|
24
|
-
| `id` | string, 16–64 chars | The door id both keys are derived from ([spec 07 §1](https://github.com/leifriksheim/minca/blob/main/spec/07-doors.md)) |
|
|
25
|
-
| `relays` | string[], 1–3 | Relay URLs, each passing the door code's relay check ([spec 07 §3](https://github.com/leifriksheim/minca/blob/main/spec/07-doors.md)) |
|
|
26
|
-
| `name` | string ≤64, optional | The name the code gives whoever knocks |
|
|
27
|
-
| `label` | string ≤64, optional | What the owner calls the door; never leaves the contacts space |
|
|
28
|
-
|
|
29
|
-
Rules: `onePer: ['id']`. A device treats as a door only a verified `std.door`
|
|
30
|
-
whose root is the account itself. **Closing** a door is deleting its record:
|
|
31
|
-
its knocks are no longer fetched, and knocks already opened stop being
|
|
32
|
-
offered.
|
|
33
|
-
|
|
34
|
-
_Source: `packages/core/src/schemas/contacts.ts` (`door`), `packages/core/src/node/node.ts` (Doors). Tests: `packages/core/tests/doors.test.ts` ("node.doors")._
|
|
35
|
-
|
|
36
|
-
## The exchange
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
Anna relay(s) Leif
|
|
40
|
-
│ doors.open() → std.door, code │
|
|
41
|
-
│ ── code, out of band (a link, a QR code, a bio) ─────────────────────────────▶ │
|
|
42
|
-
│ spaces.create(private), define answers│
|
|
43
|
-
│ invite(role: editor) │
|
|
44
|
-
│ ◀── drop(topic, sealed knock) ── to each │
|
|
45
|
-
│ std.knock { space, … } │
|
|
46
|
-
│ fetch(topic) ──▶ ◀── mail [knock] │
|
|
47
|
-
│ open + check (spec 07 §6) │
|
|
48
|
-
│ accept: spaces.join(invite); std.contact { did: Leif, space, door } │
|
|
49
|
-
│ purge(knock) ──▶ │
|
|
50
|
-
│ once a member there: std.knock-answer { sig } │
|
|
51
|
-
│ ═════════════════ the space for two syncs ═══════════════════════════════════▶ │
|
|
52
|
-
│ answer checks out: std.contact { did: Anna }, invite │
|
|
53
|
-
│ closed, std.knock deleted │
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
**Knocking.** The knocker:
|
|
57
|
-
|
|
58
|
-
1. parses the code, and refuses one of its own doors;
|
|
59
|
-
2. creates a private space named `"<own name> & <code name>"` with the `team`
|
|
60
|
-
role preset, defines `std.knock-answer` in it, and makes an editor invite;
|
|
61
|
-
3. seals the knock ([spec 07 §6](https://github.com/leifriksheim/minca/blob/main/spec/07-doors.md))
|
|
62
|
-
and drops it at **every** relay the code names, since any one of them may
|
|
63
|
-
lose it (the reference relay keeps its mailbox in memory, so a restart
|
|
64
|
-
loses what it held);
|
|
65
|
-
4. if no relay answers `dropped`, leaves the space and fails;
|
|
66
|
-
5. otherwise writes `std.knock { space, name, door, sign, invite }` in its
|
|
67
|
-
contacts space.
|
|
68
|
-
|
|
69
|
-
**Opening.** Besides the checks the protocol requires, the owner's devices
|
|
70
|
-
skip knocks from the account itself, from accounts its contact list marks
|
|
71
|
-
blocked, and whose space for two it already holds (accepted here or on
|
|
72
|
-
another device).
|
|
73
|
-
|
|
74
|
-
**Accepting.** The owner joins the invite and writes
|
|
75
|
-
`std.contact { did: from, name, space, door: <door id> }`, keeping a name it
|
|
76
|
-
already had for that account. It purges the knock from the door's relays.
|
|
77
|
-
Once its membership in the space for two has landed, it writes the
|
|
78
|
-
**answer**:
|
|
79
|
-
|
|
80
|
-
```
|
|
81
|
-
std.knock-answer { sig } sig = door signing key over UTF-8("minca/knock-answer/v1|" + space + "|" + own account DID)
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
`sig` is ECDSA P-256 / SHA-256, P1363 (64 bytes), base64url, like every
|
|
85
|
-
signature of a door signing key. The owner then rewrites the contact without
|
|
86
|
-
`door`. Until then the contact carries the door id, so any device of the
|
|
87
|
-
account can write the answer.
|
|
88
|
-
|
|
89
|
-
**Settling.** For each `std.knock`, the knocker's devices look in its space for
|
|
90
|
-
a verified `std.knock-answer` whose author is a member other than themselves
|
|
91
|
-
and whose `sig` checks out against the `std.knock`'s `sign`. When one does, they
|
|
92
|
-
write `std.contact { did: <that author>, name: <their profile name, else the code's>, space }`,
|
|
93
|
-
close the invite, and delete the `std.knock`. Anyone else who joined with the
|
|
94
|
-
invite (it may have been passed on) is never taken for the person behind the
|
|
95
|
-
door, and nobody joins after. Such a person shows up in `contacts.others` for
|
|
96
|
-
the knocker to see.
|
|
97
|
-
|
|
98
|
-
A `std.knock` nobody answered within the knock TTL (14 days) plus a day is let
|
|
99
|
-
go: the knocker leaves the space and deletes the record. One whose space is no
|
|
100
|
-
longer held is deleted.
|
|
101
|
-
|
|
102
|
-
**Dismissing** a knock purges it from the door's relays; nothing else is
|
|
103
|
-
written, and the knocker is not blocked. **Clearing** a door purges all of its
|
|
104
|
-
knocks and keeps the door open.
|
|
105
|
-
|
|
106
|
-
| Collection | Fields | Rules | Where |
|
|
107
|
-
| ------------------ | ------------------------------------------------------------------------------- | ------------------- | ------------------------ |
|
|
108
|
-
| `std.knock` | `space` ≤256, `name` ≤64, `door` ≤64, `sign` ≤64, `invite` ≤8000 (all required) | `onePer: ['space']` | Knocker's contacts space |
|
|
109
|
-
| `std.knock-answer` | `sig` ≤200 (required) | — | The space for two |
|
|
110
|
-
| `std.contact` | adds `door` ≤64, optional | as before | Owner's contacts space |
|
|
111
|
-
|
|
112
|
-
**Who may.** Knocking and accepting create or join a space, so they need a note
|
|
113
|
-
that grants `/account/write` for the whole account, as `contacts.ask`
|
|
114
|
-
does, and the contact key. Doors are the person's: a node whose note lacks
|
|
115
|
-
`/account/write`, such as an agent's, refuses to open, close, clear, read,
|
|
116
|
-
knock, accept or dismiss. A home never gives an agent the
|
|
117
|
-
contact key in the first place ([spec 06 §2.8](https://github.com/leifriksheim/minca/blob/main/spec/06-nodes-and-sessions.md)).
|
|
118
|
-
|
|
119
|
-
_Source: `packages/core/src/node/node.ts` (Doors), `packages/core/src/node/types.ts` (`NodeDoors`), `packages/core/src/schemas/contacts.ts` (`knock`, `knockAnswer`, `contact`), `packages/core/src/doors/doors.ts` (`signAnswer`, `checkAnswer`), `packages/core/src/session/auth.ts` (`grant`). Tests: `packages/core/tests/doors.test.ts` ("node.doors"), `packages/core/tests/records-only.test.ts`._
|
|
120
|
-
|
|
121
|
-
## `node.doors`
|
|
122
|
-
|
|
123
|
-
The calls are listed with the rest of the node, in [node.md](node.md#doors).
|
|
124
|
-
`node.doors.knocks()` fetches; it doesn't watch, though the mailbox supports
|
|
125
|
-
`watch`. The default mailbox client opens a fresh WebSocket to a relay for
|
|
126
|
-
each call.
|
|
127
|
-
|
|
128
|
-
_Source: `packages/core/src/network/mailbox.ts` (`createMailboxClient`)._
|
|
129
|
-
|
|
130
|
-
## Not yet built
|
|
131
|
-
|
|
132
|
-
- **Live knocks.** Watching a door's topic, so a knock shows as it arrives.
|
|
133
|
-
- **Retrying a knock** that reached no relay, or whose relays lost it
|
|
134
|
-
(restart), until it is answered or expires. A retry is a fresh knock, signed
|
|
135
|
-
and dropped at once.
|
|
136
|
-
|
|
137
|
-
## Planned: names
|
|
138
|
-
|
|
139
|
-
The protocol side of names (a handle resolving to a door code, and a checked
|
|
140
|
-
handle on a knock) is planned in
|
|
141
|
-
[spec 07 §9](https://github.com/leifriksheim/minca/blob/main/spec/07-doors.md).
|
|
142
|
-
On this side:
|
|
143
|
-
|
|
144
|
-
- `node.doors.knock` accepts a handle wherever it takes a code.
|
|
145
|
-
- A knock whose handle checks out shows as "@leif.bsky.social ✓", and as the
|
|
146
|
-
plain name otherwise.
|
|
147
|
-
- **Who may knock.** A door gains a policy in its `std.door` record (never
|
|
148
|
-
published): `anyone` (default), `follows` or `mutuals` on the handle's
|
|
149
|
-
network. Follows are `app.bsky.graph.follow` records in the owner's own
|
|
150
|
-
repository, read from their PDS, with no AppView. Knocks that don't match
|
|
151
|
-
are kept but shown apart.
|