@joe-broadhead/messaging 0.0.0-stage → 0.7.0
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/CHANGELOG.md +175 -0
- package/LICENSE +21 -0
- package/NOTICE +12 -0
- package/README.md +36 -2
- package/dist/bin/messaging-mcp.js +25887 -0
- package/dist/bin/messaging-relay.js +19014 -0
- package/dist/bin/messaging.js +14732 -0
- package/dist/bin/messagingd.js +28682 -0
- package/dist/lib/core-testing.js +1 -0
- package/dist/lib/core.js +1 -0
- package/dist/lib/ipc-testing.js +1 -0
- package/dist/lib/ipc.js +1 -0
- package/dist/lib/modules/core/address.js +42 -0
- package/dist/lib/modules/core/agent/operations.js +595 -0
- package/dist/lib/modules/core/agent/present.js +244 -0
- package/dist/lib/modules/core/agent/text.js +79 -0
- package/dist/lib/modules/core/agent-tools.js +458 -0
- package/dist/lib/modules/core/b64u.js +20 -0
- package/dist/lib/modules/core/cards.js +55 -0
- package/dist/lib/modules/core/check.js +20 -0
- package/dist/lib/modules/core/consent.js +199 -0
- package/dist/lib/modules/core/contact-card.js +74 -0
- package/dist/lib/modules/core/delegation.js +174 -0
- package/dist/lib/modules/core/directory/device-log.js +258 -0
- package/dist/lib/modules/core/directory/epoch.js +103 -0
- package/dist/lib/modules/core/directory/handle.js +29 -0
- package/dist/lib/modules/core/directory/jelly-device.js +204 -0
- package/dist/lib/modules/core/directory/jelly-issuer.js +12 -0
- package/dist/lib/modules/core/directory/jelly-token.js +305 -0
- package/dist/lib/modules/core/directory/keys-statement.js +43 -0
- package/dist/lib/modules/core/directory/link.js +81 -0
- package/dist/lib/modules/core/directory/merkle-log.js +250 -0
- package/dist/lib/modules/core/directory/person-view.js +197 -0
- package/dist/lib/modules/core/directory/person.js +40 -0
- package/dist/lib/modules/core/directory/realm.js +59 -0
- package/dist/lib/modules/core/directory/smt.js +266 -0
- package/dist/lib/modules/core/envelope.js +320 -0
- package/dist/lib/modules/core/hash.js +5 -0
- package/dist/lib/modules/core/head.js +27 -0
- package/dist/lib/modules/core/identity.js +71 -0
- package/dist/lib/modules/core/index.js +44 -0
- package/dist/lib/modules/core/jcs.js +96 -0
- package/dist/lib/modules/core/jelly-host-double.js +35 -0
- package/dist/lib/modules/core/jelly-host.js +211 -0
- package/dist/lib/modules/core/keys.js +79 -0
- package/dist/lib/modules/core/peer-text.js +563 -0
- package/dist/lib/modules/core/realm.js +1 -0
- package/dist/lib/modules/core/roster.js +454 -0
- package/dist/lib/modules/core/schema/a2a.js +85 -0
- package/dist/lib/modules/core/schema/common.js +254 -0
- package/dist/lib/modules/core/schema/consent.js +120 -0
- package/dist/lib/modules/core/schema/delegation.js +58 -0
- package/dist/lib/modules/core/schema/directory-frames.js +270 -0
- package/dist/lib/modules/core/schema/directory.js +169 -0
- package/dist/lib/modules/core/schema/envelope.js +211 -0
- package/dist/lib/modules/core/schema/errors.js +65 -0
- package/dist/lib/modules/core/schema/index.js +15 -0
- package/dist/lib/modules/core/schema/ipc/consent.js +181 -0
- package/dist/lib/modules/core/schema/ipc/device.js +276 -0
- package/dist/lib/modules/core/schema/ipc/jelly.js +189 -0
- package/dist/lib/modules/core/schema/ipc/shapes.js +185 -0
- package/dist/lib/modules/core/schema/ipc/surfaces.js +223 -0
- package/dist/lib/modules/core/schema/ipc.js +451 -0
- package/dist/lib/modules/core/schema/jelly.js +122 -0
- package/dist/lib/modules/core/schema/realm.js +27 -0
- package/dist/lib/modules/core/schema/relay.js +112 -0
- package/dist/lib/modules/core/schema/roster.js +126 -0
- package/dist/lib/modules/core/sign.js +43 -0
- package/dist/lib/modules/core/task.js +37 -0
- package/dist/lib/modules/core/testing.js +20 -0
- package/dist/lib/modules/core/ulid.js +36 -0
- package/dist/lib/modules/core/version.js +6 -0
- package/dist/lib/modules/core/wire.js +255 -0
- package/dist/lib/modules/ipc/client.js +289 -0
- package/dist/lib/modules/ipc/framing.js +33 -0
- package/dist/lib/modules/ipc/index.js +6 -0
- package/dist/lib/modules/ipc/paths.js +102 -0
- package/dist/lib/modules/ipc/pipes.js +65 -0
- package/dist/lib/modules/ipc/rpc.js +8 -0
- package/dist/lib/modules/ipc/server.js +317 -0
- package/dist/lib/modules/ipc/testing.js +145 -0
- package/dist/lib/modules/ipc/trust.js +166 -0
- package/dist/lib/modules/ipc/windows-acl.js +275 -0
- package/dist/lib/modules/vendor/zod/index.js +7 -0
- package/dist/lib/modules/vendor/zod/v4/classic/checks.js +1 -0
- package/dist/lib/modules/vendor/zod/v4/classic/coerce.js +17 -0
- package/dist/lib/modules/vendor/zod/v4/classic/compat.js +31 -0
- package/dist/lib/modules/vendor/zod/v4/classic/deep-partial.js +13 -0
- package/dist/lib/modules/vendor/zod/v4/classic/errors.js +57 -0
- package/dist/lib/modules/vendor/zod/v4/classic/external.js +17 -0
- package/dist/lib/modules/vendor/zod/v4/classic/from-json-schema.js +881 -0
- package/dist/lib/modules/vendor/zod/v4/classic/in-out.js +36 -0
- package/dist/lib/modules/vendor/zod/v4/classic/iso.js +15 -0
- package/dist/lib/modules/vendor/zod/v4/classic/parse.js +16 -0
- package/dist/lib/modules/vendor/zod/v4/classic/schemas.js +1535 -0
- package/dist/lib/modules/vendor/zod/v4/core/api.js +1107 -0
- package/dist/lib/modules/vendor/zod/v4/core/checks.js +516 -0
- package/dist/lib/modules/vendor/zod/v4/core/compile.js +1866 -0
- package/dist/lib/modules/vendor/zod/v4/core/core.js +141 -0
- package/dist/lib/modules/vendor/zod/v4/core/doc.js +38 -0
- package/dist/lib/modules/vendor/zod/v4/core/errors.js +267 -0
- package/dist/lib/modules/vendor/zod/v4/core/index.js +19 -0
- package/dist/lib/modules/vendor/zod/v4/core/json-schema-generator.js +99 -0
- package/dist/lib/modules/vendor/zod/v4/core/json-schema-processors.js +843 -0
- package/dist/lib/modules/vendor/zod/v4/core/json-schema.js +1 -0
- package/dist/lib/modules/vendor/zod/v4/core/memoizer.js +311 -0
- package/dist/lib/modules/vendor/zod/v4/core/parse.js +175 -0
- package/dist/lib/modules/vendor/zod/v4/core/regexes.js +156 -0
- package/dist/lib/modules/vendor/zod/v4/core/registries.js +51 -0
- package/dist/lib/modules/vendor/zod/v4/core/schemas.js +2636 -0
- package/dist/lib/modules/vendor/zod/v4/core/to-json-schema.js +651 -0
- package/dist/lib/modules/vendor/zod/v4/core/util.js +873 -0
- package/dist/lib/modules/vendor/zod/v4/core/versions.js +5 -0
- package/dist/lib/modules/vendor/zod/v4/core/visit.js +169 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ar.js +111 -0
- package/dist/lib/modules/vendor/zod/v4/locales/az.js +110 -0
- package/dist/lib/modules/vendor/zod/v4/locales/be.js +168 -0
- package/dist/lib/modules/vendor/zod/v4/locales/bg.js +125 -0
- package/dist/lib/modules/vendor/zod/v4/locales/bn.js +113 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ca.js +112 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ckb.js +133 -0
- package/dist/lib/modules/vendor/zod/v4/locales/cs.js +116 -0
- package/dist/lib/modules/vendor/zod/v4/locales/da.js +120 -0
- package/dist/lib/modules/vendor/zod/v4/locales/de.js +113 -0
- package/dist/lib/modules/vendor/zod/v4/locales/el.js +112 -0
- package/dist/lib/modules/vendor/zod/v4/locales/en.js +125 -0
- package/dist/lib/modules/vendor/zod/v4/locales/eo.js +114 -0
- package/dist/lib/modules/vendor/zod/v4/locales/es.js +136 -0
- package/dist/lib/modules/vendor/zod/v4/locales/fa.js +119 -0
- package/dist/lib/modules/vendor/zod/v4/locales/fi.js +117 -0
- package/dist/lib/modules/vendor/zod/v4/locales/fr-CA.js +112 -0
- package/dist/lib/modules/vendor/zod/v4/locales/fr.js +129 -0
- package/dist/lib/modules/vendor/zod/v4/locales/gu.js +113 -0
- package/dist/lib/modules/vendor/zod/v4/locales/he.js +221 -0
- package/dist/lib/modules/vendor/zod/v4/locales/hi.js +111 -0
- package/dist/lib/modules/vendor/zod/v4/locales/hr.js +126 -0
- package/dist/lib/modules/vendor/zod/v4/locales/hu.js +113 -0
- package/dist/lib/modules/vendor/zod/v4/locales/hy.js +158 -0
- package/dist/lib/modules/vendor/zod/v4/locales/id.js +111 -0
- package/dist/lib/modules/vendor/zod/v4/locales/index.js +63 -0
- package/dist/lib/modules/vendor/zod/v4/locales/is.js +114 -0
- package/dist/lib/modules/vendor/zod/v4/locales/it.js +113 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ja.js +112 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ka.js +117 -0
- package/dist/lib/modules/vendor/zod/v4/locales/kh.js +5 -0
- package/dist/lib/modules/vendor/zod/v4/locales/km.js +115 -0
- package/dist/lib/modules/vendor/zod/v4/locales/kn.js +116 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ko.js +116 -0
- package/dist/lib/modules/vendor/zod/v4/locales/lt.js +207 -0
- package/dist/lib/modules/vendor/zod/v4/locales/mk.js +114 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ms.js +112 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ne.js +111 -0
- package/dist/lib/modules/vendor/zod/v4/locales/nl.js +115 -0
- package/dist/lib/modules/vendor/zod/v4/locales/nn.js +113 -0
- package/dist/lib/modules/vendor/zod/v4/locales/no.js +113 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ota.js +114 -0
- package/dist/lib/modules/vendor/zod/v4/locales/pl.js +114 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ps.js +119 -0
- package/dist/lib/modules/vendor/zod/v4/locales/pt-BR.js +143 -0
- package/dist/lib/modules/vendor/zod/v4/locales/pt.js +142 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ro.js +122 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ru.js +168 -0
- package/dist/lib/modules/vendor/zod/v4/locales/sk.js +116 -0
- package/dist/lib/modules/vendor/zod/v4/locales/sl.js +114 -0
- package/dist/lib/modules/vendor/zod/v4/locales/sv.js +115 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ta.js +115 -0
- package/dist/lib/modules/vendor/zod/v4/locales/tg.js +117 -0
- package/dist/lib/modules/vendor/zod/v4/locales/th.js +115 -0
- package/dist/lib/modules/vendor/zod/v4/locales/tk.js +107 -0
- package/dist/lib/modules/vendor/zod/v4/locales/tr.js +110 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ua.js +5 -0
- package/dist/lib/modules/vendor/zod/v4/locales/uk.js +113 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ur.js +115 -0
- package/dist/lib/modules/vendor/zod/v4/locales/uz.js +113 -0
- package/dist/lib/modules/vendor/zod/v4/locales/vi.js +113 -0
- package/dist/lib/modules/vendor/zod/v4/locales/yo.js +112 -0
- package/dist/lib/modules/vendor/zod/v4/locales/zh-CN.js +114 -0
- package/dist/lib/modules/vendor/zod/v4/locales/zh-TW.js +112 -0
- package/dist/lib/testing-jelly-id.js +1219 -0
- package/dist/lib/zod.js +1 -0
- package/dist/spec/messaging-v1.md +3426 -0
- package/dist/third-party-notices.md +239 -0
- package/dist/third-party.json +88 -0
- package/dist/types/core/address.d.ts +16 -0
- package/dist/types/core/agent/operations.d.ts +129 -0
- package/dist/types/core/agent/present.d.ts +57 -0
- package/dist/types/core/agent/text.d.ts +62 -0
- package/dist/types/core/agent-tools.d.ts +948 -0
- package/dist/types/core/b64u.d.ts +6 -0
- package/dist/types/core/cards.d.ts +21 -0
- package/dist/types/core/check.d.ts +10 -0
- package/dist/types/core/consent.d.ts +132 -0
- package/dist/types/core/contact-card.d.ts +34 -0
- package/dist/types/core/delegation.d.ts +71 -0
- package/dist/types/core/directory/device-log.d.ts +119 -0
- package/dist/types/core/directory/epoch.d.ts +53 -0
- package/dist/types/core/directory/handle.d.ts +11 -0
- package/dist/types/core/directory/jelly-device.d.ts +88 -0
- package/dist/types/core/directory/jelly-issuer.d.ts +8 -0
- package/dist/types/core/directory/jelly-token.d.ts +116 -0
- package/dist/types/core/directory/keys-statement.d.ts +22 -0
- package/dist/types/core/directory/link.d.ts +36 -0
- package/dist/types/core/directory/merkle-log.d.ts +40 -0
- package/dist/types/core/directory/person-view.d.ts +90 -0
- package/dist/types/core/directory/person.d.ts +8 -0
- package/dist/types/core/directory/realm.d.ts +23 -0
- package/dist/types/core/directory/smt.d.ts +52 -0
- package/dist/types/core/envelope.d.ts +68 -0
- package/dist/types/core/hash.d.ts +2 -0
- package/dist/types/core/head.d.ts +34 -0
- package/dist/types/core/identity.d.ts +35 -0
- package/dist/types/core/index.d.ts +38 -0
- package/dist/types/core/jcs.d.ts +12 -0
- package/dist/types/core/jelly-host-double.d.ts +21 -0
- package/dist/types/core/jelly-host.d.ts +86 -0
- package/dist/types/core/keys.d.ts +16 -0
- package/dist/types/core/peer-text.d.ts +87 -0
- package/dist/types/core/realm.d.ts +36 -0
- package/dist/types/core/roster.d.ts +146 -0
- package/dist/types/core/schema/a2a.d.ts +251 -0
- package/dist/types/core/schema/common.d.ts +272 -0
- package/dist/types/core/schema/consent.d.ts +140 -0
- package/dist/types/core/schema/delegation.d.ts +58 -0
- package/dist/types/core/schema/directory-frames.d.ts +1301 -0
- package/dist/types/core/schema/directory.d.ts +375 -0
- package/dist/types/core/schema/envelope.d.ts +750 -0
- package/dist/types/core/schema/errors.d.ts +104 -0
- package/dist/types/core/schema/index.d.ts +15 -0
- package/dist/types/core/schema/ipc/consent.d.ts +555 -0
- package/dist/types/core/schema/ipc/device.d.ts +729 -0
- package/dist/types/core/schema/ipc/jelly.d.ts +501 -0
- package/dist/types/core/schema/ipc/shapes.d.ts +411 -0
- package/dist/types/core/schema/ipc/surfaces.d.ts +674 -0
- package/dist/types/core/schema/ipc.d.ts +3131 -0
- package/dist/types/core/schema/jelly.d.ts +160 -0
- package/dist/types/core/schema/realm.d.ts +38 -0
- package/dist/types/core/schema/relay.d.ts +1122 -0
- package/dist/types/core/schema/roster.d.ts +347 -0
- package/dist/types/core/sign.d.ts +13 -0
- package/dist/types/core/task.d.ts +6 -0
- package/dist/types/core/testing.d.ts +18 -0
- package/dist/types/core/ulid.d.ts +5 -0
- package/dist/types/core/version.d.ts +6 -0
- package/dist/types/core/wire.d.ts +14 -0
- package/dist/types/ipc/client.d.ts +85 -0
- package/dist/types/ipc/framing.d.ts +12 -0
- package/dist/types/ipc/index.d.ts +6 -0
- package/dist/types/ipc/paths.d.ts +39 -0
- package/dist/types/ipc/pipes.d.ts +16 -0
- package/dist/types/ipc/rpc.d.ts +13 -0
- package/dist/types/ipc/server.d.ts +94 -0
- package/dist/types/ipc/testing.d.ts +89 -0
- package/dist/types/ipc/trust.d.ts +49 -0
- package/dist/types/ipc/windows-acl.d.ts +56 -0
- package/dist/types/testing/jelly-id.d.ts +518 -0
- package/dist/types/zod.d.ts +1 -0
- package/package.json +77 -4
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Protocol identifier carried in every envelope and roster entry. A breaking change gets a new value. */
|
|
3
|
+
export declare const PROTOCOL: "messaging/1";
|
|
4
|
+
/** Relay WebSocket sub-protocol identifier. */
|
|
5
|
+
export declare const RELAY_PROTOCOL: "messaging-relay/1";
|
|
6
|
+
/**
|
|
7
|
+
* Domain-separation prefixes. Every signature covers `prefix + JCS(value)` as UTF-8,
|
|
8
|
+
* so a signature made for one purpose can never verify for another.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DOMAIN: {
|
|
11
|
+
readonly envelope: "messaging/1/envelope\n";
|
|
12
|
+
readonly roster: "messaging/1/roster\n";
|
|
13
|
+
readonly relayAuth: "messaging/1/relay-auth\n";
|
|
14
|
+
/** An invite redeem proof, signed with the invite seed over JCS({team, inviteId, member}). */
|
|
15
|
+
readonly invite: "messaging/1/invite\n";
|
|
16
|
+
/** A pre-auth `join` proof, signed with the invite seed over JCS({relay, team, inviteId, nonce}). */
|
|
17
|
+
readonly inviteJoin: "messaging/1/invite-join\n";
|
|
18
|
+
/** A delegation grant, signed by the delegating machine over JCS(grant without sig). */
|
|
19
|
+
readonly delegation: "messaging/1/delegation\n";
|
|
20
|
+
/** A consent grant (spec §6.9), signed by a device of its person over JCS(grant without sig). */
|
|
21
|
+
readonly grant: "messaging/1/grant\n";
|
|
22
|
+
/** A contact card (spec §6.9, "Contact cards"), signed by a device of the person it speaks for over JCS(card without sig). */
|
|
23
|
+
readonly card: "messaging/1/card\n";
|
|
24
|
+
/** HKDF `info` for sealing envelope bodies. */
|
|
25
|
+
readonly seal: "messaging/1/seal";
|
|
26
|
+
/** Hosted realms (spec §15.1): the prefix of the hash that turns a Jelly account into a `PersonId`. */
|
|
27
|
+
readonly person: "messaging/1/person\n";
|
|
28
|
+
/** Hosted realms (spec §15.5): an erased person's map value is the SHA-256 of this text. */
|
|
29
|
+
readonly tombstone: "messaging/1/tombstone";
|
|
30
|
+
/**
|
|
31
|
+
* Hosted realms (spec §7, "Directory frames"): a device's proof, before `hello`, that it holds its key on this
|
|
32
|
+
* connection, signed over JCS(`dirReadPayload`), so it may read its own person's log.
|
|
33
|
+
*/
|
|
34
|
+
readonly dirRead: "messaging/1/dir-read\n";
|
|
35
|
+
/** Hosted realms (spec §15.3): a device-log entry, signed by `by` over JCS(entry without sig). */
|
|
36
|
+
readonly deviceLog: "messaging/1/device-log\n";
|
|
37
|
+
/** Hosted realms (spec §15.4): a keys statement, signed by its device over JCS(statement without sig). */
|
|
38
|
+
readonly deviceKeys: "messaging/1/device-keys\n";
|
|
39
|
+
/** Hosted realms (spec §15.3): a link request, signed by the new device over JCS(request without sig). */
|
|
40
|
+
readonly deviceLink: "messaging/1/device-link\n";
|
|
41
|
+
/** Hosted realms (spec §15.6): a signed tree head, signed by the directory's epoch key over JCS(head without sig). */
|
|
42
|
+
readonly epoch: "messaging/1/epoch\n";
|
|
43
|
+
/** Hosted realms (spec §15.6): an epoch-key rotation, signed by the old key and by the new over JCS(rotation without sigs). */
|
|
44
|
+
readonly dirKey: "messaging/1/dir-key\n";
|
|
45
|
+
};
|
|
46
|
+
/** A2A extension and binding URIs owned by Messaging. */
|
|
47
|
+
export declare const URI: {
|
|
48
|
+
readonly binding: "urn:messaging:binding:relay:v1";
|
|
49
|
+
readonly provenance: "urn:messaging:ext:provenance:v1";
|
|
50
|
+
readonly presence: "urn:messaging:ext:presence:v1";
|
|
51
|
+
};
|
|
52
|
+
export declare const Base64Url: z.ZodString;
|
|
53
|
+
/** Any 32-byte value in base64url, e.g. a raw public key. */
|
|
54
|
+
export declare const Key32: z.ZodString;
|
|
55
|
+
/** A machine's identity: its Ed25519 public key (32 bytes, base64url). */
|
|
56
|
+
export declare const MachineId: z.ZodString;
|
|
57
|
+
/** A machine's X25519 public key used to seal envelope bodies addressed to it. */
|
|
58
|
+
export declare const EncKey: z.ZodString;
|
|
59
|
+
/** SHA-256 digest, base64url. */
|
|
60
|
+
export declare const Hash: z.ZodString;
|
|
61
|
+
/** A team id is the hash of its JCS-canonical genesis entry. */
|
|
62
|
+
export declare const TeamId: z.ZodString;
|
|
63
|
+
/** Crockford base32 ULID, 26 chars. */
|
|
64
|
+
export declare const Ulid: z.ZodString;
|
|
65
|
+
export declare const PersonName: z.ZodString;
|
|
66
|
+
/** A hosted realm's person (spec §15.1): `p_` and 26 lower-case base32 characters, derived from a Jelly account. */
|
|
67
|
+
export declare const HostedPersonId: z.ZodString;
|
|
68
|
+
/** A person in either realm: a roster person name, or a hosted `p_…` id. The two forms cannot collide. */
|
|
69
|
+
export declare const PersonId: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
70
|
+
/** A channel's name (spec §6.8). Unique among the channels one machine holds, not across the team. */
|
|
71
|
+
export declare const ChannelName: z.ZodString;
|
|
72
|
+
/** A chat room (spec §6.8): `dm:<person>` for a direct human message, `channel:<name>` for a channel. */
|
|
73
|
+
export declare const RoomRef: z.ZodString;
|
|
74
|
+
export declare const SessionName: z.ZodString;
|
|
75
|
+
export declare const MachineLabel: z.ZodString;
|
|
76
|
+
export declare const TeamName: z.ZodString;
|
|
77
|
+
/** Client kind, e.g. "opencode", "claude-code", "cli". */
|
|
78
|
+
export declare const AgentKind: z.ZodString;
|
|
79
|
+
/**
|
|
80
|
+
* The agent kind of the human `messaging` command line (spec §8.2, §8.3): never kept or expired on
|
|
81
|
+
* disconnect, refused as a task executor, and the only sender of group addresses.
|
|
82
|
+
*/
|
|
83
|
+
export declare const CLI_AGENT = "cli";
|
|
84
|
+
/** Milliseconds since the Unix epoch. */
|
|
85
|
+
export declare const Millis: z.ZodNumber;
|
|
86
|
+
/**
|
|
87
|
+
* Address grammar (parsed by `parseAddress`); `person` is a `PersonId` (a roster person name or a hosted `p_…`):
|
|
88
|
+
* person/session one session (must be unambiguous across the person's machines)
|
|
89
|
+
* person/session@label one session on a named machine
|
|
90
|
+
* There are no group addresses (spec §3).
|
|
91
|
+
*/
|
|
92
|
+
export declare const Address: z.ZodString;
|
|
93
|
+
/**
|
|
94
|
+
* A resolved, fully qualified single-session address: `person/session@label`, where `person` is a `PersonId` (a
|
|
95
|
+
* roster person name, or a hosted `p_…` id). Every daemon-produced address uses it.
|
|
96
|
+
*/
|
|
97
|
+
export declare const SessionAddress: z.ZodString;
|
|
98
|
+
export declare const MemberRole: z.ZodEnum<{
|
|
99
|
+
admin: "admin";
|
|
100
|
+
member: "member";
|
|
101
|
+
}>;
|
|
102
|
+
export declare const SessionState: z.ZodEnum<{
|
|
103
|
+
idle: "idle";
|
|
104
|
+
busy: "busy";
|
|
105
|
+
}>;
|
|
106
|
+
/** push: the client may wake an idle session for inbound mail. pull: the agent reads its inbox. */
|
|
107
|
+
export declare const DeliveryTier: z.ZodEnum<{
|
|
108
|
+
push: "push";
|
|
109
|
+
pull: "pull";
|
|
110
|
+
}>;
|
|
111
|
+
/** Sender-side view of one envelope's progress. Stages only move forward, except to rejected/expired. */
|
|
112
|
+
export declare const DeliveryStage: z.ZodEnum<{
|
|
113
|
+
accepted: "accepted";
|
|
114
|
+
relayed: "relayed";
|
|
115
|
+
delivered: "delivered";
|
|
116
|
+
held: "held";
|
|
117
|
+
handed_to_agent: "handed_to_agent";
|
|
118
|
+
read: "read";
|
|
119
|
+
replied: "replied";
|
|
120
|
+
rejected: "rejected";
|
|
121
|
+
expired: "expired";
|
|
122
|
+
}>;
|
|
123
|
+
export declare const LIMITS: {
|
|
124
|
+
/** Max bytes for one relay WebSocket frame. */
|
|
125
|
+
readonly frameBytes: 1048576;
|
|
126
|
+
/** Max bytes for one IPC NDJSON line. */
|
|
127
|
+
readonly ipcLineBytes: 2097152;
|
|
128
|
+
/** Max UTF-8 bytes of a decrypted envelope body (JCS). */
|
|
129
|
+
readonly plaintextBytes: 262144;
|
|
130
|
+
/** Max characters in a single text part. */
|
|
131
|
+
readonly textPartChars: 65536;
|
|
132
|
+
/** Max parts in one message. */
|
|
133
|
+
readonly partsPerMessage: 16;
|
|
134
|
+
/** Default and max envelope TTL, and the max invite lifetime (`expires − ts`). */
|
|
135
|
+
readonly ttlMs: number;
|
|
136
|
+
/** Max nesting of arrays and objects in any JSON value Messaging parses, signs or hashes; the outermost container is depth 1. */
|
|
137
|
+
readonly jsonDepth: 32;
|
|
138
|
+
/** Accepted clock skew for `ts` in the future. */
|
|
139
|
+
readonly clockSkewMs: number;
|
|
140
|
+
/** Inbound envelopes accepted per sending machine per minute (daemon policy). */
|
|
141
|
+
readonly inboundPerMachinePerMinute: 60;
|
|
142
|
+
/** Agent-to-agent loop guard per (sender session, recipient session) pair. */
|
|
143
|
+
readonly loopGuard: {
|
|
144
|
+
readonly max: 12;
|
|
145
|
+
readonly windowMs: number;
|
|
146
|
+
};
|
|
147
|
+
/** Max sessions advertised in one presence payload. */
|
|
148
|
+
readonly presenceSessions: 200;
|
|
149
|
+
/**
|
|
150
|
+
* Max UTF-8 bytes of a presence body (JCS). It bounds what each member adds to every welcome's replay
|
|
151
|
+
* and every fan-out, and still holds `presenceSessions` sessions once their optional fields are dropped.
|
|
152
|
+
*/
|
|
153
|
+
readonly presenceBytes: 65536;
|
|
154
|
+
/** Max preview characters in an inbox item. */
|
|
155
|
+
readonly previewChars: 200;
|
|
156
|
+
/** Max UTF-8 bytes of one relay frame before `hello`; a larger one closes the connection. */
|
|
157
|
+
readonly preAuthFrameBytes: 32768;
|
|
158
|
+
/** Max UTF-8 bytes of an envelope header: JCS of the envelope without `body` (relay nacks `too_large`). */
|
|
159
|
+
readonly headerBytes: 4096;
|
|
160
|
+
/** Max unexpired envelopes the relay queues from one sender machine to one recipient machine (`rate_limited`). */
|
|
161
|
+
readonly queuePerSender: 1000;
|
|
162
|
+
/** Relay budget per machine for every frame after `hello`: a token bucket of this many frames, refilled per minute. */
|
|
163
|
+
readonly relayFramesPerMinute: 600;
|
|
164
|
+
/** Relay budget per machine for every frame after `hello`: a token bucket of this many UTF-8 bytes, refilled per minute. */
|
|
165
|
+
readonly relayBytesPerMinute: number;
|
|
166
|
+
/** Relay limit on presence frames per machine: a token bucket of `presenceBurst`, refilled one per `presenceIntervalMs`. */
|
|
167
|
+
readonly presenceIntervalMs: 2000;
|
|
168
|
+
/** See `presenceIntervalMs`. */
|
|
169
|
+
readonly presenceBurst: 3;
|
|
170
|
+
/** Max entries in one `join` or `roster.sync` reply page. */
|
|
171
|
+
readonly rosterPageEntries: 256;
|
|
172
|
+
/** Max UTF-8 bytes of one roster entry (JCS). */
|
|
173
|
+
readonly rosterEntryBytes: 16384;
|
|
174
|
+
/** Max grants in a delegation chain (spec §6.7): R → X → Y → Z → W. */
|
|
175
|
+
readonly delegationDepth: 4;
|
|
176
|
+
/** Max scope labels in one delegation grant. */
|
|
177
|
+
readonly delegationScopes: 8;
|
|
178
|
+
/** Max UTF-8 bytes of a whole delegation chain (JCS). */
|
|
179
|
+
readonly delegationBytes: 8192;
|
|
180
|
+
/** Max persons in a channel, its creator included (spec §6.8). */
|
|
181
|
+
readonly channelPersons: 32;
|
|
182
|
+
/** Max UTF-16 code units of one chat line's text (spec §6.8). */
|
|
183
|
+
readonly chatChars: 8000;
|
|
184
|
+
/** Max follow-ups a requester's task record lists (spec §6.3, the newest). */
|
|
185
|
+
readonly taskFollowUps: 20;
|
|
186
|
+
/** Max current devices of one hosted person (spec §15.3); also bounds `dir.erase` (§7, "Directory frames"). */
|
|
187
|
+
readonly devicesPerPerson: 10;
|
|
188
|
+
/** A directory makes a new epoch at most this often while changes wait (spec §15.10). */
|
|
189
|
+
readonly epochMinMs: 5000;
|
|
190
|
+
/** ...and one at least this often without changes, so a fresh STH always exists. */
|
|
191
|
+
readonly epochHeartbeatMs: number;
|
|
192
|
+
/** How often a directory reads Jelly ID's account-deletion feed (spec §15.10). */
|
|
193
|
+
readonly deletionPollMs: number;
|
|
194
|
+
/** After a gap in that feed of over 90 days, the directory erases persons idle for this many days, once. */
|
|
195
|
+
readonly dormantDays: 180;
|
|
196
|
+
/** Distinct persons one person may send message requests to per day, at a directory relay. */
|
|
197
|
+
readonly requestsPerDay: 20;
|
|
198
|
+
/** Max UTF-16 code units of a message request's text (spec §6.9, "Message requests"): the whole of what a stranger may say first. */
|
|
199
|
+
readonly requestChars: 500;
|
|
200
|
+
/** Envelopes per day from one person to another who never sent to them (an unsolicited pair). */
|
|
201
|
+
readonly unsolicitedPerPairPerDay: 20;
|
|
202
|
+
/** Distinct persons one person may send to unsolicited per day. */
|
|
203
|
+
readonly unsolicitedTargetsPerDay: 50;
|
|
204
|
+
/** Max persons in one `dir.lookup`. */
|
|
205
|
+
readonly dirLookupPersons: 64;
|
|
206
|
+
/** Max persons one `dir.resolve` or `dir.search` answers. */
|
|
207
|
+
readonly dirSearchResults: 25;
|
|
208
|
+
/** Max persons one device watches with `dir.watch`, and with `presence.watch`. */
|
|
209
|
+
readonly watchPersons: 500;
|
|
210
|
+
/** Max age of a link request when its device is approved, and of an approval after it (spec §15.3). */
|
|
211
|
+
readonly linkTtlMs: number;
|
|
212
|
+
/**
|
|
213
|
+
* A directory realm's freshness bounds (spec §15.9): a person's devices are sealed to only when verified at an STH
|
|
214
|
+
* fetched at most `dirFreshFirstMs` ago for a first message or right after a change push, and at most `dirFreshMs`
|
|
215
|
+
* ago otherwise.
|
|
216
|
+
*/
|
|
217
|
+
readonly dirFreshFirstMs: number;
|
|
218
|
+
readonly dirFreshMs: number;
|
|
219
|
+
/** How often, at least, a device verifies its own person's log and keys at the directory (spec §15.9). */
|
|
220
|
+
readonly selfMonitorMs: number;
|
|
221
|
+
/** A Jelly-vouched device attests again at its first chance after this long (spec §15.9). */
|
|
222
|
+
readonly attestAfterMs: number;
|
|
223
|
+
/** Max UTF-8 bytes of one device-log entry (JCS), a Jelly token included (spec §15.3). */
|
|
224
|
+
readonly logEntryBytes: 16384;
|
|
225
|
+
/** Max UTF-8 bytes of one keys statement (JCS) (spec §15.4). */
|
|
226
|
+
readonly keysStatementBytes: 1024;
|
|
227
|
+
/** Trust a grant gives when the person names no end (spec §6.9). */
|
|
228
|
+
readonly trustDefaultMs: number;
|
|
229
|
+
/** Max `trustedUntil − ts` of a grant (spec §6.9). */
|
|
230
|
+
readonly trustMaxMs: number;
|
|
231
|
+
/** Max UTF-8 bytes of one grant (JCS). */
|
|
232
|
+
readonly grantBytes: 2048;
|
|
233
|
+
/** Max UTF-8 bytes of one contact card (JCS) (spec §6.9, "Contact cards"). */
|
|
234
|
+
readonly cardBytes: 2048;
|
|
235
|
+
/** Max grants one person's device holds (spec §6.9): one per subject. */
|
|
236
|
+
readonly grantsPerPerson: 5000;
|
|
237
|
+
/** Max requests a device holds from one sending person for its person to answer (spec §6.9). */
|
|
238
|
+
readonly heldPerSender: 20;
|
|
239
|
+
/** Max requests a device holds in all (spec §6.9). */
|
|
240
|
+
readonly heldTotal: 200;
|
|
241
|
+
/** Max lines one person's agents send to another person in an hour, summed over the agents (spec §6.9, "Pacing"). */
|
|
242
|
+
readonly a2hPerHour: 30;
|
|
243
|
+
/** Max lines one person's agents send to another person in a day, summed over the agents (spec §6.9, "Pacing"). */
|
|
244
|
+
readonly a2hPerDay: 100;
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* True for a relay URL a client may connect to: `wss://`, or `ws://` to a loopback host (`localhost`,
|
|
248
|
+
* 127.0.0.0/8 or `[::1]`, after WHATWG URL parsing). Anything else, including text that is not a URL, is false.
|
|
249
|
+
*/
|
|
250
|
+
export declare function isAllowedRelayUrl(url: string): boolean;
|
|
251
|
+
/** A relay connect URL that passes `isAllowedRelayUrl`. */
|
|
252
|
+
export declare const RelayUrl: z.ZodString;
|
|
253
|
+
export type MachineId = z.infer<typeof MachineId>;
|
|
254
|
+
export type EncKey = z.infer<typeof EncKey>;
|
|
255
|
+
export type Hash = z.infer<typeof Hash>;
|
|
256
|
+
export type TeamId = z.infer<typeof TeamId>;
|
|
257
|
+
export type Ulid = z.infer<typeof Ulid>;
|
|
258
|
+
export type PersonName = z.infer<typeof PersonName>;
|
|
259
|
+
export type HostedPersonId = z.infer<typeof HostedPersonId>;
|
|
260
|
+
export type PersonId = z.infer<typeof PersonId>;
|
|
261
|
+
export type ChannelName = z.infer<typeof ChannelName>;
|
|
262
|
+
export type RoomRef = z.infer<typeof RoomRef>;
|
|
263
|
+
export type SessionName = z.infer<typeof SessionName>;
|
|
264
|
+
export type MachineLabel = z.infer<typeof MachineLabel>;
|
|
265
|
+
export type Millis = z.infer<typeof Millis>;
|
|
266
|
+
export type Address = z.infer<typeof Address>;
|
|
267
|
+
export type RelayUrl = z.infer<typeof RelayUrl>;
|
|
268
|
+
export type SessionAddress = z.infer<typeof SessionAddress>;
|
|
269
|
+
export type MemberRole = z.infer<typeof MemberRole>;
|
|
270
|
+
export type SessionState = z.infer<typeof SessionState>;
|
|
271
|
+
export type DeliveryTier = z.infer<typeof DeliveryTier>;
|
|
272
|
+
export type DeliveryStage = z.infer<typeof DeliveryStage>;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consent (spec §6.9): a person's grants, the policy they hold for one sender person or one channel. One of the
|
|
3
|
+
* person's devices signs each grant; only the person's own devices hold it, and their daemons enforce it on
|
|
4
|
+
* receipt. Agents never sign or change a grant: every method that does is human tier (§8.2).
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
/** H2H lines from the subject: `muted` delivers with no notification and no unread mark; `blocked` refuses every class from them. */
|
|
8
|
+
export declare const ChatLevel: z.ZodEnum<{
|
|
9
|
+
open: "open";
|
|
10
|
+
muted: "muted";
|
|
11
|
+
blocked: "blocked";
|
|
12
|
+
}>;
|
|
13
|
+
export type ChatLevel = z.infer<typeof ChatLevel>;
|
|
14
|
+
/** Lines from the subject's agents to the person (A2H). */
|
|
15
|
+
export declare const AgentMailLevel: z.ZodEnum<{
|
|
16
|
+
open: "open";
|
|
17
|
+
blocked: "blocked";
|
|
18
|
+
}>;
|
|
19
|
+
export type AgentMailLevel = z.infer<typeof AgentMailLevel>;
|
|
20
|
+
/** Mail and tasks from the subject or their agents to the person's agents: `request` holds each one for the person to answer. */
|
|
21
|
+
export declare const AskLevel: z.ZodEnum<{
|
|
22
|
+
open: "open";
|
|
23
|
+
request: "request";
|
|
24
|
+
no: "no";
|
|
25
|
+
}>;
|
|
26
|
+
export type AskLevel = z.infer<typeof AskLevel>;
|
|
27
|
+
/** Whom a grant is about: one person, or every member of one channel (by its id). */
|
|
28
|
+
export declare const GrantSubject: z.ZodUnion<readonly [z.ZodObject<{
|
|
29
|
+
person: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
30
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
31
|
+
channel: z.ZodString;
|
|
32
|
+
}, z.core.$strict>]>;
|
|
33
|
+
export type GrantSubject = z.infer<typeof GrantSubject>;
|
|
34
|
+
/**
|
|
35
|
+
* A grant, signed by `by`, a device of `person`: `sig = Ed25519(by, "messaging/1/grant\n" || JCS(grant without sig))`.
|
|
36
|
+
* Every level is optional: an absent level is the default for the relation (spec §6.9, "Effective policy"), and a
|
|
37
|
+
* grant with none is a clear. `trustedUntil` needs `ask: "open"` and is at most `ts + LIMITS.trustMaxMs`. A channel
|
|
38
|
+
* grant sets only `ask` and `agentMail`. A grant about the person themself sets only `discoverable`.
|
|
39
|
+
* `resignedAt` marks a grant re-signed by another device of the person (spec §6.9, "Signers"); it keeps `id` and
|
|
40
|
+
* `ts`.
|
|
41
|
+
*/
|
|
42
|
+
export declare const ConsentGrant: z.ZodObject<{
|
|
43
|
+
v: z.ZodLiteral<"messaging/1">;
|
|
44
|
+
realm: z.ZodString;
|
|
45
|
+
id: z.ZodString;
|
|
46
|
+
person: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
47
|
+
by: z.ZodString;
|
|
48
|
+
ts: z.ZodNumber;
|
|
49
|
+
subject: z.ZodUnion<readonly [z.ZodObject<{
|
|
50
|
+
person: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
51
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
52
|
+
channel: z.ZodString;
|
|
53
|
+
}, z.core.$strict>]>;
|
|
54
|
+
chat: z.ZodOptional<z.ZodEnum<{
|
|
55
|
+
open: "open";
|
|
56
|
+
muted: "muted";
|
|
57
|
+
blocked: "blocked";
|
|
58
|
+
}>>;
|
|
59
|
+
agentMail: z.ZodOptional<z.ZodEnum<{
|
|
60
|
+
open: "open";
|
|
61
|
+
blocked: "blocked";
|
|
62
|
+
}>>;
|
|
63
|
+
ask: z.ZodOptional<z.ZodEnum<{
|
|
64
|
+
open: "open";
|
|
65
|
+
request: "request";
|
|
66
|
+
no: "no";
|
|
67
|
+
}>>;
|
|
68
|
+
trustedUntil: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
discoverable: z.ZodOptional<z.ZodBoolean>;
|
|
70
|
+
resignedAt: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
sig: z.ZodString;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
export type ConsentGrant = z.infer<typeof ConsentGrant>;
|
|
74
|
+
/** Most grants one `self` sync envelope carries (spec §6.9, "Sync"): a snapshot goes in as many envelopes as it needs. */
|
|
75
|
+
export declare const GRANTS_PER_SYNC = 100;
|
|
76
|
+
/**
|
|
77
|
+
* The one data part of a `self` sync envelope (spec §6.9, "Sync"): grants as signed, kept raw so that members a
|
|
78
|
+
* newer device adds stay covered by their signatures. The receiver verifies each one.
|
|
79
|
+
*/
|
|
80
|
+
export declare const GrantSync: z.ZodObject<{
|
|
81
|
+
grants: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
82
|
+
}, z.core.$strict>;
|
|
83
|
+
export type GrantSync = z.infer<typeof GrantSync>;
|
|
84
|
+
/** The grant's levels, the part a person sets. */
|
|
85
|
+
export type GrantLevels = Pick<ConsentGrant, "chat" | "agentMail" | "ask" | "trustedUntil" | "discoverable">;
|
|
86
|
+
/** The rules of a grant that its schema alone cannot say. */
|
|
87
|
+
export declare function grantProblem(grant: Omit<ConsentGrant, "sig">): string | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* What a person's card tells another person they may send (spec §6.9, "Contact cards"): DM lines (`chat`), lines from
|
|
90
|
+
* their agents (`agentMail`), and asks to the person's agents (`ask`, with `trustedUntil` while they are trusted).
|
|
91
|
+
*/
|
|
92
|
+
export declare const CardCan: z.ZodObject<{
|
|
93
|
+
chat: z.ZodBoolean;
|
|
94
|
+
agentMail: z.ZodBoolean;
|
|
95
|
+
ask: z.ZodEnum<{
|
|
96
|
+
open: "open";
|
|
97
|
+
request: "request";
|
|
98
|
+
no: "no";
|
|
99
|
+
}>;
|
|
100
|
+
trustedUntil: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
}, z.core.$strict>;
|
|
102
|
+
export type CardCan = z.infer<typeof CardCan>;
|
|
103
|
+
/**
|
|
104
|
+
* A contact card: `from`'s word to `to` about what `to` may send them, signed by `by`, a device of `from`:
|
|
105
|
+
* `sig = Ed25519(by, "messaging/1/card\n" || JCS(card without sig))`. `seq` rises with every card `from` sends `to`;
|
|
106
|
+
* the receiver keeps the highest. `grantId` names the grant it reflects. A card is advice: `from`'s own daemon
|
|
107
|
+
* enforces the grants, which may be newer.
|
|
108
|
+
*/
|
|
109
|
+
export declare const ContactCard: z.ZodObject<{
|
|
110
|
+
v: z.ZodLiteral<"messaging/1">;
|
|
111
|
+
realm: z.ZodString;
|
|
112
|
+
from: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
113
|
+
to: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
114
|
+
by: z.ZodString;
|
|
115
|
+
seq: z.ZodNumber;
|
|
116
|
+
ts: z.ZodNumber;
|
|
117
|
+
grantId: z.ZodOptional<z.ZodString>;
|
|
118
|
+
can: z.ZodObject<{
|
|
119
|
+
chat: z.ZodBoolean;
|
|
120
|
+
agentMail: z.ZodBoolean;
|
|
121
|
+
ask: z.ZodEnum<{
|
|
122
|
+
open: "open";
|
|
123
|
+
request: "request";
|
|
124
|
+
no: "no";
|
|
125
|
+
}>;
|
|
126
|
+
trustedUntil: z.ZodOptional<z.ZodNumber>;
|
|
127
|
+
}, z.core.$strict>;
|
|
128
|
+
sig: z.ZodString;
|
|
129
|
+
}, z.core.$strip>;
|
|
130
|
+
export type ContactCard = z.infer<typeof ContactCard>;
|
|
131
|
+
/** The rules of a card that its schema alone cannot say. */
|
|
132
|
+
export declare function cardProblem(card: Omit<ContactCard, "sig">): string | undefined;
|
|
133
|
+
/** The one data part of a `card` message (spec §5, "Meaning"): the card as signed, kept raw; the receiver verifies it. */
|
|
134
|
+
export declare const CardData: z.ZodObject<{
|
|
135
|
+
card: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
136
|
+
}, z.core.$strict>;
|
|
137
|
+
/** The one data part of a card request (`what: "get"`). */
|
|
138
|
+
export declare const CardGetData: z.ZodObject<{
|
|
139
|
+
get: z.ZodLiteral<true>;
|
|
140
|
+
}, z.core.$strict>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delegation chains (spec §6.7). A task request carries the chain of signed
|
|
3
|
+
* grants from its root requester to the session it addresses, so an executor (and whoever approves
|
|
4
|
+
* its work) sees who asked whom, for which task.
|
|
5
|
+
*
|
|
6
|
+
* sig = Ed25519(by, DOMAIN.delegation + JCS(grant without sig))
|
|
7
|
+
* grantHash = SHA-256(UTF-8(JCS(grant))), base64url, over the full grant including sig
|
|
8
|
+
* chain = [root grant, …, grant to this session]; each later grant has parent = grantHash(previous)
|
|
9
|
+
*
|
|
10
|
+
* Every hop is a new statement by the machine that delegates; nothing is forwarded as a credential.
|
|
11
|
+
* A hop can only narrow: scope ⊆ the previous scope (absent = unrestricted), maxDepth ≤ the previous
|
|
12
|
+
* maxDepth, exp ≤ the previous exp. `verifyChain` in core checks all of it.
|
|
13
|
+
*
|
|
14
|
+
* Grants are loose objects: a field a newer signer adds stays in the parsed grant, so the signature
|
|
15
|
+
* and the hash still cover it.
|
|
16
|
+
*/
|
|
17
|
+
import { z } from "zod";
|
|
18
|
+
/** A scope label. Its meaning is left to clients; the protocol only checks that a hop never widens the set. */
|
|
19
|
+
export declare const DelegationScope: z.ZodString;
|
|
20
|
+
export type DelegationScope = z.infer<typeof DelegationScope>;
|
|
21
|
+
export declare const DelegationGrant: z.ZodObject<{
|
|
22
|
+
realm: z.ZodString;
|
|
23
|
+
task: z.ZodString;
|
|
24
|
+
from: z.ZodString;
|
|
25
|
+
to: z.ZodString;
|
|
26
|
+
by: z.ZodString;
|
|
27
|
+
ts: z.ZodNumber;
|
|
28
|
+
exp: z.ZodNumber;
|
|
29
|
+
maxDepth: z.ZodNumber;
|
|
30
|
+
scope: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
31
|
+
parent: z.ZodOptional<z.ZodString>;
|
|
32
|
+
sig: z.ZodString;
|
|
33
|
+
}, z.core.$loose>;
|
|
34
|
+
export type DelegationGrant = z.infer<typeof DelegationGrant>;
|
|
35
|
+
/** Root first. Carried as `MessagePayload.delegation` on `kind: "task"` only. */
|
|
36
|
+
export declare const DelegationChain: z.ZodArray<z.ZodObject<{
|
|
37
|
+
realm: z.ZodString;
|
|
38
|
+
task: z.ZodString;
|
|
39
|
+
from: z.ZodString;
|
|
40
|
+
to: z.ZodString;
|
|
41
|
+
by: z.ZodString;
|
|
42
|
+
ts: z.ZodNumber;
|
|
43
|
+
exp: z.ZodNumber;
|
|
44
|
+
maxDepth: z.ZodNumber;
|
|
45
|
+
scope: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
46
|
+
parent: z.ZodOptional<z.ZodString>;
|
|
47
|
+
sig: z.ZodString;
|
|
48
|
+
}, z.core.$loose>>;
|
|
49
|
+
export type DelegationChain = z.infer<typeof DelegationChain>;
|
|
50
|
+
/** What a verified chain says, as the daemon shows it on `InboxItem.chain` and `TaskRecord.chain`. */
|
|
51
|
+
export declare const DelegationSummary: z.ZodObject<{
|
|
52
|
+
addresses: z.ZodArray<z.ZodString>;
|
|
53
|
+
depth: z.ZodNumber;
|
|
54
|
+
maxDepth: z.ZodNumber;
|
|
55
|
+
scope: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
56
|
+
exp: z.ZodNumber;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
export type DelegationSummary = z.infer<typeof DelegationSummary>;
|