-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathotr.js
43 lines (40 loc) · 1.06 KB
/
otr.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* JavaScript Implementation of Off-the-Record Messaging
* http://www.cypherpunks.ca/otr/
* See "README" for details
*
* @author Khandar William
* @namespace Otr
*
* 2012-07-02 initial commit, some constants
* 2012-07-19 use MIT license
*/
var Otr = Otr || (function () {
"use strict";
// Constants
var _ = {
// Message state
MSGSTATE_PLAINTEXT: 0,
MSGSTATE_ENCRYPTED: 1,
MSGSTATE_FINISHED: 2,
// Authentication state
AUTHSTATE_NONE: 0,
AUTHSTATE_AWAITING_DHKEY: 1,
AUTHSTATE_AWAITING_REVEALSIG: 2,
AUTHSTATE_AWAITING_SIG: 3,
AUTHSTATE_V1_SETUP: 4,
// Policies
ALLOW_V1: 0x01,
ALLOW_V2: 0x02,
REQUIRE_ENCRYPTION: 0x04,
SEND_WHITESPACE_TAG: 0x08,
WHITESPACE_START_AKE: 0x10,
ERROR_START_AKE: 0x20
};
// The four old version 1 policies
_.NEVER = 0x00;
_.MANUAL = (_.ALLOW_V1 | _.ALLOW_V2);
_.OPPORTUNISTIC = (_.ALLOW_V1 | _.ALLOW_V2 | _.SEND_WHITESPACE_TAG | _.WHITESPACE_START_AKE | _.ERROR_START_AKE);
_.ALWAYS = (_.ALLOW_V1 | _.ALLOW_V2 | _.REQUIRE_ENCRYPTION | _.WHITESPACE_START_AKE | _.ERROR_START_AKE);
return _;
}());