New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@adeira/signed-source

Package Overview
Dependencies
Maintainers
4
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adeira/signed-source

Utility for signing and verifying generated files.

latest
npmnpm
Version
2.0.0
Version published
Weekly downloads
42
68%
Maintainers
4
Weekly downloads
 
Created
Source

This packages originated from https://github.com/facebook/fbjs (cleaned up and tweaked for our use-case). It verifies automatically generated files and effectively prevents from manual pollution. Usage (simplified GraphQL schema snapshoting example):

import SignedSource from '@adeira/signed-source';

// we can now save this signed file
const newSnapshot = SignedSource.signFile(`# ${SignedSource.getSigningToken()}\n\n${schema}`);

// or verify its content
const oldSnapshot = fs.readFileSync(' ... ');
if (!SignedSource.verifySignature(oldSnapshot)) {
  throw new Error('Manual changes detected!');
}

It is also possible to re-sign file which is already signed (means update the signature when it already exists).

FAQs

Package last updated on 05 Feb 2021

Related posts