@prototypevip/baileys 0.1.2 → 0.1.4

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.
Files changed (42) hide show
  1. package/lib/Signal/Group/group_cipher.js +1 -1
  2. package/lib/Signal/Group/keyhelper.js +1 -1
  3. package/lib/Signal/Group/sender-chain-key.js +1 -1
  4. package/lib/Signal/Group/sender-key-message.js +1 -1
  5. package/lib/Signal/Group/sender-message-key.js +1 -1
  6. package/lib/Signal/libsignal-wasm/LICENSE +621 -0
  7. package/lib/Signal/libsignal-wasm/NOTICE.md +11 -0
  8. package/lib/Signal/libsignal-wasm/README.md +64 -0
  9. package/lib/Signal/libsignal-wasm/index.d.ts +55 -0
  10. package/lib/Signal/libsignal-wasm/index.js +14 -0
  11. package/lib/Signal/libsignal-wasm/protos/WhisperTextProtocol.proto +28 -0
  12. package/lib/Signal/libsignal-wasm/src/WhisperTextProtocol.js +931 -0
  13. package/lib/Signal/libsignal-wasm/src/base_key_type.js +7 -0
  14. package/lib/Signal/libsignal-wasm/src/chain_type.js +6 -0
  15. package/lib/Signal/libsignal-wasm/src/crypto.d.ts +19 -0
  16. package/lib/Signal/libsignal-wasm/src/crypto.js +77 -0
  17. package/lib/Signal/libsignal-wasm/src/curve.d.ts +22 -0
  18. package/lib/Signal/libsignal-wasm/src/curve.js +69 -0
  19. package/lib/Signal/libsignal-wasm/src/errors.js +33 -0
  20. package/lib/Signal/libsignal-wasm/src/keyhelper.js +45 -0
  21. package/lib/Signal/libsignal-wasm/src/numeric_fingerprint.js +72 -0
  22. package/lib/Signal/libsignal-wasm/src/protobufs.js +5 -0
  23. package/lib/Signal/libsignal-wasm/src/protocol_address.js +40 -0
  24. package/lib/Signal/libsignal-wasm/src/queue_job.js +68 -0
  25. package/lib/Signal/libsignal-wasm/src/session_builder.js +162 -0
  26. package/lib/Signal/libsignal-wasm/src/session_cipher.js +336 -0
  27. package/lib/Signal/libsignal-wasm/src/session_record.js +316 -0
  28. package/lib/Signal/libsignal.js +2 -2
  29. package/lib/Socket/index.js +30 -15
  30. package/lib/Utils/crypto.js +1 -1
  31. package/lib/Utils/generics.js +4 -27
  32. package/lib/Utils/index.js +3 -0
  33. package/lib/Utils/modern-messages.js +10 -0
  34. package/lib/Utils/newsletter-status.js +651 -0
  35. package/lib/Utils/status-helpers.js +143 -0
  36. package/package.json +2 -3
  37. package/lib/Defaults/index.js.bak-1788476907801 +0 -187
  38. package/lib/Defaults/index.js.bak-1788479166288 +0 -187
  39. package/lib/Socket/groups.js.bak-1788476973954 +0 -475
  40. package/lib/Socket/index.js.bak-1788479281092 +0 -38
  41. package/lib/Store/prototype-store.js.bak-1788477006895 +0 -983
  42. package/lib/Utils/interactive-message-handler.js.bak-1788476898661 +0 -478
