
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@types/sm-crypto
Advanced tools
TypeScript definitions for sm-crypto
npm install --save @types/sm-crypto
This package contains type definitions for sm-crypto (https://github.com/JuneAndGreen/sm-crypto#readme).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sm-crypto.
import BigInteger = require("bigi");
export interface KeyPairHex {
privateKey: string;
publicKey: string;
}
export interface KeyPairPoint extends KeyPairHex {
k: BigInteger;
x1: BigInteger;
}
/**
* Cipher Mode
* - `0`:C1C2C3
* - `1`:C1C3C2
*/
export type CipherMode = 0 | 1;
export namespace sm2 {
// TODO Type of parameter of jsbn.BigInteger constructor
function generateKeyPairHex(): KeyPairHex;
function doEncrypt(msg: string | ArrayLike<number>, publicKey: string, cipherMode?: CipherMode): string;
function doDecrypt(encryptData: string, privateKey: string, cipherMode?: CipherMode, outputType?: {
output?: "string" | "array";
}): string;
function doSignature(msg: string | number[], privateKey: string, options?: {
pointPool?: KeyPairPoint[] | undefined;
der?: boolean | undefined;
hash?: boolean | undefined;
publicKey?: string | undefined;
userId?: string | undefined;
}): string;
function doVerifySignature(msg: string | number[], signHex: string, publicKey: string, options?: {
der?: boolean | undefined;
hash?: boolean | undefined;
userId?: string | undefined;
}): boolean;
function getPoint(): KeyPairPoint;
}
export function sm3(input: string | ArrayLike<number>, hmac?: {
key: HexString | ArrayLike<number>;
mode?: "hmac";
}): string;
// SM4.encrypt() expects UTF8 strings (such as "hello"), while SM4.decrypt() expects hex strings (such as "8d0a1f").
export type HexString = string;
export type UTF8String = string;
export interface SM4ModeBase {
padding?: "none" | "pkcs#5" | "pkcs#7";
mode?: "cbc";
iv?: number[] | HexString;
}
export interface SM4Mode_StringOutput extends SM4ModeBase {
output: "string";
}
export interface SM4Mode_ArrayOutput extends SM4ModeBase {
output: "array";
}
export namespace sm4 {
function encrypt(
inArray: number[] | UTF8String,
key: number[] | HexString,
mode?: SM4ModeBase | SM4Mode_StringOutput,
): string;
function encrypt(inArray: number[] | UTF8String, key: number[] | HexString, mode: SM4Mode_ArrayOutput): number[];
function decrypt(
inArray: number[] | HexString,
key: number[] | HexString,
mode?: SM4ModeBase | SM4Mode_StringOutput,
): string;
function decrypt(inArray: number[] | HexString, key: number[] | HexString, mode: SM4Mode_ArrayOutput): number[];
}
These definitions were written by Thermod.
FAQs
TypeScript definitions for sm-crypto
The npm package @types/sm-crypto receives a total of 3,320 weekly downloads. As such, @types/sm-crypto popularity was classified as popular.
We found that @types/sm-crypto 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.