@ghostlytools/sdk 0.0.0-stage → 1.2.3
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 -2
- package/dist/app.js +67 -0
- package/dist/app.js.map +1 -0
- package/dist/core.js +207 -0
- package/dist/core.js.map +1 -0
- package/dist/fakes-CBIuqo5e.js +536 -0
- package/dist/fakes-CBIuqo5e.js.map +1 -0
- package/dist/fakes.js +2 -0
- package/dist/index.js +179 -0
- package/dist/index.js.map +1 -0
- package/dist/keet-identity-key-BylxCPl4.js +76483 -0
- package/dist/keet-identity-key-BylxCPl4.js.map +1 -0
- package/dist/src-DCeLPsi-.js +31056 -0
- package/dist/src-DCeLPsi-.js.map +1 -0
- package/dist/testing.js +330 -0
- package/dist/testing.js.map +1 -0
- package/dist/types/browser/src/engine/paymentAdapters/providers/contractSuite.d.ts +41 -0
- package/dist/types/browser/src/engine/paymentAdapters/providers/lightning.d.ts +103 -0
- package/dist/types/browser/src/engine/paymentAdapters/providers/onchain.d.ts +88 -0
- package/dist/types/browser/src/engine/paymentAdapters/providers/testing.d.ts +89 -0
- package/dist/types/browser/src/engine/paymentAdapters/providers/types.d.ts +151 -0
- package/dist/types/browser/src/plugins/bundled.d.ts +8 -0
- package/dist/types/browser/src/plugins/registry.d.ts +57 -0
- package/dist/types/browser/src/proofs/contract.d.ts +262 -0
- package/dist/types/browser/src/proofs/contractSuite.d.ts +27 -0
- package/dist/types/browser/src/proofs/testing.d.ts +36 -0
- package/dist/types/browser/src/proofs/verify.d.ts +23 -0
- package/dist/types/browser/src/shared/mints.d.ts +50 -0
- package/dist/types/core/src/appBundle.d.ts +173 -0
- package/dist/types/core/src/appStatements.d.ts +142 -0
- package/dist/types/core/src/appStore.d.ts +133 -0
- package/dist/types/core/src/appUpdates.d.ts +88 -0
- package/dist/types/core/src/atprotoIdentity.d.ts +49 -0
- package/dist/types/core/src/atprotoRepo.d.ts +101 -0
- package/dist/types/core/src/avatar.d.ts +19 -0
- package/dist/types/core/src/bip322.d.ts +57 -0
- package/dist/types/core/src/bitcoinAddress.d.ts +5 -0
- package/dist/types/core/src/bitcoinMessage.d.ts +15 -0
- package/dist/types/core/src/bitcoinScript.d.ts +69 -0
- package/dist/types/core/src/bolt11.d.ts +30 -0
- package/dist/types/core/src/bytes.d.ts +11 -0
- package/dist/types/core/src/callSignal.d.ts +232 -0
- package/dist/types/core/src/canonicalJson.d.ts +22 -0
- package/dist/types/core/src/capsRecord.d.ts +234 -0
- package/dist/types/core/src/catchUp.d.ts +45 -0
- package/dist/types/core/src/chatFiles.d.ts +271 -0
- package/dist/types/core/src/clockWatch.d.ts +72 -0
- package/dist/types/core/src/communityRendezvous.d.ts +113 -0
- package/dist/types/core/src/crypto.d.ts +10 -0
- package/dist/types/core/src/datalink.d.ts +187 -0
- package/dist/types/core/src/deviceInvite.d.ts +51 -0
- package/dist/types/core/src/deviceLink.d.ts +70 -0
- package/dist/types/core/src/dhtDelivery.d.ts +403 -0
- package/dist/types/core/src/dhtFiles.d.ts +46 -0
- package/dist/types/core/src/did.d.ts +134 -0
- package/dist/types/core/src/didDht.d.ts +155 -0
- package/dist/types/core/src/directPath.d.ts +63 -0
- package/dist/types/core/src/dns.d.ts +41 -0
- package/dist/types/core/src/domainProofs.d.ts +88 -0
- package/dist/types/core/src/engineErrors.d.ts +90 -0
- package/dist/types/core/src/enroll.d.ts +98 -0
- package/dist/types/core/src/files.d.ts +73 -0
- package/dist/types/core/src/forwards.d.ts +12 -0
- package/dist/types/core/src/frames.d.ts +211 -0
- package/dist/types/core/src/ghostlink.d.ts +1510 -0
- package/dist/types/core/src/groupCommits.d.ts +103 -0
- package/dist/types/core/src/groupCommunity.d.ts +714 -0
- package/dist/types/core/src/groupCrypto.d.ts +60 -0
- package/dist/types/core/src/groupEdits.d.ts +67 -0
- package/dist/types/core/src/groupEntry.d.ts +61 -0
- package/dist/types/core/src/groupFiles.d.ts +106 -0
- package/dist/types/core/src/groupHubs.d.ts +61 -0
- package/dist/types/core/src/groupMentions.d.ts +27 -0
- package/dist/types/core/src/groupMeta.d.ts +162 -0
- package/dist/types/core/src/groupSession.d.ts +710 -0
- package/dist/types/core/src/groupSignals.d.ts +167 -0
- package/dist/types/core/src/groupTyping.d.ts +56 -0
- package/dist/types/core/src/groupWake.d.ts +68 -0
- package/dist/types/core/src/handoff.d.ts +255 -0
- package/dist/types/core/src/http.d.ts +125 -0
- package/dist/types/core/src/identity.d.ts +17 -0
- package/dist/types/core/src/identityProofs.d.ts +243 -0
- package/dist/types/core/src/identityTimeline.d.ts +72 -0
- package/dist/types/core/src/image.d.ts +33 -0
- package/dist/types/core/src/index.d.ts +100 -0
- package/dist/types/core/src/invite.d.ts +128 -0
- package/dist/types/core/src/link.d.ts +353 -0
- package/dist/types/core/src/linkPreview.d.ts +60 -0
- package/dist/types/core/src/linkTrace.d.ts +12 -0
- package/dist/types/core/src/lnurl.d.ts +99 -0
- package/dist/types/core/src/messageTime.d.ts +28 -0
- package/dist/types/core/src/miniApp.d.ts +141 -0
- package/dist/types/core/src/pairedApps.d.ts +151 -0
- package/dist/types/core/src/pairedCalls.d.ts +59 -0
- package/dist/types/core/src/pairedCapabilities.d.ts +101 -0
- package/dist/types/core/src/pairedEdits.d.ts +83 -0
- package/dist/types/core/src/pairedFiles.d.ts +30 -0
- package/dist/types/core/src/pairedHttp.d.ts +15 -0
- package/dist/types/core/src/pairedSession.d.ts +163 -0
- package/dist/types/core/src/pairedSignal.d.ts +17 -0
- package/dist/types/core/src/pairedTransports.d.ts +76 -0
- package/dist/types/core/src/pairedTyping.d.ts +130 -0
- package/dist/types/core/src/pairedWake.d.ts +109 -0
- package/dist/types/core/src/pairingProgress.d.ts +107 -0
- package/dist/types/core/src/paymentIntent.d.ts +111 -0
- package/dist/types/core/src/paymentUri.d.ts +34 -0
- package/dist/types/core/src/payments.d.ts +97 -0
- package/dist/types/core/src/peerProofs.d.ts +98 -0
- package/dist/types/core/src/pins.d.ts +73 -0
- package/dist/types/core/src/pkarr.d.ts +48 -0
- package/dist/types/core/src/pkdns.d.ts +35 -0
- package/dist/types/core/src/pubkyProofs.d.ts +25 -0
- package/dist/types/core/src/pubkyRing.d.ts +21 -0
- package/dist/types/core/src/reactions.d.ts +108 -0
- package/dist/types/core/src/records.d.ts +89 -0
- package/dist/types/core/src/relay.d.ts +437 -0
- package/dist/types/core/src/relayBreaker.d.ts +99 -0
- package/dist/types/core/src/replies.d.ts +41 -0
- package/dist/types/core/src/services.d.ts +35 -0
- package/dist/types/core/src/setUpdate.d.ts +53 -0
- package/dist/types/core/src/signal.d.ts +53 -0
- package/dist/types/core/src/signer.d.ts +13 -0
- package/dist/types/core/src/sparkAddress.d.ts +37 -0
- package/dist/types/core/src/sshsig.d.ts +74 -0
- package/dist/types/core/src/statusCards.d.ts +253 -0
- package/dist/types/core/src/storeForward.d.ts +144 -0
- package/dist/types/core/src/text.d.ts +20 -0
- package/dist/types/core/src/transport.d.ts +151 -0
- package/dist/types/core/src/transportSwitch.d.ts +160 -0
- package/dist/types/core/src/turnRead.d.ts +145 -0
- package/dist/types/core/src/turnRecord.d.ts +165 -0
- package/dist/types/core/src/version.d.ts +9 -0
- package/dist/types/core/src/video.d.ts +44 -0
- package/dist/types/core/src/voice.d.ts +88 -0
- package/dist/types/core/src/webPush.d.ts +58 -0
- package/dist/types/sdk/src/app.d.ts +23 -0
- package/dist/types/sdk/src/core.d.ts +7 -0
- package/dist/types/sdk/src/fakes.d.ts +6 -0
- package/dist/types/sdk/src/index.d.ts +26 -0
- package/dist/types/sdk/src/testing.d.ts +7 -0
- package/dist/types-DvtCy3WB.js +99 -0
- package/dist/types-DvtCy3WB.js.map +1 -0
- package/dist/verify-DBGw6wYt.js +106 -0
- package/dist/verify-DBGw6wYt.js.map +1 -0
- package/package.json +70 -4
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Membership of a `group-mesh/1` group is a chain of signed commits. Each
|
|
3
|
+
* commit carries the whole roster after it, so any member can name the roster
|
|
4
|
+
* of any epoch from the chain alone; the chain, from its genesis, is what
|
|
5
|
+
* authenticates a roster to a member who was not there for the changes.
|
|
6
|
+
*
|
|
7
|
+
* Exactly one admin per epoch (the coordinator of WISP 900): every commit is
|
|
8
|
+
* signed by the admin of the previous epoch, and admission of a new member,
|
|
9
|
+
* removal, transfer of the admin role and a bare rotation each advance the
|
|
10
|
+
* epoch by one. Two different commits after the same epoch are a fork, which
|
|
11
|
+
* halts the group rather than picking a winner.
|
|
12
|
+
*/
|
|
13
|
+
export type GroupRole = "admin" | "member";
|
|
14
|
+
export type CommitKind = "create" | "add" | "remove" | "role" | "rotate";
|
|
15
|
+
export type Roster = [key: string, role: GroupRole][];
|
|
16
|
+
export interface GroupCommit {
|
|
17
|
+
v: 1;
|
|
18
|
+
/** Group id: 22 base64url characters. */
|
|
19
|
+
g: string;
|
|
20
|
+
/** Epoch: the commit's index in the chain, from 0. */
|
|
21
|
+
e: number;
|
|
22
|
+
/** Hash of the previous commit; empty for the genesis. */
|
|
23
|
+
p: string;
|
|
24
|
+
k: CommitKind;
|
|
25
|
+
/** The roster after this commit, sorted by key. */
|
|
26
|
+
m: Roster;
|
|
27
|
+
/** The committer. */
|
|
28
|
+
by: string;
|
|
29
|
+
/** The member added, removed or made admin. */
|
|
30
|
+
s?: string;
|
|
31
|
+
ts: number;
|
|
32
|
+
/** Confirmation tag: HMAC of the untagged commit under the new epoch's confirm key. */
|
|
33
|
+
c: string;
|
|
34
|
+
sig: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Members a roster may hold. Apps from before revision 0.9 of the profile refuse a commit whose roster is larger than
|
|
38
|
+
* `LEGACY_GROUP_MEMBERS` (as malformed), so an admin grows a group past that only when every member's app said it can
|
|
39
|
+
* (`paired-groups` version `GROUP_VERSION_LARGE`).
|
|
40
|
+
*/
|
|
41
|
+
export declare const MAX_GROUP_MEMBERS = 32;
|
|
42
|
+
export declare const LEGACY_GROUP_MEMBERS = 8;
|
|
43
|
+
/**
|
|
44
|
+
* The cap the chain rules and the engine apply: `MAX_GROUP_MEMBERS`, always, in the apps. Only the scale harness raises
|
|
45
|
+
* it, to measure what hubs would cost past 32 (WISP 902 · Group Mesh § Cost per member); an app never does.
|
|
46
|
+
*/
|
|
47
|
+
export declare const GROUP_MEMBER_CAP: {
|
|
48
|
+
max: number;
|
|
49
|
+
};
|
|
50
|
+
/** The `paired-groups` version an app announces when it takes mesh rosters of up to `MAX_GROUP_MEMBERS`. */
|
|
51
|
+
export declare const GROUP_VERSION_LARGE = 3;
|
|
52
|
+
export declare const MAX_GROUP_CHAIN = 1024;
|
|
53
|
+
export declare const GROUP_ID: RegExp;
|
|
54
|
+
export declare const MEMBER_KEY: RegExp;
|
|
55
|
+
export declare function commitHash(commit: Omit<GroupCommit, "sig">): string;
|
|
56
|
+
/** What the confirmation tag covers: the commit with an empty tag. */
|
|
57
|
+
export declare function commitUntaggedHash(commit: Omit<GroupCommit, "sig" | "c">): string;
|
|
58
|
+
export declare function signCommit(commit: Omit<GroupCommit, "sig">, seed: Uint8Array): GroupCommit;
|
|
59
|
+
export declare function rosterAdmin(roster: Roster): string | undefined;
|
|
60
|
+
export declare function rosterHas(roster: Roster, key: string): boolean;
|
|
61
|
+
export declare const sortRoster: (roster: Roster) => Roster;
|
|
62
|
+
/** The roster a commit must carry, given the previous one; null when the change is not allowed. */
|
|
63
|
+
export declare function expectedRoster(previous: Roster | null, kind: CommitKind, by: string, subject?: string): Roster | null;
|
|
64
|
+
/**
|
|
65
|
+
* Checks one commit against the chain so far (`previous` is its last commit,
|
|
66
|
+
* or null for a genesis): index, link, authority, roster arithmetic and
|
|
67
|
+
* signature. The confirmation tag is checked separately, once the secret is known.
|
|
68
|
+
*/
|
|
69
|
+
export declare function verifyCommit(raw: unknown, previous: GroupCommit | null, groupId?: string): {
|
|
70
|
+
commit: GroupCommit;
|
|
71
|
+
} | {
|
|
72
|
+
error: string;
|
|
73
|
+
};
|
|
74
|
+
/** Only shape and signature: evidence that `by` signed this, whatever chain it belongs to. */
|
|
75
|
+
export declare function verifyCommitSignature(raw: unknown): GroupCommit | null;
|
|
76
|
+
/** A whole chain, from genesis. */
|
|
77
|
+
export declare function verifyChain(raw: unknown, groupId?: string): {
|
|
78
|
+
chain: GroupCommit[];
|
|
79
|
+
} | {
|
|
80
|
+
error: string;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* What a commit is refused with while admin work is off on this device (WISP 06 § Forced takeover: after a forced
|
|
84
|
+
* takeover or a restore, until the person turns on "Manage groups from this device").
|
|
85
|
+
*/
|
|
86
|
+
/**
|
|
87
|
+
* The highest sequence number a frame of my own key, sent by another copy of my profile, may make me adopt (WISP 06):
|
|
88
|
+
* the highest floor a copy can have (2^32 - 2^24) and room above it. The community beacon packs the counter in 32 bits.
|
|
89
|
+
*/
|
|
90
|
+
export declare const OWN_FRAME_LIMIT: number;
|
|
91
|
+
/**
|
|
92
|
+
* Frames said again (WISP 902, both profiles): a member's own frames that no edge took when it said them are
|
|
93
|
+
* remembered (`kept`, the latest) and, once the chain it follows is newer than such a frame's and has not moved for
|
|
94
|
+
* `settledMs`, looked at once for saying again where the members let in while it was behind can read them. A catch-up
|
|
95
|
+
* brings commits one by one, and a frame said again at the first of them would still miss those let in by the next.
|
|
96
|
+
*/
|
|
97
|
+
export declare const SAID_AGAIN: {
|
|
98
|
+
readonly settledMs: 5000;
|
|
99
|
+
readonly kept: 64;
|
|
100
|
+
};
|
|
101
|
+
/** `alone` with `key` added last, keeping only keys still `present` (frames still in the log), the latest `kept`. */
|
|
102
|
+
export declare function rememberAlone(alone: readonly string[] | undefined, key: string, present: (key: string) => boolean): string[];
|
|
103
|
+
export declare const GROUP_ADMIN_OFF_ERROR = "Managing this group is off on this device. Turn on Manage groups from this device first.";
|