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.
A Node.js package that can generate a TypeScript definition based on a CDDL file
A Node.js package that can generate a TypeScript definition based on a CDDL file
CDDL expresses Concise Binary Object Representation (CBOR) data structures (RFC 7049). Its main goal is to provide an easy and unambiguous way to express structures for protocol messages and data formats that use CBOR or JSON. This package allows you to transform a CDDL file into a TypeScript interface that you can use for other TypeScript project.
Related projects:
To install this package run:
$ npm install cddl2ts
This package exposes a CLI as well as a programmatic interface for transforming CDDL into TypeScript.
npx cddl2ts ./path/to/interface.cddl &> ./path/to/interface.ts
The module exports a transform
method that takes an CDDL AST object and returns a TypeScript definition as string
, e.g.:
import { parse } from 'cddl'
import { transform } from 'cddl2ts'
/**
* spec.cddl:
*
* session.CapabilityRequest = {
* ?acceptInsecureCerts: bool,
* ?browserName: text,
* ?browserVersion: text,
* ?platformName: text,
* };
*/
const ast = parse('./spec.cddl')
const ts = transform(ast)
console.log(ts)
/**
* outputs:
*
* interface SessionCapabilityRequest {
* acceptInsecureCerts?: boolean,
* browserName?: string,
* browserVersion?: string,
* platformName?: string,
* }
*/
If you are interested in this project, please feel free to contribute ideas or code patches. Have a look at our contributing guidelines to get started.
FAQs
A Node.js package that can generate a TypeScript definition based on a CDDL file
The npm package cddl2ts receives a total of 345 weekly downloads. As such, cddl2ts popularity was classified as not popular.
We found that cddl2ts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.