Skip to content

Commit 240dfa3

Browse files
committed
improve test secret
1 parent 962beac commit 240dfa3

File tree

8 files changed

+36
-36
lines changed

8 files changed

+36
-36
lines changed

tests/integration/pusher/authenticate.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,43 @@ describe("Pusher", function () {
66
var pusher
77

88
beforeEach(function () {
9-
pusher = new Pusher({ appId: 10000, key: "aaaa", secret: "beef" })
9+
pusher = new Pusher({ appId: 10000, key: "aaaa", secret: "tofu" })
1010
})
1111

1212
describe("#auth", function () {
1313
it("should prefix the signature with the app key", function () {
14-
var pusher = new Pusher({ appId: 10000, key: "1234", secret: "beef" })
14+
var pusher = new Pusher({ appId: 10000, key: "1234", secret: "tofu" })
1515
expect(pusher.authenticate("123.456", "test")).to.eql({
1616
auth:
17-
"1234:d16bec9b73b4b3b9186bc5ce87daddc14e6afa714f663fd35839f94be1707ea3",
17+
"1234:efa6cf7644a0b35cba36aa0f776f3cbf7bb60e95ea2696bde1dbe8403b61bd7c",
1818
})
1919

20-
pusher = new Pusher({ appId: 10000, key: "abcdef", secret: "beef" })
20+
pusher = new Pusher({ appId: 10000, key: "abcdef", secret: "tofu" })
2121
expect(pusher.authenticate("123.456", "test")).to.eql({
2222
auth:
23-
"abcdef:d16bec9b73b4b3b9186bc5ce87daddc14e6afa714f663fd35839f94be1707ea3",
23+
"abcdef:efa6cf7644a0b35cba36aa0f776f3cbf7bb60e95ea2696bde1dbe8403b61bd7c",
2424
})
2525
})
2626

2727
it("should return correct authentication signatures for different socket ids", function () {
2828
expect(pusher.authenticate("123.456", "test")).to.eql({
2929
auth:
30-
"aaaa:d16bec9b73b4b3b9186bc5ce87daddc14e6afa714f663fd35839f94be1707ea3",
30+
"aaaa:efa6cf7644a0b35cba36aa0f776f3cbf7bb60e95ea2696bde1dbe8403b61bd7c",
3131
})
3232
expect(pusher.authenticate("321.654", "test")).to.eql({
3333
auth:
34-
"aaaa:69858dbfae85099306caa764f698d4e29970d93baa746a6df6788c92c0ec4409",
34+
"aaaa:f6ecb0a17d3e4f68aca28f1673197a7608587c09deb0208faa4b5519aee0a777",
3535
})
3636
})
3737

3838
it("should return correct authentication signatures for different channels", function () {
3939
expect(pusher.authenticate("123.456", "test1")).to.eql({
4040
auth:
41-
"aaaa:2e8533af473c22fbf5456375ace186413bcdd64513edefc60657d7327c1a43af",
41+
"aaaa:d5ab857f805433cb50562da96afa41688d7742a3c3a021ed15a4d991a4d8cf94",
4242
})
4343
expect(pusher.authenticate("123.456", "test2")).to.eql({
4444
auth:
45-
"aaaa:c26e4dce5ab543b2deac513708ea03e91aac2cd1caa4cdd261fc7739ba09cfbe",
45+
"aaaa:43affa6a09af1fb9ce1cadf176171346beaf7366673ec1e5920f68b3e97a466d",
4646
})
4747
})
4848

@@ -68,19 +68,19 @@ describe("Pusher", function () {
6868
it("should return correct authentication signatures with and without the channel data", function () {
6969
expect(pusher.authenticate("123.456", "test")).to.eql({
7070
auth:
71-
"aaaa:d16bec9b73b4b3b9186bc5ce87daddc14e6afa714f663fd35839f94be1707ea3",
71+
"aaaa:efa6cf7644a0b35cba36aa0f776f3cbf7bb60e95ea2696bde1dbe8403b61bd7c",
7272
})
7373
expect(pusher.authenticate("123.456", "test", { foo: "bar" })).to.eql({
7474
auth:
75-
"aaaa:4ec8fab54df3950d32d95a579e46b53060ea3579bc678842a80b7c530f90d439",
75+
"aaaa:f41faf9ead2ea76772cc6b1168363057459f02499ae4d92e88229dc7f4efa2d4",
7676
channel_data: '{"foo":"bar"}',
7777
})
7878
})
7979

8080
it("should return correct authentication signature with utf-8 in channel data", function () {
8181
expect(pusher.authenticate("1.1", "test", "ą§¶™€łü€ß£")).to.eql({
8282
auth:
83-
"aaaa:0d392e309f194ebfd063409e2a35d1e5f0fb0148e6ff5e9e92233816a70f2a12",
83+
"aaaa:2a229263e89d9c50524fd80c2e88be2843379f6931e28995e2cc214282c9db0c",
8484
channel_data: '"ą§¶™€łü€ß£"',
8585
})
8686
})
@@ -155,7 +155,7 @@ describe("Pusher with encryptionMasterKey", function () {
155155
pusher = new Pusher({
156156
appId: 1234,
157157
key: "f00d",
158-
secret: "beef",
158+
secret: "tofu",
159159
encryptionMasterKey: testMasterKey,
160160
})
161161
})
@@ -166,15 +166,15 @@ describe("Pusher with encryptionMasterKey", function () {
166166
pusher.authenticate("123.456", "private-encrypted-bla", "foo")
167167
).to.eql({
168168
auth:
169-
"f00d:d8df1e524cf38fbde4f1dc38e6eaa4943e60412122801eed1f0e89c8a1268784",
169+
"f00d:962c48b78bf93d98ff4c92ee7dff04865821455b7b401e9d60a9e0a90af2c105",
170170
channel_data: '"foo"',
171171
shared_secret: "BYBsePpRCQkGPvbWu/5j8x+MmUF5sgPH5DmNBwkTzYs=",
172172
})
173173
})
174174
it("should not return a shared_secret for non-encrypted channels", function () {
175175
expect(pusher.authenticate("123.456", "bla", "foo")).to.eql({
176176
auth:
177-
"f00d:4c48fa1cb34537501eb3291b28c0b04de270008ae418bc3141f4f11680abe312",
177+
"f00d:013ad3da0d88e0df6ae0a8184bef50b9c3933f2344499e6e3d1ad67fad799e20",
178178
channel_data: '"foo"',
179179
})
180180
})

tests/integration/pusher/create_signed_query_string.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe("Pusher", function () {
77
var pusher
88

99
beforeEach(function () {
10-
pusher = new Pusher({ appId: 1234, key: "f00d", secret: "beef" })
10+
pusher = new Pusher({ appId: 1234, key: "f00d", secret: "tofu" })
1111
})
1212

1313
describe("#createSignedQueryString", function () {
@@ -69,7 +69,7 @@ describe("Pusher", function () {
6969
})
7070
// Date.now is mocked, so the signature can be hardcoded
7171
expect(queryString).to.match(
72-
/^(.*&)?auth_signature=89323a7f200fdefaa992e73e0953534dbb94c4dd2450514bcb4721b28b14fb26(&.*)?$/
72+
/^(.*&)?auth_signature=a650196dc427ebe837226f8565ca9232198c6d1b9455eaa72374a9dc0b620e7b(&.*)?$/
7373
)
7474
})
7575
})
@@ -121,7 +121,7 @@ describe("Pusher", function () {
121121
})
122122
// Date.now is mocked, so the signature can be hardcoded
123123
expect(queryString).to.match(
124-
/^(.*&)?auth_signature=8df535ace13ffd2e77b023f251ba9a6b0c4e5c307b3cc6a2ca42d559109db7c8(&.*)?$/
124+
/^(.*&)?auth_signature=d8bdbd31911fb7400a14fbd36fd7de053494725b64400ae5856deafe304b34a9(&.*)?$/
125125
)
126126
})
127127

tests/integration/pusher/get.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe("Pusher", function () {
77
var pusher
88

99
beforeEach(function () {
10-
pusher = new Pusher({ appId: 999, key: "111111", secret: "beef" })
10+
pusher = new Pusher({ appId: 999, key: "111111", secret: "tofu" })
1111
nock.disableNetConnect()
1212
})
1313

@@ -93,7 +93,7 @@ describe("Pusher", function () {
9393
var pusher = new Pusher({
9494
appId: 999,
9595
key: "111111",
96-
secret: "beef",
96+
secret: "tofu",
9797
useTLS: true,
9898
host: "example.com",
9999
port: 1234,
@@ -119,7 +119,7 @@ describe("Pusher", function () {
119119
var pusher = new Pusher({
120120
appId: 999,
121121
key: "111111",
122-
secret: "beef",
122+
secret: "tofu",
123123
timeout: 100,
124124
})
125125
var mock = nock("http://api.pusherapp.com")

tests/integration/pusher/notification_client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe("NativeNotificationClient", function () {
99
client = new NotificationClient({
1010
appId: 1234,
1111
key: "f00d",
12-
secret: "beef",
12+
secret: "tofu",
1313
})
1414
nock.cleanAll()
1515
nock.disableNetConnect()

tests/integration/pusher/post.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe("Pusher", function () {
77
var pusher
88

99
beforeEach(function () {
10-
pusher = new Pusher({ appId: 10000, key: "aaaa", secret: "beef" })
10+
pusher = new Pusher({ appId: 10000, key: "aaaa", secret: "tofu" })
1111
nock.disableNetConnect()
1212
})
1313

@@ -118,7 +118,7 @@ describe("Pusher", function () {
118118
var pusher = new Pusher({
119119
appId: 10000,
120120
key: "aaaa",
121-
secret: "beef",
121+
secret: "tofu",
122122
useTLS: true,
123123
host: "example.com",
124124
port: 1234,
@@ -145,7 +145,7 @@ describe("Pusher", function () {
145145
var pusher = new Pusher({
146146
appId: 10000,
147147
key: "aaaa",
148-
secret: "beef",
148+
secret: "tofu",
149149
timeout: 100,
150150
})
151151
var mock = nock("http://api.pusherapp.com")

tests/integration/pusher/trigger.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe("Pusher", function () {
99
var pusher
1010

1111
beforeEach(function () {
12-
pusher = new Pusher({ appId: 1234, key: "f00d", secret: "beef" })
12+
pusher = new Pusher({ appId: 1234, key: "f00d", secret: "tofu" })
1313
nock.disableNetConnect()
1414
})
1515

@@ -288,7 +288,7 @@ describe("Pusher", function () {
288288
var pusher = new Pusher({
289289
appId: 1234,
290290
key: "f00d",
291-
secret: "beef",
291+
secret: "tofu",
292292
useTLS: true,
293293
host: "example.com",
294294
port: 1234,
@@ -320,7 +320,7 @@ describe("Pusher", function () {
320320
var pusher = new Pusher({
321321
appId: 1234,
322322
key: "f00d",
323-
secret: "beef",
323+
secret: "tofu",
324324
timeout: 100,
325325
})
326326
var mock = nock("http://api.pusherapp.com")
@@ -454,7 +454,7 @@ describe("Pusher with encryptionMasterKey", function () {
454454
pusher = new Pusher({
455455
appId: 1234,
456456
key: "f00d",
457-
secret: "beef",
457+
secret: "tofu",
458458
encryptionMasterKeyBase64: testMasterKey,
459459
})
460460
nock.disableNetConnect()

tests/integration/pusher/webhook.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe("Pusher", function () {
77
var pusher
88

99
beforeEach(function () {
10-
pusher = new Pusher({ appId: 10000, key: "aaaa", secret: "beef" })
10+
pusher = new Pusher({ appId: 10000, key: "aaaa", secret: "tofu" })
1111
})
1212

1313
describe("#webhook", function () {

tests/integration/webhook.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe("WebHook", function () {
88
var token
99

1010
beforeEach(function () {
11-
token = new Token("123456789", "beef")
11+
token = new Token("123456789", "tofu")
1212
})
1313

1414
describe("#isValid", function () {
@@ -17,7 +17,7 @@ describe("WebHook", function () {
1717
headers: {
1818
"x-pusher-key": "123456789",
1919
"x-pusher-signature":
20-
"df1465f5ff93f83238152fd002cb904f9562d39569e68f00a6bfa0d8ccf88334",
20+
"c17257e92037cd7de407ebc1ed174ceb7b2e518db127f44411b9ffc4f5b28cc5",
2121
"content-type": "application/json",
2222
},
2323
rawBody: JSON.stringify({
@@ -64,23 +64,23 @@ describe("WebHook", function () {
6464
headers: {
6565
"x-pusher-key": "1234",
6666
"x-pusher-signature":
67-
"df1465f5ff93f83238152fd002cb904f9562d39569e68f00a6bfa0d8ccf88334",
67+
"c17257e92037cd7de407ebc1ed174ceb7b2e518db127f44411b9ffc4f5b28cc5",
6868
"content-type": "application/json",
6969
},
7070
rawBody: JSON.stringify({
7171
time_ms: 1403175510755,
7272
events: [{ channel: "test_channel", name: "channel_vacated" }],
7373
}),
7474
})
75-
expect(webhook.isValid(new Token("1234", "beef"))).to.be(true)
75+
expect(webhook.isValid(new Token("1234", "tofu"))).to.be(true)
7676
})
7777

7878
it("should return true if webhook is signed with one of the extra tokens", function () {
7979
var webhook = new WebHook(token, {
8080
headers: {
8181
"x-pusher-key": "3",
8282
"x-pusher-signature":
83-
"df1465f5ff93f83238152fd002cb904f9562d39569e68f00a6bfa0d8ccf88334",
83+
"c17257e92037cd7de407ebc1ed174ceb7b2e518db127f44411b9ffc4f5b28cc5",
8484
"content-type": "application/json",
8585
},
8686
rawBody: JSON.stringify({
@@ -92,7 +92,7 @@ describe("WebHook", function () {
9292
webhook.isValid([
9393
new Token("1", "nope"),
9494
new Token("2", "not really"),
95-
new Token("3", "beef"),
95+
new Token("3", "tofu"),
9696
])
9797
).to.be(true)
9898
})

0 commit comments

Comments
 (0)