1
+ /*global process, exports*/
2
+ const Buffer = require ( 'buffer' ) . Buffer ;
1
3
const Stream = require ( 'stream' ) ;
2
4
const util = require ( 'util' ) ;
3
5
const base64url = require ( 'base64url' ) ;
4
- const crypto = require ( 'crypto' ) ;
5
6
const jwa = require ( 'jwa' ) ;
6
7
7
8
const ALGORITHMS = [
@@ -18,16 +19,6 @@ function toString(obj) {
18
19
return JSON . stringify ( obj ) ;
19
20
}
20
21
21
- function merge ( to , from ) {
22
- for ( var key in from )
23
- to [ key ] = from [ key ] ;
24
- return to ;
25
- }
26
-
27
- function makeError ( opts ) {
28
- return merge ( new Error ( opts . message || opts . code ) , opts ) ;
29
- }
30
-
31
22
function jwsSecuredInput ( header , payload ) {
32
23
const encodedHeader = base64url ( toString ( header ) ) ;
33
24
const encodedPayload = base64url ( toString ( payload ) ) ;
@@ -113,7 +104,7 @@ function jwsDecode(jwsSig, opts) {
113
104
header : header ,
114
105
payload : payload ,
115
106
signature : signatureFromJWS ( jwsSig ) ,
116
- }
107
+ } ;
117
108
}
118
109
119
110
function SignStream ( opts ) {
@@ -192,7 +183,7 @@ function DataStream(data) {
192
183
this . emit ( 'close' ) ;
193
184
} . bind ( this ) ) ;
194
185
}
195
- } ;
186
+ }
196
187
util . inherits ( DataStream , Stream ) ;
197
188
198
189
DataStream . prototype . write = function write ( data ) {
0 commit comments