@rookdaemon/agora 0.2.8 → 0.2.9
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/chunk-JUOGKXFN.js +1645 -0
- package/dist/chunk-JUOGKXFN.js.map +1 -0
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +1163 -1137
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1613 -30
- package/dist/index.js +1135 -29
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
- package/dist/cli.d.ts.map +0 -1
- package/dist/config.d.ts +0 -59
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -115
- package/dist/config.js.map +0 -1
- package/dist/discovery/bootstrap.d.ts +0 -32
- package/dist/discovery/bootstrap.d.ts.map +0 -1
- package/dist/discovery/bootstrap.js +0 -36
- package/dist/discovery/bootstrap.js.map +0 -1
- package/dist/discovery/peer-discovery.d.ts +0 -59
- package/dist/discovery/peer-discovery.d.ts.map +0 -1
- package/dist/discovery/peer-discovery.js +0 -108
- package/dist/discovery/peer-discovery.js.map +0 -1
- package/dist/identity/keypair.d.ts +0 -42
- package/dist/identity/keypair.d.ts.map +0 -1
- package/dist/identity/keypair.js +0 -83
- package/dist/identity/keypair.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/message/envelope.d.ts +0 -59
- package/dist/message/envelope.d.ts.map +0 -1
- package/dist/message/envelope.js +0 -83
- package/dist/message/envelope.js.map +0 -1
- package/dist/message/types/paper-discovery.d.ts +0 -28
- package/dist/message/types/paper-discovery.d.ts.map +0 -1
- package/dist/message/types/paper-discovery.js +0 -2
- package/dist/message/types/paper-discovery.js.map +0 -1
- package/dist/message/types/peer-discovery.d.ts +0 -78
- package/dist/message/types/peer-discovery.d.ts.map +0 -1
- package/dist/message/types/peer-discovery.js +0 -90
- package/dist/message/types/peer-discovery.js.map +0 -1
- package/dist/peer/client.d.ts +0 -50
- package/dist/peer/client.d.ts.map +0 -1
- package/dist/peer/client.js +0 -138
- package/dist/peer/client.js.map +0 -1
- package/dist/peer/manager.d.ts +0 -65
- package/dist/peer/manager.d.ts.map +0 -1
- package/dist/peer/manager.js +0 -153
- package/dist/peer/manager.js.map +0 -1
- package/dist/peer/server.d.ts +0 -65
- package/dist/peer/server.d.ts.map +0 -1
- package/dist/peer/server.js +0 -154
- package/dist/peer/server.js.map +0 -1
- package/dist/registry/capability.d.ts +0 -44
- package/dist/registry/capability.d.ts.map +0 -1
- package/dist/registry/capability.js +0 -94
- package/dist/registry/capability.js.map +0 -1
- package/dist/registry/discovery-service.d.ts +0 -64
- package/dist/registry/discovery-service.d.ts.map +0 -1
- package/dist/registry/discovery-service.js +0 -129
- package/dist/registry/discovery-service.js.map +0 -1
- package/dist/registry/messages.d.ts +0 -105
- package/dist/registry/messages.d.ts.map +0 -1
- package/dist/registry/messages.js +0 -2
- package/dist/registry/messages.js.map +0 -1
- package/dist/registry/peer-store.d.ts +0 -57
- package/dist/registry/peer-store.d.ts.map +0 -1
- package/dist/registry/peer-store.js +0 -92
- package/dist/registry/peer-store.js.map +0 -1
- package/dist/registry/peer.d.ts +0 -20
- package/dist/registry/peer.d.ts.map +0 -1
- package/dist/registry/peer.js +0 -2
- package/dist/registry/peer.js.map +0 -1
- package/dist/relay/client.d.ts +0 -112
- package/dist/relay/client.d.ts.map +0 -1
- package/dist/relay/client.js +0 -281
- package/dist/relay/client.js.map +0 -1
- package/dist/relay/jwt-auth.d.ts +0 -40
- package/dist/relay/jwt-auth.d.ts.map +0 -1
- package/dist/relay/jwt-auth.js +0 -109
- package/dist/relay/jwt-auth.js.map +0 -1
- package/dist/relay/message-buffer.d.ts +0 -41
- package/dist/relay/message-buffer.d.ts.map +0 -1
- package/dist/relay/message-buffer.js +0 -53
- package/dist/relay/message-buffer.js.map +0 -1
- package/dist/relay/rest-api.d.ts +0 -68
- package/dist/relay/rest-api.d.ts.map +0 -1
- package/dist/relay/rest-api.js +0 -225
- package/dist/relay/rest-api.js.map +0 -1
- package/dist/relay/run-relay.d.ts +0 -33
- package/dist/relay/run-relay.d.ts.map +0 -1
- package/dist/relay/run-relay.js +0 -57
- package/dist/relay/run-relay.js.map +0 -1
- package/dist/relay/server.d.ts +0 -91
- package/dist/relay/server.d.ts.map +0 -1
- package/dist/relay/server.js +0 -385
- package/dist/relay/server.js.map +0 -1
- package/dist/relay/store.d.ts +0 -19
- package/dist/relay/store.d.ts.map +0 -1
- package/dist/relay/store.js +0 -55
- package/dist/relay/store.js.map +0 -1
- package/dist/relay/types.d.ts +0 -35
- package/dist/relay/types.d.ts.map +0 -1
- package/dist/relay/types.js +0 -2
- package/dist/relay/types.js.map +0 -1
- package/dist/reputation/commit-reveal.d.ts +0 -45
- package/dist/reputation/commit-reveal.d.ts.map +0 -1
- package/dist/reputation/commit-reveal.js +0 -125
- package/dist/reputation/commit-reveal.js.map +0 -1
- package/dist/reputation/scoring.d.ts +0 -31
- package/dist/reputation/scoring.d.ts.map +0 -1
- package/dist/reputation/scoring.js +0 -105
- package/dist/reputation/scoring.js.map +0 -1
- package/dist/reputation/store.d.ts +0 -83
- package/dist/reputation/store.d.ts.map +0 -1
- package/dist/reputation/store.js +0 -202
- package/dist/reputation/store.js.map +0 -1
- package/dist/reputation/types.d.ts +0 -150
- package/dist/reputation/types.d.ts.map +0 -1
- package/dist/reputation/types.js +0 -113
- package/dist/reputation/types.js.map +0 -1
- package/dist/reputation/verification.d.ts +0 -28
- package/dist/reputation/verification.d.ts.map +0 -1
- package/dist/reputation/verification.js +0 -91
- package/dist/reputation/verification.js.map +0 -1
- package/dist/service.d.ts +0 -90
- package/dist/service.d.ts.map +0 -1
- package/dist/service.js +0 -176
- package/dist/service.js.map +0 -1
- package/dist/transport/http.d.ts +0 -41
- package/dist/transport/http.d.ts.map +0 -1
- package/dist/transport/http.js +0 -103
- package/dist/transport/http.js.map +0 -1
- package/dist/transport/peer-config.d.ts +0 -38
- package/dist/transport/peer-config.d.ts.map +0 -1
- package/dist/transport/peer-config.js +0 -41
- package/dist/transport/peer-config.js.map +0 -1
- package/dist/transport/relay.d.ts +0 -30
- package/dist/transport/relay.d.ts.map +0 -1
- package/dist/transport/relay.js +0 -85
- package/dist/transport/relay.js.map +0 -1
- package/dist/utils.d.ts +0 -40
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -59
- package/dist/utils.js.map +0 -1
package/dist/service.js
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { getDefaultConfigPath, loadAgoraConfigAsync } from './config.js';
|
|
2
|
-
import { RelayClient } from './relay/client.js';
|
|
3
|
-
import { decodeInboundEnvelope, sendToPeer } from './transport/http.js';
|
|
4
|
-
import { sendViaRelay } from './transport/relay.js';
|
|
5
|
-
import { shortKey } from './utils.js';
|
|
6
|
-
/**
|
|
7
|
-
* High-level Agora service: send by peer name, decode inbound, relay lifecycle.
|
|
8
|
-
*/
|
|
9
|
-
export class AgoraService {
|
|
10
|
-
config;
|
|
11
|
-
relayClient = null;
|
|
12
|
-
relayMessageHandler = null;
|
|
13
|
-
relayMessageHandlerWithName = null;
|
|
14
|
-
logger;
|
|
15
|
-
relayClientFactory;
|
|
16
|
-
constructor(config, logger, relayClientFactory) {
|
|
17
|
-
this.config = config;
|
|
18
|
-
this.logger = logger ?? null;
|
|
19
|
-
this.relayClientFactory = relayClientFactory ?? null;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Send a signed message to a named peer.
|
|
23
|
-
* Tries HTTP webhook first; falls back to relay if HTTP is unavailable.
|
|
24
|
-
*/
|
|
25
|
-
async sendMessage(options) {
|
|
26
|
-
const peer = this.config.peers.get(options.peerName);
|
|
27
|
-
if (!peer) {
|
|
28
|
-
return {
|
|
29
|
-
ok: false,
|
|
30
|
-
status: 0,
|
|
31
|
-
error: `Unknown peer: ${options.peerName}`,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
// Try HTTP first (only if peer has a webhook URL)
|
|
35
|
-
if (peer.url) {
|
|
36
|
-
const transportConfig = {
|
|
37
|
-
identity: {
|
|
38
|
-
publicKey: this.config.identity.publicKey,
|
|
39
|
-
privateKey: this.config.identity.privateKey,
|
|
40
|
-
},
|
|
41
|
-
peers: new Map([[peer.publicKey, peer]]),
|
|
42
|
-
};
|
|
43
|
-
const httpResult = await sendToPeer(transportConfig, peer.publicKey, options.type, options.payload, options.inReplyTo);
|
|
44
|
-
if (httpResult.ok) {
|
|
45
|
-
return httpResult;
|
|
46
|
-
}
|
|
47
|
-
this.logger?.debug(`HTTP send to ${options.peerName} failed: ${httpResult.error}`);
|
|
48
|
-
}
|
|
49
|
-
// Fall back to relay
|
|
50
|
-
if (this.relayClient?.connected() && this.config.relay) {
|
|
51
|
-
const relayResult = await sendViaRelay({
|
|
52
|
-
identity: this.config.identity,
|
|
53
|
-
relayUrl: this.config.relay.url,
|
|
54
|
-
relayClient: this.relayClient,
|
|
55
|
-
}, peer.publicKey, options.type, options.payload, options.inReplyTo);
|
|
56
|
-
return {
|
|
57
|
-
ok: relayResult.ok,
|
|
58
|
-
status: 0,
|
|
59
|
-
error: relayResult.error,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
// Both failed
|
|
63
|
-
return {
|
|
64
|
-
ok: false,
|
|
65
|
-
status: 0,
|
|
66
|
-
error: peer.url
|
|
67
|
-
? `HTTP send failed and relay not available for peer: ${options.peerName}`
|
|
68
|
-
: `No webhook URL and relay not available for peer: ${options.peerName}`,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Decode and verify an inbound envelope from a webhook message.
|
|
73
|
-
*/
|
|
74
|
-
async decodeInbound(message) {
|
|
75
|
-
const peersByPubKey = new Map();
|
|
76
|
-
for (const peer of this.config.peers.values()) {
|
|
77
|
-
peersByPubKey.set(peer.publicKey, peer);
|
|
78
|
-
}
|
|
79
|
-
const result = decodeInboundEnvelope(message, peersByPubKey);
|
|
80
|
-
if (result.ok) {
|
|
81
|
-
return { ok: true, envelope: result.envelope };
|
|
82
|
-
}
|
|
83
|
-
return { ok: false, reason: result.reason };
|
|
84
|
-
}
|
|
85
|
-
getPeers() {
|
|
86
|
-
return Array.from(this.config.peers.keys());
|
|
87
|
-
}
|
|
88
|
-
getPeerConfig(name) {
|
|
89
|
-
return this.config.peers.get(name);
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Connect to the relay server.
|
|
93
|
-
*/
|
|
94
|
-
async connectRelay(url) {
|
|
95
|
-
if (this.relayClient) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
const maxReconnectDelay = this.config.relay?.reconnectMaxMs ?? 300000;
|
|
99
|
-
let name = this.config.identity.name ?? this.config.relay?.name;
|
|
100
|
-
// Never use the short key (id) as the relay display name; treat it as no name
|
|
101
|
-
if (name && name === shortKey(this.config.identity.publicKey)) {
|
|
102
|
-
name = undefined;
|
|
103
|
-
}
|
|
104
|
-
const opts = {
|
|
105
|
-
relayUrl: url,
|
|
106
|
-
publicKey: this.config.identity.publicKey,
|
|
107
|
-
privateKey: this.config.identity.privateKey,
|
|
108
|
-
name,
|
|
109
|
-
pingInterval: 30000,
|
|
110
|
-
maxReconnectDelay,
|
|
111
|
-
};
|
|
112
|
-
if (this.relayClientFactory) {
|
|
113
|
-
this.relayClient = this.relayClientFactory(opts);
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
this.relayClient = new RelayClient(opts);
|
|
117
|
-
}
|
|
118
|
-
this.relayClient.on('error', (error) => {
|
|
119
|
-
this.logger?.debug(`Agora relay error: ${error.message}`);
|
|
120
|
-
});
|
|
121
|
-
this.relayClient.on('message', (envelope, from, fromName) => {
|
|
122
|
-
if (this.relayMessageHandlerWithName) {
|
|
123
|
-
this.relayMessageHandlerWithName(envelope, from, fromName);
|
|
124
|
-
}
|
|
125
|
-
else if (this.relayMessageHandler) {
|
|
126
|
-
this.relayMessageHandler(envelope);
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
try {
|
|
130
|
-
await this.relayClient.connect();
|
|
131
|
-
}
|
|
132
|
-
catch (error) {
|
|
133
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
134
|
-
this.logger?.debug(`Agora relay connect failed (${url}): ${message}`);
|
|
135
|
-
this.relayClient = null;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
setRelayMessageHandler(handler) {
|
|
139
|
-
this.relayMessageHandler = handler;
|
|
140
|
-
this.relayMessageHandlerWithName = null;
|
|
141
|
-
}
|
|
142
|
-
setRelayMessageHandlerWithName(handler) {
|
|
143
|
-
this.relayMessageHandlerWithName = handler;
|
|
144
|
-
this.relayMessageHandler = null;
|
|
145
|
-
}
|
|
146
|
-
async disconnectRelay() {
|
|
147
|
-
if (this.relayClient) {
|
|
148
|
-
this.relayClient.disconnect();
|
|
149
|
-
this.relayClient = null;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
isRelayConnected() {
|
|
153
|
-
return this.relayClient?.connected() ?? false;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Load Agora configuration and return service config (peers as Map).
|
|
157
|
-
*/
|
|
158
|
-
static async loadConfig(path) {
|
|
159
|
-
const configPath = path ?? getDefaultConfigPath();
|
|
160
|
-
const loaded = await loadAgoraConfigAsync(configPath);
|
|
161
|
-
const peers = new Map();
|
|
162
|
-
for (const [name, p] of Object.entries(loaded.peers)) {
|
|
163
|
-
peers.set(name, {
|
|
164
|
-
publicKey: p.publicKey,
|
|
165
|
-
url: p.url,
|
|
166
|
-
token: p.token,
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
return {
|
|
170
|
-
identity: loaded.identity,
|
|
171
|
-
peers,
|
|
172
|
-
relay: loaded.relay,
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
//# sourceMappingURL=service.js.map
|
package/dist/service.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"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C,SAAS;gBACtB,GAAG,EAAE,CAAC,CAAC,GAAG;gBACV,KAAK,EAAE,CAAC,CAAC,KAAK;aACM,CAAC,CAAC;QAC1B,CAAC;QAED,OAAO;YACL,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,KAAK;YACL,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC;IACJ,CAAC;CACF"}
|
package/dist/transport/http.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { type Envelope, type MessageType } from '../message/envelope.js';
|
|
2
|
-
export interface PeerConfig {
|
|
3
|
-
/** Peer's webhook URL, e.g. http://localhost:18790/hooks (undefined for relay-only peers) */
|
|
4
|
-
url?: string;
|
|
5
|
-
/** Peer's webhook auth token (undefined for relay-only peers) */
|
|
6
|
-
token?: string;
|
|
7
|
-
/** Peer's public key (hex) for verifying responses */
|
|
8
|
-
publicKey: string;
|
|
9
|
-
}
|
|
10
|
-
export interface TransportConfig {
|
|
11
|
-
/** This agent's keypair */
|
|
12
|
-
identity: {
|
|
13
|
-
publicKey: string;
|
|
14
|
-
privateKey: string;
|
|
15
|
-
};
|
|
16
|
-
/** Known peers */
|
|
17
|
-
peers: Map<string, PeerConfig>;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Send a signed envelope to a peer via HTTP webhook.
|
|
21
|
-
* Creates the envelope, signs it, and POSTs to the peer's /hooks/agent endpoint.
|
|
22
|
-
* Returns the HTTP status code.
|
|
23
|
-
*/
|
|
24
|
-
export declare function sendToPeer(config: TransportConfig, peerPublicKey: string, type: MessageType, payload: unknown, inReplyTo?: string): Promise<{
|
|
25
|
-
ok: boolean;
|
|
26
|
-
status: number;
|
|
27
|
-
error?: string;
|
|
28
|
-
}>;
|
|
29
|
-
/**
|
|
30
|
-
* Decode and verify an inbound Agora envelope from a webhook message.
|
|
31
|
-
* Expects the message to start with [AGORA_ENVELOPE] followed by base64.
|
|
32
|
-
* Returns the verified envelope or an error.
|
|
33
|
-
*/
|
|
34
|
-
export declare function decodeInboundEnvelope(message: string, knownPeers: Map<string, PeerConfig>): {
|
|
35
|
-
ok: true;
|
|
36
|
-
envelope: Envelope;
|
|
37
|
-
} | {
|
|
38
|
-
ok: false;
|
|
39
|
-
reason: string;
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=http.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/transport/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAEzG,MAAM,WAAW,UAAU;IACzB,6FAA6F;IAC7F,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,2BAA2B;IAC3B,QAAQ,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IACpD,kBAAkB;IAClB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CAChC;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,eAAe,EACvB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,OAAO,EAChB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAyD1D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,GAClC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAiDlE"}
|
package/dist/transport/http.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { createEnvelope, verifyEnvelope } from '../message/envelope.js';
|
|
2
|
-
/**
|
|
3
|
-
* Send a signed envelope to a peer via HTTP webhook.
|
|
4
|
-
* Creates the envelope, signs it, and POSTs to the peer's /hooks/agent endpoint.
|
|
5
|
-
* Returns the HTTP status code.
|
|
6
|
-
*/
|
|
7
|
-
export async function sendToPeer(config, peerPublicKey, type, payload, inReplyTo) {
|
|
8
|
-
// Look up peer config
|
|
9
|
-
const peer = config.peers.get(peerPublicKey);
|
|
10
|
-
if (!peer) {
|
|
11
|
-
return { ok: false, status: 0, error: 'Unknown peer' };
|
|
12
|
-
}
|
|
13
|
-
// Relay-only peer — no webhook URL configured
|
|
14
|
-
if (!peer.url) {
|
|
15
|
-
return { ok: false, status: 0, error: 'No webhook URL configured' };
|
|
16
|
-
}
|
|
17
|
-
// Create and sign the envelope
|
|
18
|
-
const envelope = createEnvelope(type, config.identity.publicKey, config.identity.privateKey, payload, Date.now(), inReplyTo);
|
|
19
|
-
// Encode envelope as base64url
|
|
20
|
-
const envelopeJson = JSON.stringify(envelope);
|
|
21
|
-
const envelopeBase64 = Buffer.from(envelopeJson).toString('base64url');
|
|
22
|
-
// Construct webhook payload
|
|
23
|
-
const webhookPayload = {
|
|
24
|
-
message: `[AGORA_ENVELOPE]${envelopeBase64}`,
|
|
25
|
-
name: 'Agora',
|
|
26
|
-
sessionKey: `agora:${envelope.sender.substring(0, 16)}`,
|
|
27
|
-
deliver: false,
|
|
28
|
-
};
|
|
29
|
-
// Send HTTP POST
|
|
30
|
-
try {
|
|
31
|
-
const response = await fetch(`${peer.url}/agent`, {
|
|
32
|
-
method: 'POST',
|
|
33
|
-
headers: {
|
|
34
|
-
'Authorization': `Bearer ${peer.token}`,
|
|
35
|
-
'Content-Type': 'application/json',
|
|
36
|
-
},
|
|
37
|
-
body: JSON.stringify(webhookPayload),
|
|
38
|
-
});
|
|
39
|
-
return {
|
|
40
|
-
ok: response.ok,
|
|
41
|
-
status: response.status,
|
|
42
|
-
error: response.ok ? undefined : await response.text(),
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
catch (err) {
|
|
46
|
-
return {
|
|
47
|
-
ok: false,
|
|
48
|
-
status: 0,
|
|
49
|
-
error: err instanceof Error ? err.message : String(err),
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Decode and verify an inbound Agora envelope from a webhook message.
|
|
55
|
-
* Expects the message to start with [AGORA_ENVELOPE] followed by base64.
|
|
56
|
-
* Returns the verified envelope or an error.
|
|
57
|
-
*/
|
|
58
|
-
export function decodeInboundEnvelope(message, knownPeers) {
|
|
59
|
-
// Check for AGORA_ENVELOPE prefix
|
|
60
|
-
const prefix = '[AGORA_ENVELOPE]';
|
|
61
|
-
if (!message.startsWith(prefix)) {
|
|
62
|
-
return { ok: false, reason: 'not_agora_message' };
|
|
63
|
-
}
|
|
64
|
-
// Extract base64 payload
|
|
65
|
-
const base64Payload = message.substring(prefix.length);
|
|
66
|
-
// Check for empty payload
|
|
67
|
-
if (!base64Payload) {
|
|
68
|
-
return { ok: false, reason: 'invalid_base64' };
|
|
69
|
-
}
|
|
70
|
-
// Decode base64
|
|
71
|
-
let envelopeJson;
|
|
72
|
-
try {
|
|
73
|
-
const decoded = Buffer.from(base64Payload, 'base64url');
|
|
74
|
-
// Check if decoded buffer is empty or contains invalid data
|
|
75
|
-
if (decoded.length === 0) {
|
|
76
|
-
return { ok: false, reason: 'invalid_base64' };
|
|
77
|
-
}
|
|
78
|
-
envelopeJson = decoded.toString('utf-8');
|
|
79
|
-
}
|
|
80
|
-
catch {
|
|
81
|
-
return { ok: false, reason: 'invalid_base64' };
|
|
82
|
-
}
|
|
83
|
-
// Parse JSON
|
|
84
|
-
let envelope;
|
|
85
|
-
try {
|
|
86
|
-
envelope = JSON.parse(envelopeJson);
|
|
87
|
-
}
|
|
88
|
-
catch {
|
|
89
|
-
return { ok: false, reason: 'invalid_json' };
|
|
90
|
-
}
|
|
91
|
-
// Verify envelope integrity
|
|
92
|
-
const verification = verifyEnvelope(envelope);
|
|
93
|
-
if (!verification.valid) {
|
|
94
|
-
return { ok: false, reason: verification.reason || 'verification_failed' };
|
|
95
|
-
}
|
|
96
|
-
// Check if sender is a known peer
|
|
97
|
-
const senderKnown = knownPeers.has(envelope.sender);
|
|
98
|
-
if (!senderKnown) {
|
|
99
|
-
return { ok: false, reason: 'unknown_sender' };
|
|
100
|
-
}
|
|
101
|
-
return { ok: true, envelope };
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=http.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/transport/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAmC,MAAM,wBAAwB,CAAC;AAkBzG;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,MAAuB,EACvB,aAAqB,EACrB,IAAiB,EACjB,OAAgB,EAChB,SAAkB;IAElB,sBAAsB;IACtB,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC7C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;IACzD,CAAC;IAED,8CAA8C;IAC9C,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,2BAA2B,EAAE,CAAC;IACtE,CAAC;IAED,+BAA+B;IAC/B,M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AAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;IAC/C,CAAC;IAED,4BAA4B;IAC5B,MAAM,YAAY,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC9C,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QACxB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,MAAM,IAAI,qBAAqB,EAAE,CAAC;IAC7E,CAAC;IAED,kCAAkC;IAClC,MAAM,WAAW,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;IACjD,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export interface PeerConfigFile {
|
|
2
|
-
identity: {
|
|
3
|
-
publicKey: string;
|
|
4
|
-
privateKey: string;
|
|
5
|
-
name?: string;
|
|
6
|
-
};
|
|
7
|
-
relay?: string | {
|
|
8
|
-
url: string;
|
|
9
|
-
name?: string;
|
|
10
|
-
};
|
|
11
|
-
peers: Record<string, {
|
|
12
|
-
url?: string;
|
|
13
|
-
token?: string;
|
|
14
|
-
publicKey: string;
|
|
15
|
-
name?: string;
|
|
16
|
-
}>;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Load peer configuration from a JSON file.
|
|
20
|
-
* @param path - Path to the config file
|
|
21
|
-
* @returns The parsed configuration
|
|
22
|
-
* @throws Error if file doesn't exist or contains invalid JSON
|
|
23
|
-
*/
|
|
24
|
-
export declare function loadPeerConfig(path: string): PeerConfigFile;
|
|
25
|
-
/**
|
|
26
|
-
* Save peer configuration to a JSON file.
|
|
27
|
-
* @param path - Path to the config file
|
|
28
|
-
* @param config - The configuration to save
|
|
29
|
-
*/
|
|
30
|
-
export declare function savePeerConfig(path: string, config: PeerConfigFile): void;
|
|
31
|
-
/**
|
|
32
|
-
* Initialize peer configuration, generating a new keypair if the file doesn't exist.
|
|
33
|
-
* If the file exists, loads and returns it.
|
|
34
|
-
* @param path - Path to the config file
|
|
35
|
-
* @returns The configuration (loaded or newly created)
|
|
36
|
-
*/
|
|
37
|
-
export declare function initPeerConfig(path: string): PeerConfigFile;
|
|
38
|
-
//# sourceMappingURL=peer-config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"peer-config.d.ts","sourceRoot":"","sources":["../../src/transport/peer-config.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE;QACR,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,KAAK,CAAC,EAAE,MAAM,GAAG;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE;QACpB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;CACJ;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAG3D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI,CAGzE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAc3D"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync, existsSync } from 'node:fs';
|
|
2
|
-
import { generateKeyPair } from '../identity/keypair.js';
|
|
3
|
-
/**
|
|
4
|
-
* Load peer configuration from a JSON file.
|
|
5
|
-
* @param path - Path to the config file
|
|
6
|
-
* @returns The parsed configuration
|
|
7
|
-
* @throws Error if file doesn't exist or contains invalid JSON
|
|
8
|
-
*/
|
|
9
|
-
export function loadPeerConfig(path) {
|
|
10
|
-
const content = readFileSync(path, 'utf-8');
|
|
11
|
-
return JSON.parse(content);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Save peer configuration to a JSON file.
|
|
15
|
-
* @param path - Path to the config file
|
|
16
|
-
* @param config - The configuration to save
|
|
17
|
-
*/
|
|
18
|
-
export function savePeerConfig(path, config) {
|
|
19
|
-
const content = JSON.stringify(config, null, 2);
|
|
20
|
-
writeFileSync(path, content, 'utf-8');
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Initialize peer configuration, generating a new keypair if the file doesn't exist.
|
|
24
|
-
* If the file exists, loads and returns it.
|
|
25
|
-
* @param path - Path to the config file
|
|
26
|
-
* @returns The configuration (loaded or newly created)
|
|
27
|
-
*/
|
|
28
|
-
export function initPeerConfig(path) {
|
|
29
|
-
if (existsSync(path)) {
|
|
30
|
-
return loadPeerConfig(path);
|
|
31
|
-
}
|
|
32
|
-
// Generate new keypair and create initial config
|
|
33
|
-
const identity = generateKeyPair();
|
|
34
|
-
const config = {
|
|
35
|
-
identity,
|
|
36
|
-
peers: {},
|
|
37
|
-
};
|
|
38
|
-
savePeerConfig(path, config);
|
|
39
|
-
return config;
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=peer-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"peer-config.js","sourceRoot":"","sources":["../../src/transport/peer-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAoBzD;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAmB,CAAC;AAC/C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,MAAsB;IACjE,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAChD,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACrB,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,iDAAiD;IACjD,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAC;IACnC,MAAM,MAAM,GAAmB;QAC7B,QAAQ;QACR,KAAK,EAAE,EAAE;KACV,CAAC;IAEF,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7B,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { type Envelope, type MessageType } from '../message/envelope.js';
|
|
2
|
-
/** Minimal interface for a connected relay client (avoids importing full RelayClient) */
|
|
3
|
-
export interface RelayClientSender {
|
|
4
|
-
connected(): boolean;
|
|
5
|
-
send(to: string, envelope: Envelope): Promise<{
|
|
6
|
-
ok: boolean;
|
|
7
|
-
error?: string;
|
|
8
|
-
}>;
|
|
9
|
-
}
|
|
10
|
-
export interface RelayTransportConfig {
|
|
11
|
-
/** This agent's keypair */
|
|
12
|
-
identity: {
|
|
13
|
-
publicKey: string;
|
|
14
|
-
privateKey: string;
|
|
15
|
-
};
|
|
16
|
-
/** Relay server WebSocket URL (e.g., wss://agora-relay.lbsa71.net) */
|
|
17
|
-
relayUrl: string;
|
|
18
|
-
/** Optional persistent relay client (if provided, will use it instead of connect-per-message) */
|
|
19
|
-
relayClient?: RelayClientSender;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Send a signed envelope to a peer via relay server.
|
|
23
|
-
* If a persistent relayClient is provided in the config, uses that.
|
|
24
|
-
* Otherwise, connects to relay, registers, sends message, and disconnects.
|
|
25
|
-
*/
|
|
26
|
-
export declare function sendViaRelay(config: RelayTransportConfig, peerPublicKey: string, type: MessageType, payload: unknown, inReplyTo?: string): Promise<{
|
|
27
|
-
ok: boolean;
|
|
28
|
-
error?: string;
|
|
29
|
-
}>;
|
|
30
|
-
//# sourceMappingURL=relay.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relay.d.ts","sourceRoot":"","sources":["../../src/transport/relay.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAEzF,yFAAyF;AACzF,MAAM,WAAW,iBAAiB;IAChC,SAAS,IAAI,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChF;AAED,MAAM,WAAW,oBAAoB;IACnC,2BAA2B;IAC3B,QAAQ,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IACpD,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;IACjB,iGAAiG;IACjG,WAAW,CAAC,EAAE,iBAAiB,CAAC;CACjC;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,oBAAoB,EAC5B,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,OAAO,EAChB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAmG1C"}
|
package/dist/transport/relay.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import WebSocket from 'ws';
|
|
2
|
-
import { createEnvelope } from '../message/envelope.js';
|
|
3
|
-
/**
|
|
4
|
-
* Send a signed envelope to a peer via relay server.
|
|
5
|
-
* If a persistent relayClient is provided in the config, uses that.
|
|
6
|
-
* Otherwise, connects to relay, registers, sends message, and disconnects.
|
|
7
|
-
*/
|
|
8
|
-
export async function sendViaRelay(config, peerPublicKey, type, payload, inReplyTo) {
|
|
9
|
-
// If a persistent relay client is available, use it
|
|
10
|
-
if (config.relayClient && config.relayClient.connected()) {
|
|
11
|
-
const envelope = createEnvelope(type, config.identity.publicKey, config.identity.privateKey, payload, Date.now(), inReplyTo);
|
|
12
|
-
return config.relayClient.send(peerPublicKey, envelope);
|
|
13
|
-
}
|
|
14
|
-
// Otherwise, fall back to connect-per-message
|
|
15
|
-
return new Promise((resolve) => {
|
|
16
|
-
const ws = new WebSocket(config.relayUrl);
|
|
17
|
-
let registered = false;
|
|
18
|
-
let messageSent = false;
|
|
19
|
-
let resolved = false;
|
|
20
|
-
// Helper to resolve once
|
|
21
|
-
const resolveOnce = (result) => {
|
|
22
|
-
if (!resolved) {
|
|
23
|
-
resolved = true;
|
|
24
|
-
clearTimeout(timeout);
|
|
25
|
-
resolve(result);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
// Set timeout for the entire operation
|
|
29
|
-
const timeout = setTimeout(() => {
|
|
30
|
-
if (!messageSent) {
|
|
31
|
-
ws.close();
|
|
32
|
-
resolveOnce({ ok: false, error: 'Relay connection timeout' });
|
|
33
|
-
}
|
|
34
|
-
}, 10000); // 10 second timeout
|
|
35
|
-
ws.on('open', () => {
|
|
36
|
-
// Send register message
|
|
37
|
-
const registerMsg = {
|
|
38
|
-
type: 'register',
|
|
39
|
-
publicKey: config.identity.publicKey,
|
|
40
|
-
};
|
|
41
|
-
ws.send(JSON.stringify(registerMsg));
|
|
42
|
-
});
|
|
43
|
-
ws.on('message', (data) => {
|
|
44
|
-
try {
|
|
45
|
-
const msg = JSON.parse(data.toString());
|
|
46
|
-
if (msg.type === 'registered' && !registered) {
|
|
47
|
-
registered = true;
|
|
48
|
-
// Create and sign the envelope
|
|
49
|
-
const envelope = createEnvelope(type, config.identity.publicKey, config.identity.privateKey, payload, Date.now(), inReplyTo);
|
|
50
|
-
// Send message via relay
|
|
51
|
-
const relayMsg = {
|
|
52
|
-
type: 'message',
|
|
53
|
-
to: peerPublicKey,
|
|
54
|
-
envelope,
|
|
55
|
-
};
|
|
56
|
-
ws.send(JSON.stringify(relayMsg));
|
|
57
|
-
messageSent = true;
|
|
58
|
-
// Close connection after sending
|
|
59
|
-
setTimeout(() => {
|
|
60
|
-
ws.close();
|
|
61
|
-
resolveOnce({ ok: true });
|
|
62
|
-
}, 100); // Small delay to ensure message is sent
|
|
63
|
-
}
|
|
64
|
-
else if (msg.type === 'error') {
|
|
65
|
-
ws.close();
|
|
66
|
-
resolveOnce({ ok: false, error: msg.message || 'Relay server error' });
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
catch (err) {
|
|
70
|
-
ws.close();
|
|
71
|
-
resolveOnce({ ok: false, error: err instanceof Error ? err.message : String(err) });
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
ws.on('error', (err) => {
|
|
75
|
-
ws.close();
|
|
76
|
-
resolveOnce({ ok: false, error: err.message });
|
|
77
|
-
});
|
|
78
|
-
ws.on('close', () => {
|
|
79
|
-
if (!messageSent) {
|
|
80
|
-
resolveOnce({ ok: false, error: 'Connection closed before message sent' });
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
}
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,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get a short display version of a public key using the last 8 characters.
|
|
3
|
-
* Ed25519 public keys all share the same OID prefix, so the last 8 characters
|
|
4
|
-
* are more distinguishable than the first 8.
|
|
5
|
-
*
|
|
6
|
-
* @param publicKey - The full public key hex string
|
|
7
|
-
* @returns "..." followed by the last 8 characters of the key
|
|
8
|
-
*/
|
|
9
|
-
export declare function shortKey(publicKey: string): string;
|
|
10
|
-
/**
|
|
11
|
-
* Resolves the name to broadcast when connecting to a relay.
|
|
12
|
-
* Priority order:
|
|
13
|
-
* 1. CLI --name flag
|
|
14
|
-
* 2. config.relay.name (if relay is an object with name property)
|
|
15
|
-
* 3. config.identity.name
|
|
16
|
-
* 4. undefined (no name broadcast)
|
|
17
|
-
*
|
|
18
|
-
* @param config - The Agora configuration (or compatible config with identity and optional relay)
|
|
19
|
-
* @param cliName - Optional name from CLI --name flag
|
|
20
|
-
* @returns The resolved name to broadcast, or undefined if none available
|
|
21
|
-
*/
|
|
22
|
-
export declare function resolveBroadcastName(config: {
|
|
23
|
-
identity: {
|
|
24
|
-
name?: string;
|
|
25
|
-
};
|
|
26
|
-
relay?: {
|
|
27
|
-
name?: string;
|
|
28
|
-
} | string;
|
|
29
|
-
}, cliName?: string): string | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* Formats a display name with short ID postfix.
|
|
32
|
-
* If name exists: "name (...3f8c2247)"
|
|
33
|
-
* If no name: "...3f8c2247" (short ID only)
|
|
34
|
-
*
|
|
35
|
-
* @param name - Optional name to display (should not be a short ID)
|
|
36
|
-
* @param publicKey - The public key to use for short ID
|
|
37
|
-
* @returns Formatted display string
|
|
38
|
-
*/
|
|
39
|
-
export declare function formatDisplayName(name: string | undefined, publicKey: string): string;
|
|
40
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE;IAAE,QAAQ,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAA;CAAE,EAC3E,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,GAAG,SAAS,CAoBpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAOrF"}
|