File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -762,7 +762,7 @@ class CryptoKey {
762
762
get type ( ) {
763
763
if ( ! ( this instanceof CryptoKey ) )
764
764
throw new ERR_INVALID_THIS ( 'CryptoKey' ) ;
765
- return this [ kKeyObject ] . type ;
765
+ return this [ kKeyObject ] ? .type ;
766
766
}
767
767
768
768
get extractable ( ) {
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ if (!common.hasCrypto)
6
6
common . skip ( 'missing crypto' ) ;
7
7
8
8
const assert = require ( 'assert' ) ;
9
+ const { inspect } = require ( 'util' ) ;
9
10
const { subtle } = globalThis . crypto ;
10
11
11
12
( async ( ) => {
@@ -17,6 +18,18 @@ const { subtle } = globalThis.crypto;
17
18
[ 'encrypt' , 'decrypt' ] ) ;
18
19
assert ( k instanceof CryptoKey ) ;
19
20
21
+ // Inspecting the prototype should work.
22
+ const inspected = inspect ( Object . getPrototypeOf ( k ) ) ;
23
+ assert . strictEqual (
24
+ inspected ,
25
+ 'CryptoKey {\n' +
26
+ ' type: undefined,\n' +
27
+ ' extractable: undefined,\n' +
28
+ ' algorithm: undefined,\n' +
29
+ ' usages: undefined\n' +
30
+ '}'
31
+ ) ;
32
+
20
33
const e = await subtle . encrypt ( {
21
34
name : 'AES-GCM' ,
22
35
iv : new Uint8Array ( 12 ) ,
You can’t perform that action at this time.
0 commit comments