Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@eik/common
Advanced tools
This package contains common utilities and schemas
From v4, this module is ESM only and cannot be used with Common JS.
Importing schemas
import { schemas, assert } from '@eik/common';
Validating an eik.json
file
const { error, value } = schemas.validate.eikJSON({
name: 'my-app',
version: '1.0.0',
server: 'http://eik-server',
files: [],
});
//or
assert.eikJSON({
name: 'my-app',
version: '1.0.0',
server: 'http://eik-server',
files: [],
});
Using individual schema validators
const { error, value } = schemas.validate.name('my-app');
// or
assert.name('my-app');
const { error, value } = schemas.validate.version('1.0.0');
// or
assert.version('1.0.0');
const { error, value } = schemas.validate.type('package');
// or
assert.type('package');
const { error, value } = schemas.validate.server('http://myeikserver.com');
// or
assert.server('http://myeikserver.com');
const { error, value } = schemas.validate.files({
'./index.js': '/path/to/file.js',
});
// or
assert.files({
'./index.js': '/path/to/file.js',
});
const { error, value } = schemas.validate.importMap(
'http://meserver.com/map.json',
);
const { error, value } = schemas.validate.importMap([
'http://meserver.com/map1.json',
'http://meserver.com/map2.json',
]);
// or
assert.importMap([
'http://meserver.com/map1.json',
'http://meserver.com/map2.json',
]);
const { error, value } = schemas.validate.out('./.eik');
// or
assert.out('./.eik');
A function to help development by mounting development routes to an Express.js or Fastify app based on values defined in eik.json
import express from 'express';
import { helpers } from '@eik/common';
const app = express();
await helpers.localAssets(app);
For an eik.json
file such as
{
"name": "my-app",
"version": "1.0.0",
"server": "https://assets.myeikserver.com",
"files": {
"esm.js": "./assets/esm.js",
"esm.css": "./assets/esm.css",
"/": "./assets/**/*.map"
}
}
A number of routes would be mounted into your app.
/pkg/my-app/1.0.0/esm.js
/pkg/my-app/1.0.0/esm.css
/pkg/my-app/1.0.0/esm.js.map
/pkg/my-app/1.0.0/esm.css.map
This helper function can be used to build URLs for given entries in an eik.json
files section.
Given the following eik.json
file:
{
"name": "my-app",
"version": "1.0.0",
"server": "https://assets.myeikserver.com",
"files": {
"esm.js": "./assets/esm.js",
"esm.css": "./assets/esm.css",
"/": "./assets/**/*.map"
}
}
and the following call to packageURL
import { helpers } from '@eik/common';
const url = await helpers.packageURL('esm.js');
The URL returned will be https://assets.myeikserver.com/pkg/my-app/1.0.0/esm.js
FAQs
Common utilities for Eik modules
The npm package @eik/common receives a total of 1,889 weekly downloads. As such, @eik/common popularity was classified as popular.
We found that @eik/common demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.