@@ -69,6 +69,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
69
69
const keybuf = randomBytes ( 32 ) ;
70
70
const key = createSecretKey ( keybuf ) ;
71
71
assert . strictEqual ( key . type , 'secret' ) ;
72
+ assert . strictEqual ( key . toString ( ) , '[object KeyObject]' ) ;
72
73
assert . strictEqual ( key . symmetricKeySize , 32 ) ;
73
74
assert . strictEqual ( key . asymmetricKeyType , undefined ) ;
74
75
assert . strictEqual ( key . asymmetricKeyDetails , undefined ) ;
@@ -150,27 +151,32 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
150
151
151
152
const publicKey = createPublicKey ( publicPem ) ;
152
153
assert . strictEqual ( publicKey . type , 'public' ) ;
154
+ assert . strictEqual ( publicKey . toString ( ) , '[object KeyObject]' ) ;
153
155
assert . strictEqual ( publicKey . asymmetricKeyType , 'rsa' ) ;
154
156
assert . strictEqual ( publicKey . symmetricKeySize , undefined ) ;
155
157
156
158
const privateKey = createPrivateKey ( privatePem ) ;
157
159
assert . strictEqual ( privateKey . type , 'private' ) ;
160
+ assert . strictEqual ( privateKey . toString ( ) , '[object KeyObject]' ) ;
158
161
assert . strictEqual ( privateKey . asymmetricKeyType , 'rsa' ) ;
159
162
assert . strictEqual ( privateKey . symmetricKeySize , undefined ) ;
160
163
161
164
// It should be possible to derive a public key from a private key.
162
165
const derivedPublicKey = createPublicKey ( privateKey ) ;
163
166
assert . strictEqual ( derivedPublicKey . type , 'public' ) ;
167
+ assert . strictEqual ( derivedPublicKey . toString ( ) , '[object KeyObject]' ) ;
164
168
assert . strictEqual ( derivedPublicKey . asymmetricKeyType , 'rsa' ) ;
165
169
assert . strictEqual ( derivedPublicKey . symmetricKeySize , undefined ) ;
166
170
167
171
const publicKeyFromJwk = createPublicKey ( { key : publicJwk , format : 'jwk' } ) ;
168
172
assert . strictEqual ( publicKey . type , 'public' ) ;
173
+ assert . strictEqual ( publicKey . toString ( ) , '[object KeyObject]' ) ;
169
174
assert . strictEqual ( publicKey . asymmetricKeyType , 'rsa' ) ;
170
175
assert . strictEqual ( publicKey . symmetricKeySize , undefined ) ;
171
176
172
177
const privateKeyFromJwk = createPrivateKey ( { key : jwk , format : 'jwk' } ) ;
173
178
assert . strictEqual ( privateKey . type , 'private' ) ;
179
+ assert . strictEqual ( privateKey . toString ( ) , '[object KeyObject]' ) ;
174
180
assert . strictEqual ( privateKey . asymmetricKeyType , 'rsa' ) ;
175
181
assert . strictEqual ( privateKey . symmetricKeySize , undefined ) ;
176
182
0 commit comments