Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@schleifner/asc-to-header
Advanced tools
This tool is used for translate an AssemblyScript type definiton file to C++ header file.
This tool is used for translate an AssemblyScript type definiton file to C++ header file.
npm install
npm run bundle
node --experimental-modules bin/Cli.js -f [input assemblyscript file] -o [target header file]
output:
C Header file
example.ts
:
enum Status{
OK=0x1,
FAIL=0x2
}
export declare function printStatus(Status:Status);
output:
example.h
:
#ifndef __types_wasm_example_H__
#define __types_wasm_example_H__
extern "C" {
enum class Status {
OK = 0x1,
FAIL = 0x2,
};
__attribute__((import_module("example"))) void printStatus(Status Status);
}
#endif
For function type declaration, when use it in the function parameter, should use the same name.
for example:
ASC
export type mycallback = (data: i32) => void;
export function callService(mycallback: i32):void;
then we can translate to:
using mycallback = void (*) (int data);
__attribute__((import_module("test"))) void callService(mycallback mycallback);
but if we got asc like:
ASC
export type mycallback = (data: i32) => void;
export function callService(my_callback: i32):void;
then we can translate to:
using mycallback = void (*) (int data);
__attribute__((import_module("test"))) void callService(int my_callback);
Some user data type, which is often used as C like API context, is usually a pointer type. Type UserDataType
is designed as a reserved type. This type will be translated to uintptr_t
in C++.
FAQs
This tool is used for translate an AssemblyScript type definiton file to C++ header file.
We found that @schleifner/asc-to-header demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.