sauruspro-bail 5.0.1 → 5.0.2
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/docs/CHANGELOG.md +35 -0
- package/docs/SPR.md +61 -24
- package/lib/Socket/index.js +38 -4
- package/lib/Socket/socket.js +3 -2
- package/lib/Utils/crypto.js +25 -1
- package/lib/Utils/dinonic-spr.d.ts +63 -16
- package/lib/Utils/dinonic-spr.js +658 -440
- package/lib/Utils/greeting-card.d.ts +15 -0
- package/lib/Utils/greeting-card.js +70 -0
- package/lib/Utils/group-history.d.ts +4 -0
- package/lib/Utils/group-history.js +58 -0
- package/lib/Utils/index.js +7 -1
- package/lib/Utils/meta-ai-bot.d.ts +10 -0
- package/lib/Utils/meta-ai-bot.js +94 -0
- package/lib/Utils/native-backend.d.ts +3 -0
- package/lib/Utils/native-backend.js +56 -0
- package/lib/Utils/plugins.d.ts +20 -0
- package/lib/Utils/plugins.js +78 -0
- package/lib/Utils/presence-profile.d.ts +18 -0
- package/lib/Utils/presence-profile.js +50 -0
- package/package.json +6 -2
- package/README.md +0 -129
- package/docs/NEWSLETTER-STATUS.md +0 -120
package/docs/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.0.2
|
|
4
|
+
### Added (dari zapo-js, MIT)
|
|
5
|
+
- **Greeting Card `/buss`**: `sock.sendGreetingCard(jid, { text, title, greeting, imageUrl, contactUrl, thumbnail?, sourceApp?, ref?, mentions?, adReply? }, sendOptions?)` dan `sock.buildGreetingCard(opts)`.
|
|
6
|
+
Pesan `extendedTextMessage` + `contextInfo.externalAdReply`; `sourceId`, `ctwaClid`, `ctaPayload` diacak tiap kirim. Kartu hanya tampil di WhatsApp Business; user biasa hanya melihat teks.
|
|
7
|
+
Contoh:
|
|
8
|
+
```js
|
|
9
|
+
await sock.sendGreetingCard(jid, {
|
|
10
|
+
text: 'wow', title: 'Megumin Dominada BUSI', greeting: 'Hi Business',
|
|
11
|
+
imageUrl: 'https://.../img.jpg', contactUrl: 'https://wa.me/NOMOR'
|
|
12
|
+
}, { quoted: null })
|
|
13
|
+
```
|
|
14
|
+
- **Group History Bundle** (`sock.GroupHistory`, juga export `Utils`): `encodeGroupHistoryBundle`, `decodeGroupHistoryBundle`, `streamGroupHistoryBundle` (baca per pesan, hemat memori).
|
|
15
|
+
- **Meta AI Bot helpers** (`sock.MetaAIBot`, juga `Utils.MetaAIBot`): `BOT_KNOWN_JIDS`, `genBotMsgSecret`, `deriveBotChunkKey`, `decryptBotChunk`, `attachBotMetadata`, `attachBotThread`, `extractInvokedBotJid`, `buildBotInvokeProtoCopy`.
|
|
16
|
+
- **Plugin system** (dari zapo-js): `sock.use(plugin)`, `sock.removePlugin(id)`, `sock.hasPlugin(id)`, `sock.listPlugins()`, helper `definePlugin({ id, exposeAs?, setup(ctx), dispose? })`.
|
|
17
|
+
`ctx` berisi `sock`, `config`, `logger`, `ev`, `on/off`, `registerDispose`, `extend({...})` (member yang ditambah otomatis dicabut saat plugin dihapus). Opsi socket: `plugins: [...]`, `disablePlugins: ['spr', ...]`.
|
|
18
|
+
Fitur bawaan sekarang berupa plugin: `spr`, `greeting-card`, `group-history`, `meta-ai-bot`, `presence`, `profile` (API tetap sama; bisa dimatikan lewat `disablePlugins`).
|
|
19
|
+
```js
|
|
20
|
+
const myPlugin = definePlugin({ id: 'halo', setup: ({ extend }) => extend({ halo: () => 'hai' }) })
|
|
21
|
+
sock.use(myPlugin)
|
|
22
|
+
```
|
|
23
|
+
- **Presence & Profile API**: `sock.presence` (`setOnline`, `setOffline`, `typing`, `recording`, `paused`, `subscribe`, `typeFor(jid, ms)`, `withTyping(jid, fn)`) dan `sock.profile` (`getPicture`, `setPicture`, `removePicture`, `getStatus`, `setStatus`, `setName`, `username.{get,set,delete,check,recommendations,setPin,find}`). Pembungkus dari fungsi socket yang sudah ada.
|
|
24
|
+
- **Akselerator kripto native opsional**: jika `@zapo-js/native` terpasang, X25519 dan XEdDSA (sign/verify) dipakai lewat native (NAPI lalu WASM); tanpa paket itu otomatis tetap JS (libsignal). Env `SAURUS_NATIVE_BACKEND` = `auto|napi|wasm|js|none`. Util: `isNativeCryptoActive()`.
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
- `requestPairingCode`: kode pairing tanpa custom kini acak tiap request (sebelumnya selalu `VINXSYNC`).
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
- `lib/Utils/dinonic-spr.js` ditulis ulang dari nol (engine baru, sender key sekali pakai). API `sPR` / `selectiveRelay` tetap kompatibel.
|
|
31
|
+
|
|
32
|
+
### Added (diadaptasi dari plugin zapo-js, MIT)
|
|
33
|
+
- Opsi `personal` pada `sPR`: pesan khusus per orang.
|
|
34
|
+
- `sPRPrivate`, `sPRBroadcast` (`{name}` + mention + foto profil), `getSPRTargets`, `loadSPRAvatars`.
|
|
35
|
+
- Batas target 100 + hitung overflow, cache foto, budget/timeout, konkurensi.
|
|
36
|
+
- Reporting token memakai util resmi, tctoken memakai pengecekan expired.
|
|
37
|
+
|
|
3
38
|
## 5.0.1
|
|
4
39
|
**Owner: Saurus / Dinonic**
|
|
5
40
|
|
package/docs/SPR.md
CHANGED
|
@@ -1,51 +1,88 @@
|
|
|
1
|
-
# 🎯 SPR (Selective Relay)
|
|
1
|
+
# 🎯 SPR (Selective & Private Relay)
|
|
2
2
|
|
|
3
|
-
Kirim pesan dengan kontrol **
|
|
3
|
+
Kirim pesan dengan kontrol **siapa membaca apa**. Tiap device penerima masuk salah satu peran:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
| Peran | Yang diterima |
|
|
6
|
+
|---|---|
|
|
7
|
+
| `public` | pesan umum (menerima sender key sekali pakai) |
|
|
8
|
+
| `personal` | pesan khusus miliknya (enkripsi 1-lawan-1), tanpa pesan umum |
|
|
9
|
+
| `hidden` | tidak menerima apa-apa |
|
|
10
|
+
|
|
11
|
+
Sender key dibuat baru untuk setiap pesan dan tidak disimpan, jadi device yang tidak diberi kunci tidak bisa membuka pesan meski pernah menerima pesan lain dari bot.
|
|
12
|
+
|
|
13
|
+
## API
|
|
6
14
|
|
|
7
15
|
```js
|
|
8
|
-
await sock.sPR(jid, message, options)
|
|
9
|
-
|
|
10
|
-
await sock.
|
|
16
|
+
await sock.sPR(jid, message, options) // alias: sock.relayMessageSelective
|
|
17
|
+
await sock.sPRPrivate(groupJid, targetJid, { publicText, privateText })
|
|
18
|
+
await sock.sPRBroadcast(groupJid, { template })
|
|
19
|
+
await sock.getSPRTargets(groupJid, { limit })
|
|
11
20
|
```
|
|
12
21
|
|
|
13
|
-
|
|
14
|
-
(`sPR(conn, jid, message, options)`, parameter pertama adalah socket).
|
|
22
|
+
Bisa juga di-import: `import { sPR, sPRPrivate, sPRBroadcast } from 'sauruspro-bail'` (parameter pertama adalah socket).
|
|
15
23
|
|
|
16
|
-
##
|
|
24
|
+
## sPR options
|
|
17
25
|
|
|
18
26
|
| Option | Default | Keterangan |
|
|
19
27
|
|---|---|---|
|
|
20
|
-
| `mode` | `"exclude"` | `exclude`: target **tidak** menerima. `include`: **hanya** target
|
|
21
|
-
| `target` | `[]` | Daftar JID (PN atau LID) |
|
|
28
|
+
| `mode` | `"exclude"` | `exclude`: target **tidak** menerima pesan publik. `include`: **hanya** target |
|
|
29
|
+
| `target` | `[]` | Daftar JID (PN atau LID, alias dicocokkan otomatis) |
|
|
30
|
+
| `personal` | - | Pesan khusus per orang: `{ jid: message }`, `Map`, atau `({jid,user}) => message` |
|
|
22
31
|
| `targetMe` | - | `true/false` memaksa device milik sendiri menerima/tidak |
|
|
23
|
-
| `deviceMode` | `"all"` | `all` / `primary` (device 0) / `secondary`
|
|
32
|
+
| `deviceMode` | `"all"` | `all` / `primary` (device 0) / `secondary` |
|
|
24
33
|
| `hideDecryptFail` | `true` | Sembunyikan placeholder gagal-dekripsi |
|
|
25
34
|
| `messageId` | auto | ID pesan kustom |
|
|
26
35
|
| `additionalAttributes` / `additionalNodes` | - | Atribut/node tambahan pada stanza |
|
|
27
36
|
| `useUserDevicesCache` / `useCachedGroupMetadata` | - | Pakai cache |
|
|
28
37
|
| `statusJidList` | - | Untuk status broadcast |
|
|
29
38
|
|
|
39
|
+
`message` boleh `null` bila semua penerima punya pesan `personal`.
|
|
40
|
+
|
|
30
41
|
## Contoh
|
|
31
42
|
|
|
32
43
|
```js
|
|
33
|
-
//
|
|
44
|
+
// Sembunyikan dari 1 orang
|
|
34
45
|
await sock.sPR(groupJid, { conversation: 'rahasia' }, {
|
|
35
|
-
mode: 'exclude',
|
|
36
|
-
|
|
46
|
+
mode: 'exclude', target: ['6281234567890@s.whatsapp.net']
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
// Pesan umum untuk semua, pesan lain khusus untuk A
|
|
50
|
+
await sock.sPR(groupJid, { conversation: 'info umum' }, {
|
|
51
|
+
personal: { '6281234567890@s.whatsapp.net': { conversation: 'info khusus kamu' } }
|
|
52
|
+
})
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## sPRPrivate (setara `!spr publik | privat`)
|
|
56
|
+
|
|
57
|
+
Anggota lain melihat `publicText`, `targetJid` melihat `privateText` dengan foto profilnya sendiri.
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
await sock.sPRPrivate(groupJid, targetJid, {
|
|
61
|
+
publicText: 'Pesan ini memiliki isi khusus untuk beberapa penerima.',
|
|
62
|
+
privateText: 'rahasia buat kamu',
|
|
63
|
+
avatar: true
|
|
37
64
|
})
|
|
65
|
+
// -> { id, avatar }
|
|
66
|
+
```
|
|
38
67
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
68
|
+
## sPRBroadcast (setara `!sbpr` / `!sbrp`)
|
|
69
|
+
|
|
70
|
+
Tiap anggota menerima pesan sendiri: `{name}` menjadi @mention orang itu, plus foto profilnya.
|
|
71
|
+
Anggota di luar `limit` (default 100) melihat `publicText`. Bot tidak dihitung, admin didahulukan.
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
await sock.sPRBroadcast(groupJid, {
|
|
75
|
+
template: 'Halo {name}, ada pesan untukmu.',
|
|
76
|
+
limit: 100,
|
|
77
|
+
avatar: true
|
|
43
78
|
})
|
|
79
|
+
// -> { id, targets, total, overflow, withAvatar }
|
|
44
80
|
```
|
|
45
81
|
|
|
46
|
-
|
|
82
|
+
Foto profil diambil konkuren (10 sekaligus) dengan budget 10 dtk dan batas keras 14 dtk; gagal/lambat otomatis jatuh ke pesan teks. Hasil di-cache (200 entri).
|
|
83
|
+
|
|
84
|
+
## Catatan
|
|
47
85
|
|
|
48
|
-
- `
|
|
49
|
-
-
|
|
50
|
-
- `
|
|
51
|
-
- `encodeSignedDeviceIdentity` diimpor dari `validate-connection.js` (sebelumnya salah dari `generics.js` sehingga paket gagal load).
|
|
86
|
+
- Penerima `personal` hanya melihat pesan personalnya; pesan umum tidak dikirim ke mereka.
|
|
87
|
+
- Fitur privat/broadcast diadaptasi dari plugin zapo-js (MIT).
|
|
88
|
+
- Perubahan v5.0.2: engine ditulis ulang (kode baru), tambah `personal`, `sPRPrivate`, `sPRBroadcast`, `getSPRTargets`, `loadSPRAvatars`. API `sPR`/`selectiveRelay` lama tetap kompatibel.
|
package/lib/Socket/index.js
CHANGED
|
@@ -5,7 +5,12 @@ import { makeInteropSocket } from './interop.js'
|
|
|
5
5
|
import { makePrivacySocket } from './privacy.js'
|
|
6
6
|
import { makeGraphQLSocket } from './graphql.js'
|
|
7
7
|
import { makeMessageBuilderSocket } from './message-builder.js'
|
|
8
|
-
import { sPR } from '../Utils/dinonic-spr.js'
|
|
8
|
+
import { sPR, sPRPrivate, sPRBroadcast, getSPRTargets } from '../Utils/dinonic-spr.js'
|
|
9
|
+
import { sendGreetingCard, buildGreetingCardContent } from '../Utils/greeting-card.js'
|
|
10
|
+
import * as GroupHistory from '../Utils/group-history.js'
|
|
11
|
+
import * as MetaAIBot from '../Utils/meta-ai-bot.js'
|
|
12
|
+
import { definePlugin, makePluginHost } from '../Utils/plugins.js'
|
|
13
|
+
import { makePresence, makeProfile } from '../Utils/presence-profile.js'
|
|
9
14
|
import * as DinonicBuilder from '../Utils/MessageBuilder.js'
|
|
10
15
|
import {
|
|
11
16
|
makeNewsletterStatusSender,
|
|
@@ -36,9 +41,38 @@ const makeWASocket = (config) => {
|
|
|
36
41
|
// Builder by Saurus (A2UI, AIRich, Button, ButtonV2, Carousel, Toolkit)
|
|
37
42
|
clientWithBuilder.DinonicBuilder = DinonicBuilder;
|
|
38
43
|
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
clientWithBuilder.
|
|
44
|
+
// Plugin system (sock.use) + fitur bawaan sebagai plugin (bisa dimatikan lewat config.disablePlugins)
|
|
45
|
+
const host = makePluginHost(clientWithBuilder, newConfig);
|
|
46
|
+
clientWithBuilder.use = host.use;
|
|
47
|
+
clientWithBuilder.removePlugin = host.removePlugin;
|
|
48
|
+
clientWithBuilder.hasPlugin = host.hasPlugin;
|
|
49
|
+
clientWithBuilder.listPlugins = host.listPlugins;
|
|
50
|
+
const sock = clientWithBuilder;
|
|
51
|
+
const builtinPlugins = [
|
|
52
|
+
definePlugin({
|
|
53
|
+
id: 'spr',
|
|
54
|
+
setup: ({ extend }) => extend({
|
|
55
|
+
sPR: (jid, message, options) => sPR(sock, jid, message, options),
|
|
56
|
+
relayMessageSelective: (jid, message, options) => sPR(sock, jid, message, options),
|
|
57
|
+
sPRPrivate: (groupJid, targetJid, options) => sPRPrivate(sock, groupJid, targetJid, options),
|
|
58
|
+
sPRBroadcast: (groupJid, options) => sPRBroadcast(sock, groupJid, options),
|
|
59
|
+
getSPRTargets: (groupJid, options) => getSPRTargets(sock, groupJid, options)
|
|
60
|
+
})
|
|
61
|
+
}),
|
|
62
|
+
definePlugin({
|
|
63
|
+
id: 'greeting-card',
|
|
64
|
+
setup: ({ extend }) => extend({
|
|
65
|
+
sendGreetingCard: (jid, opts, sendOptions) => sendGreetingCard(sock, jid, opts, sendOptions),
|
|
66
|
+
buildGreetingCard: buildGreetingCardContent
|
|
67
|
+
})
|
|
68
|
+
}),
|
|
69
|
+
definePlugin({ id: 'group-history', setup: ({ extend }) => extend({ GroupHistory }) }),
|
|
70
|
+
definePlugin({ id: 'meta-ai-bot', setup: ({ extend }) => extend({ MetaAIBot }) }),
|
|
71
|
+
definePlugin({ id: 'presence', exposeAs: 'presence', setup: ({ sock: s }) => makePresence(s) }),
|
|
72
|
+
definePlugin({ id: 'profile', exposeAs: 'profile', setup: ({ sock: s }) => makeProfile(s) })
|
|
73
|
+
];
|
|
74
|
+
for (const plugin of builtinPlugins) host.use(plugin);
|
|
75
|
+
for (const plugin of newConfig.plugins ?? []) host.use(plugin);
|
|
42
76
|
|
|
43
77
|
// Newsletter Status (Channel Status)
|
|
44
78
|
if (!clientWithBuilder.sendNewsletterStatus) {
|
package/lib/Socket/socket.js
CHANGED
|
@@ -735,10 +735,11 @@ export const makeSocket = (config) => {
|
|
|
735
735
|
void end(new Boom(msg || 'Intentional Logout', { statusCode: DisconnectReason.loggedOut }));
|
|
736
736
|
};
|
|
737
737
|
const requestPairingCode = async (phoneNumber, customPairingCode) => {
|
|
738
|
-
|
|
739
|
-
if (customPairingCode && customPairingCode?.length !== 8) {
|
|
738
|
+
if (customPairingCode && customPairingCode.length !== 8) {
|
|
740
739
|
throw new Error('Custom pairing code must be exactly 8 chars');
|
|
741
740
|
}
|
|
741
|
+
// Tanpa kode custom: generate acak (Crockford base32) tiap request, bukan konstanta tetap.
|
|
742
|
+
const pairingCode = customPairingCode ?? bytesToCrockford(randomBytes(5));
|
|
742
743
|
authState.creds.pairingCode = pairingCode;
|
|
743
744
|
authState.creds.me = {
|
|
744
745
|
id: jidEncode(phoneNumber, 's.whatsapp.net'),
|
package/lib/Utils/crypto.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createCipheriv, createDecipheriv, createHash, createHmac, randomBytes } from 'crypto';
|
|
2
2
|
import * as curve from 'libsignal/src/curve.js';
|
|
3
3
|
import { KEY_BUNDLE_TYPE } from '../Defaults/index.js';
|
|
4
|
+
import { getNativeCrypto } from './native-backend.js';
|
|
4
5
|
export { md5, hkdf } from 'whatsapp-rust-bridge';
|
|
5
6
|
// insure browser & node compatibility
|
|
6
7
|
const { subtle } = globalThis.crypto;
|
|
@@ -16,11 +17,34 @@ export const Curve = {
|
|
|
16
17
|
};
|
|
17
18
|
},
|
|
18
19
|
sharedKey: (privateKey, publicKey) => {
|
|
20
|
+
const native = getNativeCrypto().x25519;
|
|
21
|
+
if (native) {
|
|
22
|
+
try {
|
|
23
|
+
return Buffer.from(native(privateKey, publicKey.length === 33 ? publicKey.subarray(1) : publicKey));
|
|
24
|
+
}
|
|
25
|
+
catch { /* fallback ke JS */ }
|
|
26
|
+
}
|
|
19
27
|
const shared = curve.calculateAgreement(generateSignalPubKey(publicKey), privateKey);
|
|
20
28
|
return Buffer.from(shared);
|
|
21
29
|
},
|
|
22
|
-
sign: (privateKey, buf) =>
|
|
30
|
+
sign: (privateKey, buf) => {
|
|
31
|
+
const native = getNativeCrypto().xeddsaSign;
|
|
32
|
+
if (native) {
|
|
33
|
+
try {
|
|
34
|
+
return Buffer.from(native(privateKey, buf));
|
|
35
|
+
}
|
|
36
|
+
catch { /* fallback ke JS */ }
|
|
37
|
+
}
|
|
38
|
+
return curve.calculateSignature(privateKey, buf);
|
|
39
|
+
},
|
|
23
40
|
verify: (pubKey, message, signature) => {
|
|
41
|
+
const native = getNativeCrypto().xeddsaVerify;
|
|
42
|
+
if (native) {
|
|
43
|
+
try {
|
|
44
|
+
return !!native(pubKey.length === 33 ? pubKey.subarray(1) : pubKey, message, signature);
|
|
45
|
+
}
|
|
46
|
+
catch { /* fallback ke JS */ }
|
|
47
|
+
}
|
|
24
48
|
try {
|
|
25
49
|
curve.verifySignature(generateSignalPubKey(pubKey), message, signature);
|
|
26
50
|
return true;
|
|
@@ -1,26 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
export function deriveReportingTag(message: any, msgId: string, remoteJid: string): Buffer;
|
|
10
|
-
export function encryptGroupMessage(plaintext: Buffer | Uint8Array, chainSeed: Buffer, privateKeyObject: any, keyId: number): Buffer;
|
|
11
|
-
export function createSKDM(keyId: number, iteration: number, chainSeed: Buffer, signingPubKey: Buffer): Buffer;
|
|
12
|
-
export function sPR(conn: any, jid: string, message: any, options?: {
|
|
1
|
+
type Jid = string;
|
|
2
|
+
type PersonalInput =
|
|
3
|
+
| ((ctx: { jid: Jid; user: string }) => any | null)
|
|
4
|
+
| Map<Jid, any>
|
|
5
|
+
| Record<Jid, any>;
|
|
6
|
+
|
|
7
|
+
export interface SPROptions {
|
|
13
8
|
messageId?: string;
|
|
14
9
|
additionalAttributes?: any;
|
|
10
|
+
additionalNodes?: any[];
|
|
15
11
|
useUserDevicesCache?: boolean;
|
|
16
12
|
useCachedGroupMetadata?: boolean;
|
|
17
13
|
statusJidList?: string[];
|
|
18
|
-
additionalNodes?: any[];
|
|
19
14
|
targetMe?: boolean;
|
|
15
|
+
/** Berlaku untuk pesan publik. */
|
|
20
16
|
mode?: "include" | "exclude";
|
|
21
|
-
target?:
|
|
22
|
-
hideDecryptFail?: boolean;
|
|
17
|
+
target?: Jid[];
|
|
23
18
|
deviceMode?: "all" | "primary" | "secondary";
|
|
24
|
-
|
|
19
|
+
hideDecryptFail?: boolean;
|
|
20
|
+
/** Pesan khusus per orang. Penerima personal tidak menerima pesan publik. */
|
|
21
|
+
personal?: PersonalInput;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const SPR_LIMITS: Readonly<{
|
|
25
|
+
targets: number;
|
|
26
|
+
concurrency: number;
|
|
27
|
+
encryptConcurrency: number;
|
|
28
|
+
avatarBudgetMs: number;
|
|
29
|
+
avatarHardCapMs: number;
|
|
30
|
+
avatarFetchMs: number;
|
|
31
|
+
cacheSize: number;
|
|
32
|
+
}>;
|
|
33
|
+
export const SPR_TEXT: Readonly<Record<string, string>>;
|
|
34
|
+
|
|
35
|
+
export function createOneShotSenderKey(): {
|
|
36
|
+
keyId: number;
|
|
37
|
+
distribution(): Buffer;
|
|
38
|
+
seal(plaintext: Buffer | Uint8Array): Buffer;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export function sPR(conn: any, jid: Jid, message: any | null, options?: SPROptions): Promise<string>;
|
|
25
42
|
export const selectiveRelay: typeof sPR;
|
|
43
|
+
|
|
44
|
+
export function getSPRTargets(conn: any, groupJid: Jid, options?: { limit?: number; exclude?: Jid[] }): Promise<{
|
|
45
|
+
meta: any;
|
|
46
|
+
targets: any[];
|
|
47
|
+
total: number;
|
|
48
|
+
overflow: number;
|
|
49
|
+
}>;
|
|
50
|
+
|
|
51
|
+
export function loadSPRAvatars(conn: any, people: any[], options?: {
|
|
52
|
+
concurrency?: number;
|
|
53
|
+
budgetMs?: number;
|
|
54
|
+
hardCapMs?: number;
|
|
55
|
+
fetchMs?: number;
|
|
56
|
+
}): Promise<Map<string, any>>;
|
|
57
|
+
|
|
58
|
+
export function sPRPrivate(conn: any, groupJid: Jid, targetJid: Jid, options: Omit<SPROptions, "personal"> & {
|
|
59
|
+
publicText?: string;
|
|
60
|
+
privateText: string;
|
|
61
|
+
avatar?: boolean;
|
|
62
|
+
mentionTarget?: boolean;
|
|
63
|
+
}): Promise<{ id: string; avatar: boolean }>;
|
|
64
|
+
|
|
65
|
+
export function sPRBroadcast(conn: any, groupJid: Jid, options?: Omit<SPROptions, "personal"> & {
|
|
66
|
+
template?: string;
|
|
67
|
+
publicText?: string;
|
|
68
|
+
limit?: number;
|
|
69
|
+
exclude?: Jid[];
|
|
70
|
+
avatar?: boolean;
|
|
71
|
+
}): Promise<{ id: string; targets: number; total: number; overflow: number; withAvatar: number }>;
|
|
72
|
+
|
|
26
73
|
export default sPR;
|