@pomade/core 0.0.12 → 0.1.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/dist/client.d.ts +141 -19
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +70 -184
- package/dist/client.js.map +1 -1
- package/dist/message.d.ts +26 -259
- package/dist/message.d.ts.map +1 -1
- package/dist/message.js +1 -127
- package/dist/message.js.map +1 -1
- package/dist/pomade-signer.d.ts +0 -1
- package/dist/pomade-signer.d.ts.map +1 -1
- package/dist/pomade-signer.js +1 -4
- package/dist/pomade-signer.js.map +1 -1
- package/dist/rpc.d.ts +6 -46
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +31 -187
- package/dist/rpc.js.map +1 -1
- package/dist/schema.d.ts +78 -126
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +67 -105
- package/dist/schema.js.map +1 -1
- package/dist/signer.d.ts +26 -43
- package/dist/signer.d.ts.map +1 -1
- package/dist/signer.js +224 -368
- package/dist/signer.js.map +1 -1
- package/dist/storage.d.ts +2 -5
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +1 -1
- package/dist/storage.js.map +1 -1
- package/dist/util.d.ts +4 -26
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +13 -57
- package/dist/util.js.map +1 -1
- package/package.json +1 -1
package/dist/rpc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,cAAc,CAAA;AAEzC,qBAAa,GAAG;IAGK,MAAM,EAAE,OAAO;IAFlC,MAAM,CAAC,KAAK,eAAoC;gBAE7B,MAAM,EAAE,OAAO;IAElC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM;IAI1B,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM;IAWtD,IAAI,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CAwBjG"}
|
package/dist/rpc.js
CHANGED
|
@@ -1,199 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { publish, request, PublishStatus } from "@welshman/net";
|
|
3
|
-
import { prep, makePow } from "@welshman/util";
|
|
1
|
+
import { prep, makePow, makeHttpAuth, makeHttpAuthHeader } from "@welshman/util";
|
|
4
2
|
import { Nip01Signer } from "@welshman/signer";
|
|
5
|
-
import { debug, fetchRelays, normalizeRelay } from "./util.js";
|
|
6
|
-
import { parseMessage } from "./message.js";
|
|
7
|
-
// Base RPC class
|
|
8
|
-
export function rpc(signer) {
|
|
9
|
-
return new RPC(signer);
|
|
10
|
-
}
|
|
11
3
|
export class RPC {
|
|
12
4
|
signer;
|
|
13
|
-
static
|
|
14
|
-
|
|
15
|
-
subscribers = [];
|
|
16
|
-
controller = new AbortController();
|
|
17
|
-
channels = new Map();
|
|
18
|
-
static fromSecret(secret, relays = []) {
|
|
19
|
-
return new RPC(Nip01Signer.fromSecret(secret), relays);
|
|
20
|
-
}
|
|
21
|
-
constructor(signer, relays = []) {
|
|
5
|
+
static fetch = globalThis.fetch.bind(globalThis);
|
|
6
|
+
constructor(signer) {
|
|
22
7
|
this.signer = signer;
|
|
23
|
-
this.relays = relays.map(normalizeRelay);
|
|
24
|
-
this.publishRelays();
|
|
25
|
-
this.listenForEvents();
|
|
26
|
-
}
|
|
27
|
-
async publishRelays() {
|
|
28
|
-
if (this.relays.length > 0) {
|
|
29
|
-
debug("[rpc.publishRelays]", this.relays);
|
|
30
|
-
const pubkey = await this.signer.getPubkey();
|
|
31
|
-
const event = await this.signer.sign(prep({
|
|
32
|
-
kind: 10002,
|
|
33
|
-
content: "",
|
|
34
|
-
tags: this.relays.map(url => ["r", url]),
|
|
35
|
-
}, pubkey));
|
|
36
|
-
publish({
|
|
37
|
-
event,
|
|
38
|
-
relays: this.relays,
|
|
39
|
-
signal: this.controller.signal,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
8
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
9
|
+
static fromSecret(secret) {
|
|
10
|
+
return new RPC(Nip01Signer.fromSecret(secret));
|
|
11
|
+
}
|
|
12
|
+
async makeAuthHeader(url, body, pow) {
|
|
13
|
+
const template = await makeHttpAuth(url, "POST", body);
|
|
14
|
+
const prepped = prep(template, await this.signer.getPubkey());
|
|
15
|
+
const signed = pow
|
|
16
|
+
? await this.signer.sign(await makePow(prepped, pow).result)
|
|
17
|
+
: await this.signer.sign(prepped);
|
|
18
|
+
return makeHttpAuthHeader(signed);
|
|
19
|
+
}
|
|
20
|
+
async post(signerUrl, path, body, pow) {
|
|
21
|
+
const requestUrl = `${signerUrl}${path}`;
|
|
22
|
+
const bodyStr = JSON.stringify(body);
|
|
23
|
+
try {
|
|
24
|
+
const authHeader = await this.makeAuthHeader(requestUrl, bodyStr, pow);
|
|
25
|
+
const response = await RPC.fetch(requestUrl, {
|
|
26
|
+
method: "POST",
|
|
27
|
+
headers: {
|
|
28
|
+
"Content-Type": "application/json",
|
|
29
|
+
Authorization: authHeader,
|
|
30
|
+
},
|
|
31
|
+
body: bodyStr,
|
|
51
32
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
async read(event) {
|
|
55
|
-
const decrypted = await this.decrypt(event.pubkey, event.content);
|
|
56
|
-
const result = tryCatch(() => parseMessage(decrypted));
|
|
57
|
-
if (result) {
|
|
58
|
-
return { ...result, event };
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
async notify(event) {
|
|
62
|
-
const message = await this.read(event);
|
|
63
|
-
if (message) {
|
|
64
|
-
for (const subscriber of this.subscribers) {
|
|
65
|
-
subscriber(message);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
subscribe(handler) {
|
|
70
|
-
if (this.controller.signal.aborted) {
|
|
71
|
-
throw new Error("Attempted to subscribe to an rpc interface that has been closed");
|
|
72
|
-
}
|
|
73
|
-
this.subscribers.push(handler);
|
|
74
|
-
return () => this.subscribers.splice(this.subscribers.findIndex(s => s === handler), 1);
|
|
75
|
-
}
|
|
76
|
-
sign(event) {
|
|
77
|
-
return this.signer.sign(event);
|
|
78
|
-
}
|
|
79
|
-
encrypt(peer, payload) {
|
|
80
|
-
return this.signer.nip44.encrypt(peer, payload);
|
|
81
|
-
}
|
|
82
|
-
decrypt(peer, payload) {
|
|
83
|
-
return this.signer.nip44.decrypt(peer, payload);
|
|
84
|
-
}
|
|
85
|
-
channel(peer, usePeerRelays = true) {
|
|
86
|
-
let channel = this.channels.get(peer);
|
|
87
|
-
if (!channel) {
|
|
88
|
-
channel = new RPCChannel(this, peer, usePeerRelays);
|
|
89
|
-
this.channels.set(peer, channel);
|
|
90
|
-
}
|
|
91
|
-
return channel;
|
|
92
|
-
}
|
|
93
|
-
stop() {
|
|
94
|
-
for (const channel of this.channels.values()) {
|
|
95
|
-
channel.stop();
|
|
96
|
-
}
|
|
97
|
-
this.channels.clear();
|
|
98
|
-
this.controller.abort();
|
|
99
|
-
this.subscribers = [];
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
export class RPCChannel {
|
|
103
|
-
rpc;
|
|
104
|
-
peer;
|
|
105
|
-
usePeerRelays;
|
|
106
|
-
relays;
|
|
107
|
-
controller = new AbortController();
|
|
108
|
-
constructor(rpc, peer, usePeerRelays = true) {
|
|
109
|
-
this.rpc = rpc;
|
|
110
|
-
this.peer = peer;
|
|
111
|
-
this.usePeerRelays = usePeerRelays;
|
|
112
|
-
const { signal } = this.controller;
|
|
113
|
-
this.relays = usePeerRelays ? fetchRelays(peer, signal) : Promise.resolve([]);
|
|
114
|
-
Promise.all([this.relays, this.rpc.signer.getPubkey()]).then(([relays, pubkey]) => {
|
|
115
|
-
if (!signal.aborted) {
|
|
116
|
-
const uniqueRelays = without(this.rpc.relays, relays);
|
|
117
|
-
if (uniqueRelays.length > 0) {
|
|
118
|
-
request({
|
|
119
|
-
signal,
|
|
120
|
-
relays: uniqueRelays,
|
|
121
|
-
filters: [{ kinds: [RPC.Kind], authors: [this.peer], "#p": [pubkey] }],
|
|
122
|
-
onEvent: (event) => this.rpc.notify(event),
|
|
123
|
-
});
|
|
124
|
-
}
|
|
33
|
+
if (!response.ok) {
|
|
34
|
+
return { url: signerUrl };
|
|
125
35
|
}
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
subscribe(handler) {
|
|
129
|
-
if (this.controller.signal.aborted) {
|
|
130
|
-
throw new Error("Attempted to subscribe to a channel that has been closed");
|
|
36
|
+
return { url: signerUrl, res: (await response.json()) };
|
|
131
37
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
handler(message);
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
receive(handler) {
|
|
139
|
-
return new Promise((resolve, reject) => {
|
|
140
|
-
const unsubscribe = this.subscribe(async (message) => {
|
|
141
|
-
try {
|
|
142
|
-
handler(message, done);
|
|
143
|
-
}
|
|
144
|
-
catch (e) {
|
|
145
|
-
reject(e);
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
const done = (result) => {
|
|
149
|
-
clearTimeout(timeout);
|
|
150
|
-
resolve(result);
|
|
151
|
-
unsubscribe();
|
|
152
|
-
};
|
|
153
|
-
const timeout = setTimeout(done, 30_000);
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
async prep(message, pow) {
|
|
157
|
-
const pubkey = await this.rpc.signer.getPubkey();
|
|
158
|
-
const template = {
|
|
159
|
-
kind: RPC.Kind,
|
|
160
|
-
tags: [["p", this.peer]],
|
|
161
|
-
content: await this.encrypt(JSON.stringify(message)),
|
|
162
|
-
};
|
|
163
|
-
const prepped = prep(template, pubkey);
|
|
164
|
-
if (pow) {
|
|
165
|
-
return this.rpc.sign(await makePow(prepped, pow).result);
|
|
38
|
+
catch {
|
|
39
|
+
return { url: signerUrl };
|
|
166
40
|
}
|
|
167
|
-
return this.rpc.sign(prepped);
|
|
168
|
-
}
|
|
169
|
-
encrypt(payload) {
|
|
170
|
-
return this.rpc.encrypt(this.peer, payload);
|
|
171
|
-
}
|
|
172
|
-
decrypt(payload) {
|
|
173
|
-
return this.rpc.decrypt(this.peer, payload);
|
|
174
|
-
}
|
|
175
|
-
send(message, pow) {
|
|
176
|
-
const controller = new AbortController();
|
|
177
|
-
const abort = () => controller.abort();
|
|
178
|
-
const eventPromise = this.prep(message, pow);
|
|
179
|
-
const relaysPromise = this.relays;
|
|
180
|
-
const res = Promise.all([eventPromise, relaysPromise]).then(([event, relays]) => publish({
|
|
181
|
-
event,
|
|
182
|
-
relays: uniq([...relays, ...this.rpc.relays]),
|
|
183
|
-
signal: AbortSignal.any([this.controller.signal, controller.signal]),
|
|
184
|
-
}));
|
|
185
|
-
const ok = res.then(r => {
|
|
186
|
-
return Object.values(r).some(spec({ status: PublishStatus.Success }));
|
|
187
|
-
});
|
|
188
|
-
const receive = (handler) => eventPromise.then(event => this.receive((message, resolve) => {
|
|
189
|
-
if (message.payload.prev === event.id) {
|
|
190
|
-
handler(message, resolve);
|
|
191
|
-
}
|
|
192
|
-
}));
|
|
193
|
-
return { abort, res, ok, receive };
|
|
194
|
-
}
|
|
195
|
-
stop() {
|
|
196
|
-
this.controller.abort();
|
|
197
41
|
}
|
|
198
42
|
}
|
|
199
43
|
//# sourceMappingURL=rpc.js.map
|
package/dist/rpc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc.js","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rpc.js","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAA;AAC9E,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAA;AAI5C,MAAM,OAAO,GAAG;IAGK;IAFnB,MAAM,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IAEhD,YAAmB,MAAe;QAAf,WAAM,GAAN,MAAM,CAAS;IAAG,CAAC;IAEtC,MAAM,CAAC,UAAU,CAAC,MAAc;QAC9B,OAAO,IAAI,GAAG,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAA;IAChD,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,GAAW,EAAE,IAAY,EAAE,GAAY;QAC1D,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;QACtD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAA;QAE7D,MAAM,MAAM,GAAG,GAAG;YAChB,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC;YAC5D,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAEnC,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACnC,CAAC;IAED,KAAK,CAAC,IAAI,CAAI,SAAiB,EAAE,IAAY,EAAE,IAAa,EAAE,GAAY;QACxE,MAAM,UAAU,GAAG,GAAG,SAAS,GAAG,IAAI,EAAE,CAAA;QACxC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;QACpC,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,EAAE,GAAG,CAAC,CAAA;YAEtE,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,UAAU,EAAE;gBAC3C,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,aAAa,EAAE,UAAU;iBAC1B;gBACD,IAAI,EAAE,OAAO;aACd,CAAC,CAAA;YAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,OAAO,EAAC,GAAG,EAAE,SAAS,EAAC,CAAA;YACzB,CAAC;YAED,OAAO,EAAC,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAM,EAAC,CAAA;QAC5D,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAC,GAAG,EAAE,SAAS,EAAC,CAAA;QACzB,CAAC;IACH,CAAC"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
-
export declare enum Method {
|
|
3
|
-
ChallengeRequest = "challenge/request",
|
|
4
|
-
EcdhRequest = "ecdh/request",
|
|
5
|
-
EcdhResult = "ecdh/result",
|
|
6
|
-
LoginStart = "login/start",
|
|
7
|
-
LoginOptions = "login/options",
|
|
8
|
-
LoginSelect = "login/select",
|
|
9
|
-
LoginResult = "login/result",
|
|
10
|
-
RecoveryStart = "recovery/start",
|
|
11
|
-
RecoveryOptions = "recovery/options",
|
|
12
|
-
RecoverySelect = "recovery/select",
|
|
13
|
-
RecoveryResult = "recovery/result",
|
|
14
|
-
RecoverySetup = "recovery/setup",
|
|
15
|
-
RecoverySetupResult = "recovery/setup/result",
|
|
16
|
-
RegisterRequest = "register/request",
|
|
17
|
-
RegisterResult = "register/result",
|
|
18
|
-
SessionDelete = "session/delete",
|
|
19
|
-
SessionDeleteResult = "session/delete/result",
|
|
20
|
-
SessionList = "session/list",
|
|
21
|
-
SessionListResult = "session/list/result",
|
|
22
|
-
SignRequest = "sign/request",
|
|
23
|
-
SignResult = "sign/result"
|
|
24
|
-
}
|
|
25
2
|
declare const sessionItem: z.ZodObject<{
|
|
26
3
|
pubkey: z.ZodString;
|
|
27
4
|
client: z.ZodString;
|
|
@@ -54,27 +31,82 @@ export type Auth = z.infer<typeof auth>;
|
|
|
54
31
|
export declare const isPasswordAuth: (auth: Auth) => auth is PasswordAuth;
|
|
55
32
|
export declare const isOTPAuth: (auth: Auth) => auth is OTPAuth;
|
|
56
33
|
export declare const Schema: {
|
|
34
|
+
registerRequest: z.ZodObject<{
|
|
35
|
+
share: z.ZodObject<{
|
|
36
|
+
idx: z.ZodNumber;
|
|
37
|
+
binder_sn: z.ZodString;
|
|
38
|
+
hidden_sn: z.ZodString;
|
|
39
|
+
seckey: z.ZodString;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
group: z.ZodObject<{
|
|
42
|
+
commits: z.ZodArray<z.ZodObject<{
|
|
43
|
+
idx: z.ZodNumber;
|
|
44
|
+
pubkey: z.ZodString;
|
|
45
|
+
hidden_pn: z.ZodString;
|
|
46
|
+
binder_pn: z.ZodString;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
group_pk: z.ZodString;
|
|
49
|
+
threshold: z.ZodNumber;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
recovery: z.ZodBoolean;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
registerResponse: z.ZodObject<{
|
|
54
|
+
ok: z.ZodBoolean;
|
|
55
|
+
message: z.ZodString;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
signRequest: z.ZodObject<{
|
|
58
|
+
request: z.ZodObject<{
|
|
59
|
+
content: z.ZodNullable<z.ZodString>;
|
|
60
|
+
hashes: z.ZodArray<z.ZodTuple<[z.ZodString], z.ZodString>>;
|
|
61
|
+
members: z.ZodArray<z.ZodNumber>;
|
|
62
|
+
stamp: z.ZodNumber;
|
|
63
|
+
type: z.ZodString;
|
|
64
|
+
gid: z.ZodString;
|
|
65
|
+
sid: z.ZodString;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
signResponse: z.ZodObject<{
|
|
69
|
+
ok: z.ZodBoolean;
|
|
70
|
+
message: z.ZodString;
|
|
71
|
+
result: z.ZodOptional<z.ZodObject<{
|
|
72
|
+
idx: z.ZodNumber;
|
|
73
|
+
psigs: z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
|
|
74
|
+
pubkey: z.ZodString;
|
|
75
|
+
sid: z.ZodString;
|
|
76
|
+
}, z.core.$strip>>;
|
|
77
|
+
}, z.core.$strip>;
|
|
57
78
|
ecdhRequest: z.ZodObject<{
|
|
58
79
|
idx: z.ZodNumber;
|
|
59
80
|
members: z.ZodArray<z.ZodNumber>;
|
|
60
81
|
ecdh_pk: z.ZodString;
|
|
61
82
|
}, z.core.$strip>;
|
|
62
|
-
|
|
83
|
+
ecdhResponse: z.ZodObject<{
|
|
84
|
+
ok: z.ZodBoolean;
|
|
85
|
+
message: z.ZodString;
|
|
63
86
|
result: z.ZodOptional<z.ZodObject<{
|
|
64
87
|
idx: z.ZodNumber;
|
|
65
88
|
keyshare: z.ZodString;
|
|
66
89
|
members: z.ZodArray<z.ZodNumber>;
|
|
67
90
|
ecdh_pk: z.ZodString;
|
|
68
91
|
}, z.core.$strip>>;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
recoverySetupRequest: z.ZodObject<{
|
|
94
|
+
email: z.ZodString;
|
|
95
|
+
password_hash: z.ZodString;
|
|
96
|
+
}, z.core.$strip>;
|
|
97
|
+
recoverySetupResponse: z.ZodObject<{
|
|
69
98
|
ok: z.ZodBoolean;
|
|
70
99
|
message: z.ZodString;
|
|
71
|
-
prev: z.ZodString;
|
|
72
100
|
}, z.core.$strip>;
|
|
73
101
|
challengeRequest: z.ZodObject<{
|
|
74
102
|
prefix: z.ZodString;
|
|
75
103
|
email_hash: z.ZodString;
|
|
76
104
|
}, z.core.$strip>;
|
|
77
|
-
|
|
105
|
+
challengeResponse: z.ZodObject<{
|
|
106
|
+
ok: z.ZodLiteral<true>;
|
|
107
|
+
message: z.ZodString;
|
|
108
|
+
}, z.core.$strip>;
|
|
109
|
+
loginStartRequest: z.ZodObject<{
|
|
78
110
|
auth: z.ZodUnion<readonly [z.ZodObject<{
|
|
79
111
|
email_hash: z.ZodString;
|
|
80
112
|
password_hash: z.ZodString;
|
|
@@ -83,7 +115,9 @@ export declare const Schema: {
|
|
|
83
115
|
otp: z.ZodString;
|
|
84
116
|
}, z.core.$strip>]>;
|
|
85
117
|
}, z.core.$strip>;
|
|
86
|
-
|
|
118
|
+
loginStartResponse: z.ZodObject<{
|
|
119
|
+
ok: z.ZodBoolean;
|
|
120
|
+
message: z.ZodString;
|
|
87
121
|
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
88
122
|
pubkey: z.ZodString;
|
|
89
123
|
client: z.ZodString;
|
|
@@ -94,14 +128,13 @@ export declare const Schema: {
|
|
|
94
128
|
idx: z.ZodNumber;
|
|
95
129
|
email: z.ZodOptional<z.ZodString>;
|
|
96
130
|
}, z.core.$strip>>>;
|
|
97
|
-
ok: z.ZodBoolean;
|
|
98
|
-
message: z.ZodString;
|
|
99
|
-
prev: z.ZodString;
|
|
100
131
|
}, z.core.$strip>;
|
|
101
|
-
|
|
132
|
+
loginSelectRequest: z.ZodObject<{
|
|
102
133
|
client: z.ZodString;
|
|
103
134
|
}, z.core.$strip>;
|
|
104
|
-
|
|
135
|
+
loginSelectResponse: z.ZodObject<{
|
|
136
|
+
ok: z.ZodBoolean;
|
|
137
|
+
message: z.ZodString;
|
|
105
138
|
group: z.ZodOptional<z.ZodObject<{
|
|
106
139
|
commits: z.ZodArray<z.ZodObject<{
|
|
107
140
|
idx: z.ZodNumber;
|
|
@@ -112,11 +145,8 @@ export declare const Schema: {
|
|
|
112
145
|
group_pk: z.ZodString;
|
|
113
146
|
threshold: z.ZodNumber;
|
|
114
147
|
}, z.core.$strip>>;
|
|
115
|
-
ok: z.ZodBoolean;
|
|
116
|
-
message: z.ZodString;
|
|
117
|
-
prev: z.ZodString;
|
|
118
148
|
}, z.core.$strip>;
|
|
119
|
-
|
|
149
|
+
recoveryStartRequest: z.ZodObject<{
|
|
120
150
|
auth: z.ZodUnion<readonly [z.ZodObject<{
|
|
121
151
|
email_hash: z.ZodString;
|
|
122
152
|
password_hash: z.ZodString;
|
|
@@ -125,7 +155,9 @@ export declare const Schema: {
|
|
|
125
155
|
otp: z.ZodString;
|
|
126
156
|
}, z.core.$strip>]>;
|
|
127
157
|
}, z.core.$strip>;
|
|
128
|
-
|
|
158
|
+
recoveryStartResponse: z.ZodObject<{
|
|
159
|
+
ok: z.ZodBoolean;
|
|
160
|
+
message: z.ZodString;
|
|
129
161
|
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
130
162
|
pubkey: z.ZodString;
|
|
131
163
|
client: z.ZodString;
|
|
@@ -136,14 +168,13 @@ export declare const Schema: {
|
|
|
136
168
|
idx: z.ZodNumber;
|
|
137
169
|
email: z.ZodOptional<z.ZodString>;
|
|
138
170
|
}, z.core.$strip>>>;
|
|
139
|
-
ok: z.ZodBoolean;
|
|
140
|
-
message: z.ZodString;
|
|
141
|
-
prev: z.ZodString;
|
|
142
171
|
}, z.core.$strip>;
|
|
143
|
-
|
|
172
|
+
recoverySelectRequest: z.ZodObject<{
|
|
144
173
|
client: z.ZodString;
|
|
145
174
|
}, z.core.$strip>;
|
|
146
|
-
|
|
175
|
+
recoverySelectResponse: z.ZodObject<{
|
|
176
|
+
ok: z.ZodBoolean;
|
|
177
|
+
message: z.ZodString;
|
|
147
178
|
share: z.ZodOptional<z.ZodObject<{
|
|
148
179
|
idx: z.ZodNumber;
|
|
149
180
|
binder_sn: z.ZodString;
|
|
@@ -160,72 +191,11 @@ export declare const Schema: {
|
|
|
160
191
|
group_pk: z.ZodString;
|
|
161
192
|
threshold: z.ZodNumber;
|
|
162
193
|
}, z.core.$strip>>;
|
|
163
|
-
ok: z.ZodBoolean;
|
|
164
|
-
message: z.ZodString;
|
|
165
|
-
prev: z.ZodString;
|
|
166
194
|
}, z.core.$strip>;
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
password_hash: z.ZodString;
|
|
170
|
-
}, z.core.$strip>;
|
|
171
|
-
recoverySetupResult: z.ZodObject<{
|
|
195
|
+
sessionListRequest: z.ZodObject<{}, z.core.$strip>;
|
|
196
|
+
sessionListResponse: z.ZodObject<{
|
|
172
197
|
ok: z.ZodBoolean;
|
|
173
198
|
message: z.ZodString;
|
|
174
|
-
prev: z.ZodString;
|
|
175
|
-
}, z.core.$strip>;
|
|
176
|
-
registerRequest: z.ZodObject<{
|
|
177
|
-
share: z.ZodObject<{
|
|
178
|
-
idx: z.ZodNumber;
|
|
179
|
-
binder_sn: z.ZodString;
|
|
180
|
-
hidden_sn: z.ZodString;
|
|
181
|
-
seckey: z.ZodString;
|
|
182
|
-
}, z.core.$strip>;
|
|
183
|
-
group: z.ZodObject<{
|
|
184
|
-
commits: z.ZodArray<z.ZodObject<{
|
|
185
|
-
idx: z.ZodNumber;
|
|
186
|
-
pubkey: z.ZodString;
|
|
187
|
-
hidden_pn: z.ZodString;
|
|
188
|
-
binder_pn: z.ZodString;
|
|
189
|
-
}, z.core.$strip>>;
|
|
190
|
-
group_pk: z.ZodString;
|
|
191
|
-
threshold: z.ZodNumber;
|
|
192
|
-
}, z.core.$strip>;
|
|
193
|
-
recovery: z.ZodBoolean;
|
|
194
|
-
}, z.core.$strip>;
|
|
195
|
-
registerResult: z.ZodObject<{
|
|
196
|
-
ok: z.ZodBoolean;
|
|
197
|
-
message: z.ZodString;
|
|
198
|
-
prev: z.ZodString;
|
|
199
|
-
}, z.core.$strip>;
|
|
200
|
-
sessionDelete: z.ZodObject<{
|
|
201
|
-
client: z.ZodString;
|
|
202
|
-
auth: z.ZodObject<{
|
|
203
|
-
sig: z.ZodString;
|
|
204
|
-
id: z.ZodString;
|
|
205
|
-
pubkey: z.ZodString;
|
|
206
|
-
kind: z.ZodInt;
|
|
207
|
-
tags: z.ZodArray<z.ZodArray<z.ZodString>>;
|
|
208
|
-
content: z.ZodString;
|
|
209
|
-
created_at: z.ZodInt;
|
|
210
|
-
}, z.core.$strip>;
|
|
211
|
-
}, z.core.$strip>;
|
|
212
|
-
sessionDeleteResult: z.ZodObject<{
|
|
213
|
-
ok: z.ZodBoolean;
|
|
214
|
-
message: z.ZodString;
|
|
215
|
-
prev: z.ZodString;
|
|
216
|
-
}, z.core.$strip>;
|
|
217
|
-
sessionList: z.ZodObject<{
|
|
218
|
-
auth: z.ZodObject<{
|
|
219
|
-
sig: z.ZodString;
|
|
220
|
-
id: z.ZodString;
|
|
221
|
-
pubkey: z.ZodString;
|
|
222
|
-
kind: z.ZodInt;
|
|
223
|
-
tags: z.ZodArray<z.ZodArray<z.ZodString>>;
|
|
224
|
-
content: z.ZodString;
|
|
225
|
-
created_at: z.ZodInt;
|
|
226
|
-
}, z.core.$strip>;
|
|
227
|
-
}, z.core.$strip>;
|
|
228
|
-
sessionListResult: z.ZodObject<{
|
|
229
199
|
items: z.ZodArray<z.ZodObject<{
|
|
230
200
|
pubkey: z.ZodString;
|
|
231
201
|
client: z.ZodString;
|
|
@@ -236,31 +206,13 @@ export declare const Schema: {
|
|
|
236
206
|
idx: z.ZodNumber;
|
|
237
207
|
email: z.ZodOptional<z.ZodString>;
|
|
238
208
|
}, z.core.$strip>>;
|
|
239
|
-
ok: z.ZodBoolean;
|
|
240
|
-
message: z.ZodString;
|
|
241
|
-
prev: z.ZodString;
|
|
242
209
|
}, z.core.$strip>;
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
content: z.ZodNullable<z.ZodString>;
|
|
246
|
-
hashes: z.ZodArray<z.ZodTuple<[z.ZodString], z.ZodString>>;
|
|
247
|
-
members: z.ZodArray<z.ZodNumber>;
|
|
248
|
-
stamp: z.ZodNumber;
|
|
249
|
-
type: z.ZodString;
|
|
250
|
-
gid: z.ZodString;
|
|
251
|
-
sid: z.ZodString;
|
|
252
|
-
}, z.core.$strip>;
|
|
210
|
+
sessionDeleteRequest: z.ZodObject<{
|
|
211
|
+
client: z.ZodString;
|
|
253
212
|
}, z.core.$strip>;
|
|
254
|
-
|
|
255
|
-
result: z.ZodOptional<z.ZodObject<{
|
|
256
|
-
idx: z.ZodNumber;
|
|
257
|
-
psigs: z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
|
|
258
|
-
pubkey: z.ZodString;
|
|
259
|
-
sid: z.ZodString;
|
|
260
|
-
}, z.core.$strip>>;
|
|
213
|
+
sessionDeleteResponse: z.ZodObject<{
|
|
261
214
|
ok: z.ZodBoolean;
|
|
262
215
|
message: z.ZodString;
|
|
263
|
-
prev: z.ZodString;
|
|
264
216
|
}, z.core.$strip>;
|
|
265
217
|
};
|
|
266
218
|
export {};
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AA6CxB,QAAA,MAAM,WAAW;;;;;;;;;iBASf,CAAA;AAEF,QAAA,MAAM,YAAY;;;iBAGhB,CAAA;AAEF,QAAA,MAAM,OAAO;;;iBAGX,CAAA;AAEF,QAAA,MAAM,IAAI;;;;;;mBAAmC,CAAA;AAE7C,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAA;AACrD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AACvD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAA;AAC7C,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAA;AAEvC,eAAO,MAAM,cAAc,GAAI,MAAM,IAAI,KAAG,IAAI,IAAI,YACM,CAAA;AAE1D,eAAO,MAAM,SAAS,GAAI,MAAM,IAAI,KAAG,IAAI,IAAI,OAAoD,CAAA;AAEnG,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgHlB,CAAA"}
|