@@ -1734,7 +1734,7 @@ var Internal = Internal || {};
17341734
17351735 // Insert some bytes into the emscripten memory and return a pointer
17361736 function _allocate ( bytes ) {
1737- var address = Module . _malloc ( bytes . length ) ;
1737+ const address = Module . _malloc ( bytes . length ) ;
17381738 Module . HEAPU8 . set ( bytes , address ) ;
17391739
17401740 return address ;
@@ -1744,34 +1744,34 @@ var Internal = Internal || {};
17441744 array . set ( Module . HEAPU8 . subarray ( address , address + length ) ) ;
17451745 }
17461746
1747- var basepoint = new Uint8Array ( 32 ) ;
1747+ const basepoint = new Uint8Array ( 32 ) ;
17481748 basepoint [ 0 ] = 9 ;
17491749
17501750 Internal . curve25519 = {
17511751 keyPair : function ( privKey ) {
1752- var priv = new Uint8Array ( privKey ) ;
1752+ const priv = new Uint8Array ( privKey ) ;
17531753 priv [ 0 ] &= 248 ;
17541754 priv [ 31 ] &= 127 ;
17551755 priv [ 31 ] |= 64 ;
17561756
17571757 // Where to store the result
1758- var publicKey_ptr = Module . _malloc ( 32 ) ;
1758+ const publicKey_ptr = Module . _malloc ( 32 ) ;
17591759
17601760 // Get a pointer to the private key
1761- var privateKey_ptr = _allocate ( priv ) ;
1761+ const privateKey_ptr = _allocate ( priv ) ;
17621762
17631763 // The basepoint for generating public keys
1764- var basepoint_ptr = _allocate ( basepoint ) ;
1764+ const basepoint_ptr = _allocate ( basepoint ) ;
17651765
17661766 // The return value is just 0, the operation is done in place
1767- var err = Module . _curve25519_donna ( publicKey_ptr ,
1767+ const err = Module . _curve25519_donna ( publicKey_ptr ,
17681768 privateKey_ptr ,
17691769 basepoint_ptr ) ;
17701770 if ( err ) {
17711771 console . log ( err ) ;
17721772 }
17731773
1774- var res = new Uint8Array ( 32 ) ;
1774+ const res = new Uint8Array ( 32 ) ;
17751775 _readBytes ( publicKey_ptr , 32 , res ) ;
17761776
17771777 Module . _free ( publicKey_ptr ) ;
@@ -1783,24 +1783,24 @@ var Internal = Internal || {};
17831783
17841784 sharedSecret : function ( pubKey , privKey ) {
17851785 // Where to store the result
1786- var sharedKey_ptr = Module . _malloc ( 32 ) ;
1786+ const sharedKey_ptr = Module . _malloc ( 32 ) ;
17871787
17881788 // Get a pointer to our private key
1789- var privateKey_ptr = _allocate ( new Uint8Array ( privKey ) ) ;
1789+ const privateKey_ptr = _allocate ( new Uint8Array ( privKey ) ) ;
17901790
17911791 // Get a pointer to their public key, the basepoint when you're
17921792 // generating a shared secret
1793- var basepoint_ptr = _allocate ( new Uint8Array ( pubKey ) ) ;
1793+ const basepoint_ptr = _allocate ( new Uint8Array ( pubKey ) ) ;
17941794
17951795 // Return value is 0 here too of course
1796- var err = Module . _curve25519_donna ( sharedKey_ptr ,
1796+ const err = Module . _curve25519_donna ( sharedKey_ptr ,
17971797 privateKey_ptr ,
17981798 basepoint_ptr ) ;
17991799 if ( err ) {
18001800 console . log ( err ) ;
18011801 }
18021802
1803- var res = new Uint8Array ( 32 ) ;
1803+ const res = new Uint8Array ( 32 ) ;
18041804 _readBytes ( sharedKey_ptr , 32 , res ) ;
18051805
18061806 Module . _free ( sharedKey_ptr ) ;
@@ -1812,23 +1812,23 @@ var Internal = Internal || {};
18121812
18131813 sign : function ( privKey , message ) {
18141814 // Where to store the result
1815- var signature_ptr = Module . _malloc ( 64 ) ;
1815+ const signature_ptr = Module . _malloc ( 64 ) ;
18161816
18171817 // Get a pointer to our private key
1818- var privateKey_ptr = _allocate ( new Uint8Array ( privKey ) ) ;
1818+ const privateKey_ptr = _allocate ( new Uint8Array ( privKey ) ) ;
18191819
18201820 // Get a pointer to the message
1821- var message_ptr = _allocate ( new Uint8Array ( message ) ) ;
1821+ const message_ptr = _allocate ( new Uint8Array ( message ) ) ;
18221822
1823- var err = Module . _xed25519_sign ( signature_ptr ,
1823+ const err = Module . _xed25519_sign ( signature_ptr ,
18241824 privateKey_ptr ,
18251825 message_ptr ,
18261826 message . byteLength ) ;
18271827 if ( err ) {
18281828 console . log ( err ) ;
18291829 }
18301830
1831- var res = new Uint8Array ( 64 ) ;
1831+ const res = new Uint8Array ( 64 ) ;
18321832 _readBytes ( signature_ptr , 64 , res ) ;
18331833
18341834 Module . _free ( signature_ptr ) ;
@@ -1840,15 +1840,15 @@ var Internal = Internal || {};
18401840
18411841 verify : function ( pubKey , message , sig ) {
18421842 // Get a pointer to their public key
1843- var publicKey_ptr = _allocate ( new Uint8Array ( pubKey ) ) ;
1843+ const publicKey_ptr = _allocate ( new Uint8Array ( pubKey ) ) ;
18441844
18451845 // Get a pointer to the signature
1846- var signature_ptr = _allocate ( new Uint8Array ( sig ) ) ;
1846+ const signature_ptr = _allocate ( new Uint8Array ( sig ) ) ;
18471847
18481848 // Get a pointer to the message
1849- var message_ptr = _allocate ( new Uint8Array ( message ) ) ;
1849+ const message_ptr = _allocate ( new Uint8Array ( message ) ) ;
18501850
1851- var res = Module . _curve25519_verify ( signature_ptr ,
1851+ const res = Module . _curve25519_verify ( signature_ptr ,
18521852 publicKey_ptr ,
18531853 message_ptr ,
18541854 message . byteLength ) ;
0 commit comments