@@ -97,7 +97,7 @@ function runTests (name, compat) {
97
97
} , / N o c a l l b a c k p r o v i d e d t o p b k d f 2 / )
98
98
} )
99
99
100
- tape ( name + ' should throw if the password is not a buffer or string' , function ( t ) {
100
+ tape ( name + ' should throw if the password is not a buffer or string or Uint8Array ' , function ( t ) {
101
101
t . plan ( 2 )
102
102
103
103
t . throws ( function ( ) {
@@ -109,7 +109,7 @@ function runTests (name, compat) {
109
109
} , / P a s s w o r d m u s t b e a b u f f e r o r s t r i n g / )
110
110
} )
111
111
112
- tape ( name + ' should throw if the salt is not a buffer or string' , function ( t ) {
112
+ tape ( name + ' should throw if the salt is not a buffer or string or Uint8Array ' , function ( t ) {
113
113
t . plan ( 2 )
114
114
115
115
t . throws ( function ( ) {
@@ -124,8 +124,16 @@ function runTests (name, compat) {
124
124
var algos = [ 'sha1' , 'sha224' , 'sha256' , 'sha384' , 'sha512' , 'ripemd160' ]
125
125
algos . forEach ( function ( algorithm ) {
126
126
fixtures . valid . forEach ( function ( f ) {
127
- var key = f . key || Buffer . from ( f . keyHex , 'hex' )
128
- var salt = f . salt || Buffer . from ( f . saltHex , 'hex' )
127
+ if ( f . keyuint8 ) {
128
+ var key = new Uint8Array ( f . keyuint8 )
129
+ } else {
130
+ var key = f . key || Buffer . from ( f . keyHex , 'hex' )
131
+ }
132
+ if ( f . saltuint8 ) {
133
+ var salt = new Uint8Array ( f . saltuint8 )
134
+ } else {
135
+ var salt = f . salt || Buffer . from ( f . saltHex , 'hex' )
136
+ }
129
137
var expected = f . results [ algorithm ]
130
138
var description = algorithm + ' encodes ' + key + ' (' + f . salt + ') with ' + algorithm + ' to ' + expected
131
139
0 commit comments