@langitdeveloper/baileys 2.0.5 → 2.0.7

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.
@@ -105,6 +105,21 @@ function makeLibSignalRepository(auth) {
105
105
  const cipher = new libsignal.SessionBuilder(storage, jidToSignalProtocolAddress(jid));
106
106
  await cipher.initOutgoing(session);
107
107
  },
108
+ async validateSession(jid) {
109
+ try {
110
+ const addr = jidToSignalProtocolAddress(jid);
111
+ const session = await storage.loadSession(addr.toString());
112
+ if (!session) {
113
+ return { exists: false, reason: 'no session' };
114
+ }
115
+ if (!session.haveOpenSession()) {
116
+ return { exists: false, reason: 'no open session' };
117
+ }
118
+ return { exists: true };
119
+ } catch (error) {
120
+ return { exists: false, reason: 'validation error' };
121
+ }
122
+ },
108
123
  jidToSignalProtocolAddress(jid) {
109
124
  return jidToSignalProtocolAddress(jid).toString();
110
125
  }
@@ -7,7 +7,7 @@ const { proto: proto } = require("../../WAProto");
7
7
  const {
8
8
  DEFAULT_CACHE_TTLS: DEFAULT_CACHE_TTLS,
9
9
  WA_DEFAULT_EPHEMERAL: WA_DEFAULT_EPHEMERAL,
10
- } = require("../Defaults/constants");
10
+ } = require("../Defaults");
11
11
  const {
12
12
  delay: delay,
13
13
  assertMediaContent: assertMediaContent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langitdeveloper/baileys",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "WhatsApp API Modification By Langit",
5
5
  "keywords": [
6
6
  "whatsapp",