@@ -0,0 +1,64 @@
1
+ libsignal-node
2
+ ========
3
+ Signal protocol implementation for Node.js based on
4
+ [libsignal-protocol-javascript](https://github.com/WhisperSystems/libsignal-protocol-javascript).
5
+
6
+ [![npm](https://img.shields.io/npm/v/libsignal.svg)](https://www.npmjs.com/package/libsignal)
7
+ [![npm](https://img.shields.io/npm/l/libsignal.svg)](https://github.com/ForstaLabs/libsignal-node)
8
+
9
+
10
+ Overview
11
+ --------
12
+ A ratcheting forward secrecy protocol that works in synchronous and
13
+ asynchronous messaging environments.
14
+
15
+
16
+ PreKeys
17
+ --------
18
+ This protocol uses a concept called 'PreKeys'. A PreKey is an ECPublicKey and
19
+ an associated unique ID which are stored together by a server. PreKeys can also
20
+ be signed.
21
+
22
+ At install time, clients generate a single signed PreKey, as well as a large
23
+ list of unsigned PreKeys, and transmit all of them to the server.
24
+
25
+
26
+ Sessions
27
+ --------
28
+ Signal Protocol is session-oriented. Clients establish a "session," which is
29
+ then used for all subsequent encrypt/decrypt operations. There is no need to
30
+ ever tear down a session once one has been established.
31
+
32
+ Sessions are established in one of two ways:
33
+
34
+ 1. PreKeyBundles. A client that wishes to send a message to a recipient can
35
+ establish a session by retrieving a PreKeyBundle for that recipient from the
36
+ server.
37
+ 2. PreKeySignalMessages. A client can receive a PreKeySignalMessage from a
38
+ recipient and use it to establish a session.
39
+
40
+
41
+ State
42
+ --------
43
+ An established session encapsulates a lot of state between two clients. That
44
+ state is maintained in durable records which need to be kept for the life of
45
+ the session.
46
+
47
+ State is kept in the following places:
48
+
49
+ * Identity State. Clients will need to maintain the state of their own identity
50
+ key pair, as well as identity keys received from other clients.
51
+ * PreKey State. Clients will need to maintain the state of their generated
52
+ PreKeys.
53
+ * Signed PreKey States. Clients will need to maintain the state of their signed
54
+ PreKeys.
55
+ * Session State. Clients will need to maintain the state of the sessions they
56
+ have established.
57
+
58
+
59
+ License
60
+ --------
61
+ Licensed under the GPLv3: http://www.gnu.org/licenses/gpl-3.0.html
62
+
63
+ * Copyright 2015-2016 Open Whisper Systems
64
+ * Copyright 2017-2018 Forsta Inc
@@ -0,0 +1,55 @@
1
+ interface E2ESession {
2
+ registrationId: number;
3
+ identityKey: Uint8Array;
4
+ signedPreKey: {
5
+ keyId: number;
6
+ publicKey: Uint8Array;
7
+ signature: Uint8Array;
8
+ };
9
+ preKey: {
10
+ keyId: number;
11
+ publicKey: Uint8Array;
12
+ };
13
+ }
14
+
15
+ export interface SignalStorage {
16
+ loadSession(id: string): Promise<SessionRecord | null | undefined>;
17
+ storeSession(id: string, session: SessionRecord): Promise<void>;
18
+ isTrustedIdentity(
19
+ identifier: string,
20
+ identityKey: Uint8Array,
21
+ direction: number
22
+ ): boolean;
23
+ loadPreKey(
24
+ id: number | string
25
+ ): Promise<{ privKey: Buffer; pubKey: Buffer } | undefined>;
26
+ removePreKey(id: number): void;
27
+ loadSignedPreKey(): { privKey: Buffer; pubKey: Buffer };
28
+ getOurRegistrationId(): Promise<number> | number;
29
+ getOurIdentity(): { privKey: Buffer; pubKey: Buffer };
30
+ }
31
+
32
+ export class ProtocolAddress {
33
+ constructor(name: string, deviceId: number);
34
+ public id: string;
35
+ public deviceId: number;
36
+ public toString(): string;
37
+ }
38
+
39
+ export class SessionRecord {
40
+ static deserialize(serialized: Uint8Array): SessionRecord;
41
+ public serialize(): Uint8Array;
42
+ public haveOpenSession(): boolean;
43
+ }
44
+
45
+ export class SessionCipher {
46
+ constructor(storage: SignalStorage, remoteAddress: ProtocolAddress);
47
+ public decryptPreKeyWhisperMessage(ciphertext: Uint8Array): Promise<Buffer>;
48
+ public decryptWhisperMessage(ciphertext: Uint8Array): Promise<Buffer>;
49
+ public encrypt(data: Uint8Array): Promise<{ type: number; body: string }>;
50
+ }
51
+
52
+ export class SessionBuilder {
53
+ constructor(storage: SignalStorage, remoteAddress: ProtocolAddress);
54
+ public initOutgoing(session: E2ESession): Promise<void>;
55
+ }
@@ -0,0 +1,14 @@
1
+ export * as crypto from './src/crypto.js';
2
+ export * as curve from './src/curve.js';
3
+ export * as keyhelper from './src/keyhelper.js';
4
+ export { default as ProtocolAddress } from './src/protocol_address.js';
5
+ export { default as SessionBuilder } from './src/session_builder.js';
6
+ export { default as SessionCipher } from './src/session_cipher.js';
7
+ export { default as SessionRecord } from './src/session_record.js';
8
+ export {
9
+ SignalError,
10
+ UntrustedIdentityKeyError,
11
+ SessionError,
12
+ MessageCounterError,
13
+ PreKeyError
14
+ } from './src/errors.js';
@@ -0,0 +1,28 @@
1
+ package textsecure;
2
+
3
+ option java_package = "org.whispersystems.libsignal.protocol";
4
+ option java_outer_classname = "WhisperProtos";
5
+
6
+ message WhisperMessage {
7
+ optional bytes ephemeralKey = 1;
8
+ optional uint32 counter = 2;
9
+ optional uint32 previousCounter = 3;
10
+ optional bytes ciphertext = 4; // PushMessageContent
11
+ }
12
+
13
+ message PreKeyWhisperMessage {
14
+ optional uint32 registrationId = 5;
15
+ optional uint32 preKeyId = 1;
16
+ optional uint32 signedPreKeyId = 6;
17
+ optional bytes baseKey = 2;
18
+ optional bytes identityKey = 3;
19
+ optional bytes message = 4; // WhisperMessage
20
+ }
21
+
22
+ message KeyExchangeMessage {
23
+ optional uint32 id = 1;
24
+ optional bytes baseKey = 2;
25
+ optional bytes ephemeralKey = 3;
26
+ optional bytes identityKey = 4;
27
+ optional bytes baseKeySignature = 5;
28
+ }