@napi-rs/blake-hash
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -1,1 +0,1 @@ | ||
const{existsSync,readFileSync}=require("fs"),{join}=require("path"),{platform,arch}=process;let nativeBinding=null,localFileExisted=!1,loadError=null;function isMusl(){if(!process.report||typeof process.report.getReport!="function")try{return readFileSync("/usr/bin/ldd","utf8").includes("musl")}catch{return!0}else{const{glibcVersionRuntime:e}=process.report.getReport().header;return!e}}switch(platform){case"android":switch(arch){case"arm64":localFileExisted=existsSync(join(__dirname,"blake.android-arm64.node"));try{localFileExisted?nativeBinding=require("./blake.android-arm64.node"):nativeBinding=require("@napi-rs/blake-hash-android-arm64")}catch(e){loadError=e}break;case"arm":localFileExisted=existsSync(join(__dirname,"blake.android-arm-eabi.node"));try{localFileExisted?nativeBinding=require("./blake.android-arm-eabi.node"):nativeBinding=require("@napi-rs/blake-hash-android-arm-eabi")}catch(e){loadError=e}break;default:throw new Error(`Unsupported architecture on Android ${arch}`)}break;case"win32":switch(arch){case"x64":localFileExisted=existsSync(join(__dirname,"blake.win32-x64-msvc.node"));try{localFileExisted?nativeBinding=require("./blake.win32-x64-msvc.node"):nativeBinding=require("@napi-rs/blake-hash-win32-x64-msvc")}catch(e){loadError=e}break;case"ia32":localFileExisted=existsSync(join(__dirname,"blake.win32-ia32-msvc.node"));try{localFileExisted?nativeBinding=require("./blake.win32-ia32-msvc.node"):nativeBinding=require("@napi-rs/blake-hash-win32-ia32-msvc")}catch(e){loadError=e}break;case"arm64":localFileExisted=existsSync(join(__dirname,"blake.win32-arm64-msvc.node"));try{localFileExisted?nativeBinding=require("./blake.win32-arm64-msvc.node"):nativeBinding=require("@napi-rs/blake-hash-win32-arm64-msvc")}catch(e){loadError=e}break;default:throw new Error(`Unsupported architecture on Windows: ${arch}`)}break;case"darwin":switch(arch){case"x64":localFileExisted=existsSync(join(__dirname,"blake.darwin-x64.node"));try{localFileExisted?nativeBinding=require("./blake.darwin-x64.node"):nativeBinding=require("@napi-rs/blake-hash-darwin-x64")}catch(e){loadError=e}break;case"arm64":localFileExisted=existsSync(join(__dirname,"blake.darwin-arm64.node"));try{localFileExisted?nativeBinding=require("./blake.darwin-arm64.node"):nativeBinding=require("@napi-rs/blake-hash-darwin-arm64")}catch(e){loadError=e}break;default:throw new Error(`Unsupported architecture on macOS: ${arch}`)}break;case"freebsd":if(arch!=="x64")throw new Error(`Unsupported architecture on FreeBSD: ${arch}`);localFileExisted=existsSync(join(__dirname,"blake.freebsd-x64.node"));try{localFileExisted?nativeBinding=require("./blake.freebsd-x64.node"):nativeBinding=require("@napi-rs/blake-hash-freebsd-x64")}catch(e){loadError=e}break;case"linux":switch(arch){case"x64":if(isMusl()){localFileExisted=existsSync(join(__dirname,"blake.linux-x64-musl.node"));try{localFileExisted?nativeBinding=require("./blake.linux-x64-musl.node"):nativeBinding=require("@napi-rs/blake-hash-linux-x64-musl")}catch(e){loadError=e}}else{localFileExisted=existsSync(join(__dirname,"blake.linux-x64-gnu.node"));try{localFileExisted?nativeBinding=require("./blake.linux-x64-gnu.node"):nativeBinding=require("@napi-rs/blake-hash-linux-x64-gnu")}catch(e){loadError=e}}break;case"arm64":if(isMusl()){localFileExisted=existsSync(join(__dirname,"blake.linux-arm64-musl.node"));try{localFileExisted?nativeBinding=require("./blake.linux-arm64-musl.node"):nativeBinding=require("@napi-rs/blake-hash-linux-arm64-musl")}catch(e){loadError=e}}else{localFileExisted=existsSync(join(__dirname,"blake.linux-arm64-gnu.node"));try{localFileExisted?nativeBinding=require("./blake.linux-arm64-gnu.node"):nativeBinding=require("@napi-rs/blake-hash-linux-arm64-gnu")}catch(e){loadError=e}}break;case"arm":localFileExisted=existsSync(join(__dirname,"blake.linux-arm-gnueabihf.node"));try{localFileExisted?nativeBinding=require("./blake.linux-arm-gnueabihf.node"):nativeBinding=require("@napi-rs/blake-hash-linux-arm-gnueabihf")}catch(e){loadError=e}break;default:throw new Error(`Unsupported architecture on Linux: ${arch}`)}break;default:throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)}if(!nativeBinding)throw loadError||new Error("Failed to load native binding");const{Blake2BParam,Blake2SParam,Blake2BpParam,Blake2SpParam,Blake2BHasher,Blake2BpHasher,Blake2SHasher,Blake2SpHasher,Blake3Hasher,blake2b,blake2bp,blake2s,blake2sp,blake3,blake3UrlSafeBase64}=nativeBinding;module.exports.Blake2BParam=Blake2BParam,module.exports.Blake2SParam=Blake2SParam,module.exports.Blake2BpParam=Blake2BpParam,module.exports.Blake2SpParam=Blake2SpParam,module.exports.Blake2BHasher=Blake2BHasher,module.exports.Blake2BpHasher=Blake2BpHasher,module.exports.Blake2SHasher=Blake2SHasher,module.exports.Blake2SpHasher=Blake2SpHasher,module.exports.Blake3Hasher=Blake3Hasher,module.exports.blake2b=blake2b,module.exports.blake2bp=blake2bp,module.exports.blake2s=blake2s,module.exports.blake2sp=blake2sp,module.exports.blake3=blake3,module.exports.blake3UrlSafeBase64=blake3UrlSafeBase64; | ||
const{existsSync,readFileSync}=require("fs"),{join}=require("path"),{platform,arch}=process;let nativeBinding=null,localFileExisted=!1,loadError=null;function isMusl(){if(!process.report||typeof process.report.getReport!="function")try{const e=require("child_process").execSync("which ldd").toString().trim();return readFileSync(e,"utf8").includes("musl")}catch{return!0}else{const{glibcVersionRuntime:e}=process.report.getReport().header;return!e}}switch(platform){case"android":switch(arch){case"arm64":localFileExisted=existsSync(join(__dirname,"blake.android-arm64.node"));try{localFileExisted?nativeBinding=require("./blake.android-arm64.node"):nativeBinding=require("@napi-rs/blake-hash-android-arm64")}catch(e){loadError=e}break;case"arm":localFileExisted=existsSync(join(__dirname,"blake.android-arm-eabi.node"));try{localFileExisted?nativeBinding=require("./blake.android-arm-eabi.node"):nativeBinding=require("@napi-rs/blake-hash-android-arm-eabi")}catch(e){loadError=e}break;default:throw new Error(`Unsupported architecture on Android ${arch}`)}break;case"win32":switch(arch){case"x64":localFileExisted=existsSync(join(__dirname,"blake.win32-x64-msvc.node"));try{localFileExisted?nativeBinding=require("./blake.win32-x64-msvc.node"):nativeBinding=require("@napi-rs/blake-hash-win32-x64-msvc")}catch(e){loadError=e}break;case"ia32":localFileExisted=existsSync(join(__dirname,"blake.win32-ia32-msvc.node"));try{localFileExisted?nativeBinding=require("./blake.win32-ia32-msvc.node"):nativeBinding=require("@napi-rs/blake-hash-win32-ia32-msvc")}catch(e){loadError=e}break;case"arm64":localFileExisted=existsSync(join(__dirname,"blake.win32-arm64-msvc.node"));try{localFileExisted?nativeBinding=require("./blake.win32-arm64-msvc.node"):nativeBinding=require("@napi-rs/blake-hash-win32-arm64-msvc")}catch(e){loadError=e}break;default:throw new Error(`Unsupported architecture on Windows: ${arch}`)}break;case"darwin":localFileExisted=existsSync(join(__dirname,"blake.darwin-universal.node"));try{localFileExisted?nativeBinding=require("./blake.darwin-universal.node"):nativeBinding=require("@napi-rs/blake-hash-darwin-universal");break}catch{}switch(arch){case"x64":localFileExisted=existsSync(join(__dirname,"blake.darwin-x64.node"));try{localFileExisted?nativeBinding=require("./blake.darwin-x64.node"):nativeBinding=require("@napi-rs/blake-hash-darwin-x64")}catch(e){loadError=e}break;case"arm64":localFileExisted=existsSync(join(__dirname,"blake.darwin-arm64.node"));try{localFileExisted?nativeBinding=require("./blake.darwin-arm64.node"):nativeBinding=require("@napi-rs/blake-hash-darwin-arm64")}catch(e){loadError=e}break;default:throw new Error(`Unsupported architecture on macOS: ${arch}`)}break;case"freebsd":if(arch!=="x64")throw new Error(`Unsupported architecture on FreeBSD: ${arch}`);localFileExisted=existsSync(join(__dirname,"blake.freebsd-x64.node"));try{localFileExisted?nativeBinding=require("./blake.freebsd-x64.node"):nativeBinding=require("@napi-rs/blake-hash-freebsd-x64")}catch(e){loadError=e}break;case"linux":switch(arch){case"x64":if(isMusl()){localFileExisted=existsSync(join(__dirname,"blake.linux-x64-musl.node"));try{localFileExisted?nativeBinding=require("./blake.linux-x64-musl.node"):nativeBinding=require("@napi-rs/blake-hash-linux-x64-musl")}catch(e){loadError=e}}else{localFileExisted=existsSync(join(__dirname,"blake.linux-x64-gnu.node"));try{localFileExisted?nativeBinding=require("./blake.linux-x64-gnu.node"):nativeBinding=require("@napi-rs/blake-hash-linux-x64-gnu")}catch(e){loadError=e}}break;case"arm64":if(isMusl()){localFileExisted=existsSync(join(__dirname,"blake.linux-arm64-musl.node"));try{localFileExisted?nativeBinding=require("./blake.linux-arm64-musl.node"):nativeBinding=require("@napi-rs/blake-hash-linux-arm64-musl")}catch(e){loadError=e}}else{localFileExisted=existsSync(join(__dirname,"blake.linux-arm64-gnu.node"));try{localFileExisted?nativeBinding=require("./blake.linux-arm64-gnu.node"):nativeBinding=require("@napi-rs/blake-hash-linux-arm64-gnu")}catch(e){loadError=e}}break;case"arm":localFileExisted=existsSync(join(__dirname,"blake.linux-arm-gnueabihf.node"));try{localFileExisted?nativeBinding=require("./blake.linux-arm-gnueabihf.node"):nativeBinding=require("@napi-rs/blake-hash-linux-arm-gnueabihf")}catch(e){loadError=e}break;default:throw new Error(`Unsupported architecture on Linux: ${arch}`)}break;default:throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)}if(!nativeBinding)throw loadError||new Error("Failed to load native binding");const{Blake2BParam,Blake2SParam,Blake2BpParam,Blake2SpParam,Blake2BHasher,Blake2BpHasher,Blake2SHasher,Blake2SpHasher,Blake3Hasher,blake2b,blake2bp,blake2s,blake2sp,blake3,blake3UrlSafeBase64}=nativeBinding;module.exports.Blake2BParam=Blake2BParam,module.exports.Blake2SParam=Blake2SParam,module.exports.Blake2BpParam=Blake2BpParam,module.exports.Blake2SpParam=Blake2SpParam,module.exports.Blake2BHasher=Blake2BHasher,module.exports.Blake2BpHasher=Blake2BpHasher,module.exports.Blake2SHasher=Blake2SHasher,module.exports.Blake2SpHasher=Blake2SpHasher,module.exports.Blake3Hasher=Blake3Hasher,module.exports.blake2b=blake2b,module.exports.blake2bp=blake2bp,module.exports.blake2s=blake2s,module.exports.blake2sp=blake2sp,module.exports.blake3=blake3,module.exports.blake3UrlSafeBase64=blake3UrlSafeBase64; |
{ | ||
"name": "@napi-rs/blake-hash", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"main": "index.js", | ||
@@ -33,7 +33,7 @@ "types": "index.d.ts", | ||
"@types/node": "^18.8.3", | ||
"ava": "^4.3.3", | ||
"ava": "^5.0.0", | ||
"benny": "^3.7.1", | ||
"blake2": "^4.1.1", | ||
"blake2": "^5.0.0", | ||
"blake3": "^2.1.7", | ||
"esbuild": "^0.15.10", | ||
"esbuild": "^0.17.0", | ||
"typescript": "^4.8.4" | ||
@@ -77,16 +77,16 @@ }, | ||
}, | ||
"packageManager": "yarn@3.2.4", | ||
"packageManager": "yarn@3.4.1", | ||
"optionalDependencies": { | ||
"@napi-rs/blake-hash-win32-x64-msvc": "1.3.2", | ||
"@napi-rs/blake-hash-darwin-x64": "1.3.2", | ||
"@napi-rs/blake-hash-linux-x64-gnu": "1.3.2", | ||
"@napi-rs/blake-hash-darwin-arm64": "1.3.2", | ||
"@napi-rs/blake-hash-android-arm64": "1.3.2", | ||
"@napi-rs/blake-hash-linux-arm64-gnu": "1.3.2", | ||
"@napi-rs/blake-hash-linux-arm64-musl": "1.3.2", | ||
"@napi-rs/blake-hash-win32-arm64-msvc": "1.3.2", | ||
"@napi-rs/blake-hash-linux-x64-musl": "1.3.2", | ||
"@napi-rs/blake-hash-freebsd-x64": "1.3.2", | ||
"@napi-rs/blake-hash-win32-ia32-msvc": "1.3.2" | ||
"@napi-rs/blake-hash-win32-x64-msvc": "1.3.3", | ||
"@napi-rs/blake-hash-darwin-x64": "1.3.3", | ||
"@napi-rs/blake-hash-linux-x64-gnu": "1.3.3", | ||
"@napi-rs/blake-hash-darwin-arm64": "1.3.3", | ||
"@napi-rs/blake-hash-android-arm64": "1.3.3", | ||
"@napi-rs/blake-hash-linux-arm64-gnu": "1.3.3", | ||
"@napi-rs/blake-hash-linux-arm64-musl": "1.3.3", | ||
"@napi-rs/blake-hash-win32-arm64-msvc": "1.3.3", | ||
"@napi-rs/blake-hash-linux-x64-musl": "1.3.3", | ||
"@napi-rs/blake-hash-freebsd-x64": "1.3.3", | ||
"@napi-rs/blake-hash-win32-ia32-msvc": "1.3.3" | ||
} | ||
} |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
19127
148
1