@@ -84,17 +84,9 @@ suite('sendNotification', function() {
84
84
salt : salt ,
85
85
padSize : 1 ,
86
86
} ) ;
87
- } else if ( req . headers [ 'content-encoding' ] === 'aesgcm128 ' ) {
88
- ece . saveKey ( 'webpushKey' , userCurve , 'P-256 ' ) ;
87
+ } else if ( cryptoHeader === 'crypto-key ' ) {
88
+ assert . equal ( req . headers [ 'content-encoding' ] , 'aesgcm' , 'Content-Encoding header correct ' ) ;
89
89
90
- var decrypted = ece . decrypt ( body , {
91
- keyid : 'webpushKey' ,
92
- dh : appServerPublicKey ,
93
- salt : salt ,
94
- authSecret : urlBase64 . encode ( intermediateUserAuth ) ,
95
- padSize : 1 ,
96
- } ) ;
97
- } else if ( req . headers [ 'content-encoding' ] === 'aesgcm' ) {
98
90
ece . saveKey ( 'webpushKey' , userCurve , 'P-256' ) ;
99
91
100
92
var decrypted = ece . decrypt ( body , {
@@ -105,7 +97,7 @@ suite('sendNotification', function() {
105
97
padSize : 2 ,
106
98
} ) ;
107
99
} else {
108
- assert ( false , 'Invalid crypto header or content-encoding header value' ) ;
100
+ assert ( false , 'Invalid crypto header value' ) ;
109
101
}
110
102
} else {
111
103
assert . equal ( req . headers [ cryptoHeader ] . indexOf ( 'keyid=p256dh;dh=' ) , 0 , 'Encryption-Key header correct' ) ;
@@ -202,23 +194,6 @@ suite('sendNotification', function() {
202
194
} ) ;
203
195
} ) ;
204
196
205
- test ( 'send/receive string (intermediate standard)' , function ( ) {
206
- return startServer ( 'hello' )
207
- . then ( function ( ) {
208
- return webPush . sendNotification ( 'https://127.0.0.1:' + serverPort , {
209
- userPublicKey : urlBase64 . encode ( userPublicKey ) ,
210
- userAuth : urlBase64 . encode ( intermediateUserAuth ) ,
211
- payload : 'hello' ,
212
- } ) ;
213
- } )
214
- . then ( function ( body ) {
215
- assert ( true , 'sendNotification promise resolved' ) ;
216
- assert . equal ( body , 'ok' ) ;
217
- } , function ( e ) {
218
- assert ( false , 'sendNotification promise rejected with: ' + e ) ;
219
- } ) ;
220
- } ) ;
221
-
222
197
test ( 'send/receive string (new standard)' , function ( ) {
223
198
return startServer ( 'hello' )
224
199
. then ( function ( ) {
@@ -468,29 +443,6 @@ suite('sendNotification', function() {
468
443
} ) ;
469
444
} ) ;
470
445
471
- test ( 'send notification with message (intermediate standard) with vapid' , function ( ) {
472
- return startServer ( 'hello' , undefined , undefined , undefined , true )
473
- . then ( function ( ) {
474
- return webPush . sendNotification ( 'https://127.0.0.1:' + serverPort , {
475
- userPublicKey : urlBase64 . encode ( userPublicKey ) ,
476
- userAuth : urlBase64 . encode ( intermediateUserAuth ) ,
477
- payload : 'hello' ,
478
- vapid : {
479
- audience : 'https://www.mozilla.org/' ,
480
- subject :
'mailto:[email protected] ' ,
481
- privateKey : vapidKeys . privateKey ,
482
- publicKey : vapidKeys . publicKey ,
483
- } ,
484
- } ) ;
485
- } )
486
- . then ( function ( body ) {
487
- assert ( true , 'sendNotification promise resolved' ) ;
488
- assert . equal ( body , 'ok' ) ;
489
- } , function ( e ) {
490
- assert ( false , 'sendNotification promise rejected with ' + e ) ;
491
- } ) ;
492
- } ) ;
493
-
494
446
test ( 'send notification with message (new standard) with vapid' , function ( ) {
495
447
return startServer ( 'hello' , undefined , undefined , undefined , true )
496
448
. then ( function ( ) {
0 commit comments