@teamolduser/libsignal 1.0.1
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/LICENSE +621 -0
- package/README.md +64 -0
- package/index.d.ts +55 -0
- package/index.js +10 -0
- package/package.json +33 -0
- package/src/.eslintrc.json +31 -0
- package/src/WhisperTextProtocol.js +933 -0
- package/src/base_key_type.js +7 -0
- package/src/chain_type.js +6 -0
- package/src/crypto.d.ts +19 -0
- package/src/crypto.js +98 -0
- package/src/curve.d.ts +22 -0
- package/src/curve.js +142 -0
- package/src/errors.js +33 -0
- package/src/keyhelper.js +45 -0
- package/src/numeric_fingerprint.js +72 -0
- package/src/protobufs.js +10 -0
- package/src/protocol_address.js +40 -0
- package/src/queue_job.js +69 -0
- package/src/session_builder.js +164 -0
- package/src/session_cipher.js +336 -0
- package/src/session_record.js +317 -0
package/index.d.ts
ADDED
|
@@ -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
|
+
}
|
package/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.crypto = require('./src/crypto');
|
|
4
|
+
exports.curve = require('./src/curve');
|
|
5
|
+
exports.keyhelper = require('./src/keyhelper');
|
|
6
|
+
exports.ProtocolAddress = require('./src/protocol_address');
|
|
7
|
+
exports.SessionBuilder = require('./src/session_builder');
|
|
8
|
+
exports.SessionCipher = require('./src/session_cipher');
|
|
9
|
+
exports.SessionRecord = require('./src/session_record');
|
|
10
|
+
Object.assign(exports, require('./src/errors'));
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@teamolduser/libsignal",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Open Whisper Systems' libsignal for Node.js",
|
|
5
|
+
"repository": "WhiskeySockets/libsignal-node",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"types": "index.d.ts",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"signal",
|
|
10
|
+
"whispersystems",
|
|
11
|
+
"crypto"
|
|
12
|
+
],
|
|
13
|
+
"license": "GPL-3.0",
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"curve25519-js": "^0.0.4",
|
|
16
|
+
"protobufjs": "^7.5.5"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"src/*",
|
|
20
|
+
"index.d.ts"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"release": "release-it",
|
|
24
|
+
"changelog:last": "conventional-changelog -p angular -r 2",
|
|
25
|
+
"changelog:preview": "conventional-changelog -p angular -u",
|
|
26
|
+
"changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"conventional-changelog-cli": "^4.1.0",
|
|
30
|
+
"eslint": "^9",
|
|
31
|
+
"release-it": "^20.0.1"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parserOptions": {
|
|
3
|
+
"ecmaVersion": 8
|
|
4
|
+
},
|
|
5
|
+
"env": {
|
|
6
|
+
"es6": true,
|
|
7
|
+
"node": true
|
|
8
|
+
},
|
|
9
|
+
"extends": "eslint:recommended",
|
|
10
|
+
"rules": {
|
|
11
|
+
"quotes": "off",
|
|
12
|
+
"semi": [
|
|
13
|
+
"error",
|
|
14
|
+
"always"
|
|
15
|
+
],
|
|
16
|
+
"no-console": "off",
|
|
17
|
+
"no-debugger": "off",
|
|
18
|
+
"no-unused-vars": [
|
|
19
|
+
"error",
|
|
20
|
+
{
|
|
21
|
+
"args": "none"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"no-constant-condition": [
|
|
25
|
+
"error",
|
|
26
|
+
{
|
|
27
|
+
"checkLoops": false
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}
|