33const {
44 FunctionPrototypeCall,
55 ObjectDefineProperty,
6+ SafeArrayIterator,
67} = primordials ;
78
89const {
@@ -75,7 +76,7 @@ function generateKeyPair(type, options, callback) {
7576 job . ondone = ( error , result ) => {
7677 if ( error ) return FunctionPrototypeCall ( callback , job , error ) ;
7778 // If no encoding was chosen, return key objects instead.
78- let [ pubkey , privkey ] = result ;
79+ let { 0 : pubkey , 1 : privkey } = result ;
7980 pubkey = wrapKey ( pubkey , PublicKeyObject ) ;
8081 privkey = wrapKey ( privkey , PrivateKeyObject ) ;
8182 FunctionPrototypeCall ( callback , job , null , pubkey , privkey ) ;
@@ -97,11 +98,11 @@ function handleError(ret) {
9798 if ( ret == null )
9899 return ; // async
99100
100- const [ err , keys ] = ret ;
101+ const { 0 : err , 1 : keys } = ret ;
101102 if ( err !== undefined )
102103 throw err ;
103104
104- const [ publicKey , privateKey ] = keys ;
105+ const { 0 : publicKey , 1 : privateKey } = keys ;
105106
106107 // If no encoding was chosen, return key objects instead.
107108 return {
@@ -156,7 +157,7 @@ function parseKeyEncoding(keyType, options = {}) {
156157function createJob ( mode , type , options ) {
157158 validateString ( type , 'type' ) ;
158159
159- const encoding = parseKeyEncoding ( type , options ) ;
160+ const encoding = new SafeArrayIterator ( parseKeyEncoding ( type , options ) ) ;
160161
161162 if ( options !== undefined )
162163 validateObject ( options , 'options' ) ;
@@ -341,7 +342,7 @@ function handleGenerateKeyError(ret) {
341342 if ( ret === undefined )
342343 return ; // async
343344
344- const [ err , key ] = ret ;
345+ const { 0 : err , 1 : key } = ret ;
345346 if ( err !== undefined )
346347 throw err ;
347348
0 commit comments