faye-authentication 0.4.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.drone.yml +10 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile +0 -3
- data/README.md +47 -26
- data/VERSION +1 -0
- data/app/assets/javascripts/faye-authentication.js +18 -11
- data/faye-authentication.gemspec +3 -2
- data/lib/faye/authentication/client_extension.rb +1 -1
- data/lib/faye/authentication/server_extension.rb +3 -2
- data/lib/faye/authentication/version.rb +1 -1
- data/lib/faye/authentication.rb +20 -8
- data/spec/javascripts/faye-authentication_spec.js +151 -48
- data/spec/javascripts/faye-extension_spec.js +1 -1
- data/spec/javascripts/support/jasmine.yml +1 -1
- data/spec/lib/faye/authentication/server_extension_spec.rb +14 -24
- data/spec/lib/faye/authentication_spec.rb +91 -1
- data/spec/utils/javascripts/faye.js +388 -290
- metadata +27 -15
- data/spec/utils/javascripts/core.js +0 -712
- data/spec/utils/javascripts/sha1.js +0 -136
@@ -1,136 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
CryptoJS v3.1.2
|
3
|
-
code.google.com/p/crypto-js
|
4
|
-
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
5
|
-
code.google.com/p/crypto-js/wiki/License
|
6
|
-
*/
|
7
|
-
(function () {
|
8
|
-
// Shortcuts
|
9
|
-
var C = CryptoJS;
|
10
|
-
var C_lib = C.lib;
|
11
|
-
var WordArray = C_lib.WordArray;
|
12
|
-
var Hasher = C_lib.Hasher;
|
13
|
-
var C_algo = C.algo;
|
14
|
-
|
15
|
-
// Reusable object
|
16
|
-
var W = [];
|
17
|
-
|
18
|
-
/**
|
19
|
-
* SHA-1 hash algorithm.
|
20
|
-
*/
|
21
|
-
var SHA1 = C_algo.SHA1 = Hasher.extend({
|
22
|
-
_doReset: function () {
|
23
|
-
this._hash = new WordArray.init([
|
24
|
-
0x67452301, 0xefcdab89,
|
25
|
-
0x98badcfe, 0x10325476,
|
26
|
-
0xc3d2e1f0
|
27
|
-
]);
|
28
|
-
},
|
29
|
-
|
30
|
-
_doProcessBlock: function (M, offset) {
|
31
|
-
// Shortcut
|
32
|
-
var H = this._hash.words;
|
33
|
-
|
34
|
-
// Working variables
|
35
|
-
var a = H[0];
|
36
|
-
var b = H[1];
|
37
|
-
var c = H[2];
|
38
|
-
var d = H[3];
|
39
|
-
var e = H[4];
|
40
|
-
|
41
|
-
// Computation
|
42
|
-
for (var i = 0; i < 80; i++) {
|
43
|
-
if (i < 16) {
|
44
|
-
W[i] = M[offset + i] | 0;
|
45
|
-
} else {
|
46
|
-
var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
|
47
|
-
W[i] = (n << 1) | (n >>> 31);
|
48
|
-
}
|
49
|
-
|
50
|
-
var t = ((a << 5) | (a >>> 27)) + e + W[i];
|
51
|
-
if (i < 20) {
|
52
|
-
t += ((b & c) | (~b & d)) + 0x5a827999;
|
53
|
-
} else if (i < 40) {
|
54
|
-
t += (b ^ c ^ d) + 0x6ed9eba1;
|
55
|
-
} else if (i < 60) {
|
56
|
-
t += ((b & c) | (b & d) | (c & d)) - 0x70e44324;
|
57
|
-
} else /* if (i < 80) */ {
|
58
|
-
t += (b ^ c ^ d) - 0x359d3e2a;
|
59
|
-
}
|
60
|
-
|
61
|
-
e = d;
|
62
|
-
d = c;
|
63
|
-
c = (b << 30) | (b >>> 2);
|
64
|
-
b = a;
|
65
|
-
a = t;
|
66
|
-
}
|
67
|
-
|
68
|
-
// Intermediate hash value
|
69
|
-
H[0] = (H[0] + a) | 0;
|
70
|
-
H[1] = (H[1] + b) | 0;
|
71
|
-
H[2] = (H[2] + c) | 0;
|
72
|
-
H[3] = (H[3] + d) | 0;
|
73
|
-
H[4] = (H[4] + e) | 0;
|
74
|
-
},
|
75
|
-
|
76
|
-
_doFinalize: function () {
|
77
|
-
// Shortcuts
|
78
|
-
var data = this._data;
|
79
|
-
var dataWords = data.words;
|
80
|
-
|
81
|
-
var nBitsTotal = this._nDataBytes * 8;
|
82
|
-
var nBitsLeft = data.sigBytes * 8;
|
83
|
-
|
84
|
-
// Add padding
|
85
|
-
dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
|
86
|
-
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
|
87
|
-
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
|
88
|
-
data.sigBytes = dataWords.length * 4;
|
89
|
-
|
90
|
-
// Hash final blocks
|
91
|
-
this._process();
|
92
|
-
|
93
|
-
// Return final computed hash
|
94
|
-
return this._hash;
|
95
|
-
},
|
96
|
-
|
97
|
-
clone: function () {
|
98
|
-
var clone = Hasher.clone.call(this);
|
99
|
-
clone._hash = this._hash.clone();
|
100
|
-
|
101
|
-
return clone;
|
102
|
-
}
|
103
|
-
});
|
104
|
-
|
105
|
-
/**
|
106
|
-
* Shortcut function to the hasher's object interface.
|
107
|
-
*
|
108
|
-
* @param {WordArray|string} message The message to hash.
|
109
|
-
*
|
110
|
-
* @return {WordArray} The hash.
|
111
|
-
*
|
112
|
-
* @static
|
113
|
-
*
|
114
|
-
* @example
|
115
|
-
*
|
116
|
-
* var hash = CryptoJS.SHA1('message');
|
117
|
-
* var hash = CryptoJS.SHA1(wordArray);
|
118
|
-
*/
|
119
|
-
C.SHA1 = Hasher._createHelper(SHA1);
|
120
|
-
|
121
|
-
/**
|
122
|
-
* Shortcut function to the HMAC's object interface.
|
123
|
-
*
|
124
|
-
* @param {WordArray|string} message The message to hash.
|
125
|
-
* @param {WordArray|string} key The secret key.
|
126
|
-
*
|
127
|
-
* @return {WordArray} The HMAC.
|
128
|
-
*
|
129
|
-
* @static
|
130
|
-
*
|
131
|
-
* @example
|
132
|
-
*
|
133
|
-
* var hmac = CryptoJS.HmacSHA1(message, key);
|
134
|
-
*/
|
135
|
-
C.HmacSHA1 = Hasher._createHmacHelper(SHA1);
|
136
|
-
}());
|