Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ocap/mcrypto

Package Overview
Dependencies
Maintainers
0
Versions
473
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ocap/mcrypto - npm Package Compare versions

Comparing version 1.18.166 to 1.19.0

esm/crypter/aes-legacy.d.ts

2

lib/crypter/rsa-browserify.js

@@ -13,3 +13,3 @@ "use strict";

class RSABrowserCrypter {
async genKeyPair(length = 2048) {
genKeyPair(length = 2048) {
return crypto.generateKey({

@@ -16,0 +16,0 @@ name: RSA_ALGORITHM,

@@ -1,2 +0,1 @@

/// <reference types="node" />
import crypto from 'crypto';

@@ -3,0 +2,0 @@ import { BytesType, EncodingType } from '@ocap/util';

@@ -1,2 +0,1 @@

/// <reference types="node" />
import { BytesType, EncodingType } from '@ocap/util';

@@ -3,0 +2,0 @@ export declare function encode(data: BytesType, encoding?: 'hex'): string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.encode = void 0;
exports.encode = encode;
const util_1 = require("@ocap/util");

@@ -23,2 +23,1 @@ function encode(data, encoding = 'hex') {

}
exports.encode = encode;

@@ -1,8 +0,7 @@

/// <reference types="node" />
import type { BytesType, EncodingType, KeyPairType } from '@ocap/util';
import type { LiteralUnion } from 'type-fest';
export declare type KeyType = LiteralUnion<'ED25519' | 'SECP256K1' | 'ETHEREUM', string>;
export declare type HashType = LiteralUnion<'KECCAK' | 'SHA3' | 'KECCAK_384' | 'SHA3_384' | 'KECCAK_512' | 'SHA3_512' | 'SHA2', string>;
export declare type RoleType = LiteralUnion<'ROLE_ACCOUNT' | 'ROLE_NODE' | 'ROLE_DEVICE' | 'ROLE_APPLICATION' | 'ROLE_SMART_CONTRACT' | 'ROLE_BOT' | 'ROLE_ASSET' | 'ROLE_STAKE' | 'ROLE_VALIDATOR' | 'ROLE_GROUP' | 'ROLE_GROUP' | 'ROLE_TX' | 'ROLE_TETHER' | 'ROLE_SWAP' | 'ROLE_DELEGATION' | 'ROLE_VC' | 'ROLE_BLOCKLET' | 'ROLE_STORE' | 'ROLE_TOKEN' | 'ROLE_FACTORY' | 'ROLE_ROLLUP' | 'ROLE_ANY', string>;
export declare type AddressType = LiteralUnion<'BASE16' | 'BASE58', string>;
export type KeyType = LiteralUnion<'ED25519' | 'SECP256K1' | 'ETHEREUM', string>;
export type HashType = LiteralUnion<'KECCAK' | 'SHA3' | 'KECCAK_384' | 'SHA3_384' | 'KECCAK_512' | 'SHA3_512' | 'SHA2', string>;
export type RoleType = LiteralUnion<'ROLE_ACCOUNT' | 'ROLE_NODE' | 'ROLE_DEVICE' | 'ROLE_APPLICATION' | 'ROLE_SMART_CONTRACT' | 'ROLE_BOT' | 'ROLE_ASSET' | 'ROLE_STAKE' | 'ROLE_VALIDATOR' | 'ROLE_GROUP' | 'ROLE_GROUP' | 'ROLE_TX' | 'ROLE_TETHER' | 'ROLE_SWAP' | 'ROLE_DELEGATION' | 'ROLE_VC' | 'ROLE_BLOCKLET' | 'ROLE_STORE' | 'ROLE_TOKEN' | 'ROLE_FACTORY' | 'ROLE_ROLLUP' | 'ROLE_STORAGE' | 'ROLE_PROFILE' | 'ROLE_PASSKEY' | 'ROLE_ANY', string>;
export type AddressType = LiteralUnion<'BASE16' | 'BASE58', string>;
export interface HashFnType {

@@ -33,3 +32,3 @@ (data: BytesType, round: number, encoding?: 'hex'): string;

sign(data: BytesType, sk: BytesType, encoding?: EncodingType): BytesType;
verify(data: BytesType, pk: BytesType, signature: BytesType): boolean;
verify(data: BytesType, pk: BytesType, signature: BytesType, extra?: any): boolean;
ethHash?(data: string): string;

@@ -61,2 +60,3 @@ ethSign?(data: string, sk: string): string;

Ethereum: import("./signer/ethereum").EthereumSigner;
Passkey: import("./signer/passkey").PasskeySigner;
};

@@ -111,2 +111,3 @@ /**

ETHEREUM: number;
PASSKEY: number;
};

@@ -163,2 +164,3 @@ /**

ROLE_PROFILE: number;
ROLE_PASSKEY: number;
ROLE_ANY: number;

@@ -230,3 +232,3 @@ };

export declare const Signers: Readonly<{
[x: number]: import("./signer/ed25519").Ed25519Signer | import("./signer/secp256k1").Secp256k1Signer;
[x: number]: import("./signer/ed25519").Ed25519Signer | import("./signer/secp256k1").Secp256k1Signer | import("./signer/passkey").PasskeySigner;
}>;

@@ -233,0 +235,0 @@ export declare const Hashers: Readonly<{

@@ -6,3 +6,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.toTxHash = exports.Hashers = exports.Signers = exports.getRandomBytes = exports.getHasher = exports.getSigner = exports.types = exports.Hasher = exports.Signer = void 0;
exports.toTxHash = exports.Hashers = exports.Signers = exports.types = exports.Hasher = exports.Signer = void 0;
exports.getSigner = getSigner;
exports.getHasher = getHasher;
exports.getRandomBytes = getRandomBytes;
const randombytes_1 = __importDefault(require("randombytes"));

@@ -16,2 +19,3 @@ const encode_1 = require("./encode");

const secp256k1_1 = __importDefault(require("./signer/secp256k1"));
const passkey_1 = __importDefault(require("./signer/passkey"));
/**

@@ -38,2 +42,3 @@ * Contains all supported signers, eg: `Ed25519` and `Secp256k1`

Ethereum: ethereum_1.default,
Passkey: passkey_1.default,
};

@@ -88,2 +93,3 @@ /**

ETHEREUM: 2,
PASSKEY: 3,
},

@@ -140,2 +146,3 @@ /**

ROLE_PROFILE: 21,
ROLE_PASSKEY: 22,
ROLE_ANY: 63,

@@ -183,3 +190,2 @@ },

}
exports.getSigner = getSigner;
/**

@@ -210,7 +216,5 @@ * Get hasher instance

}
exports.getHasher = getHasher;
function getRandomBytes(length = 32, encoding = 'hex') {
return (0, encode_1.encode)((0, randombytes_1.default)(length), encoding);
}
exports.getRandomBytes = getRandomBytes;
exports.Signers = Object.freeze({

@@ -220,2 +224,3 @@ [exports.types.KeyType.ED25519]: exports.Signer.Ed25519,

[exports.types.KeyType.ETHEREUM]: exports.Signer.Ethereum,
[exports.types.KeyType.PASSKEY]: exports.Signer.Passkey,
});

@@ -222,0 +227,0 @@ exports.Hashers = Object.freeze({

{
"name": "@ocap/mcrypto",
"version": "1.18.166",
"version": "1.19.0",
"description": "Crypto lib that provides signer,crypter,hasher interface",

@@ -24,18 +24,30 @@ "keywords": [

"license": "Apache-2.0",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"main": "./lib/index.js",
"module": "./lib/index.js",
"types": "./esm/index.d.ts",
"exports": {
".": {
"import": "./esm/index.js",
"require": "./lib/index.js",
"default": "./esm/index.js"
},
"./lib/*": {
"require": "./lib/*.js"
}
},
"files": [
"lib"
"lib",
"esm"
],
"devDependencies": {
"@arcblock/eslint-config-ts": "0.2.3",
"@arcblock/eslint-config-ts": "0.3.3",
"@types/crypto-js": "^4.2.2",
"@types/elliptic": "^6.4.14",
"@types/node": "^17.0.45",
"@types/randombytes": "^2.0.0",
"eslint": "^8.25.0",
"@types/elliptic": "^6.4.18",
"@types/node": "^22.7.5",
"@types/randombytes": "^2.0.3",
"eslint": "^8.57.0",
"jest": "^29.7.0",
"ts-jest": "^29.2.5",
"type-fest": "^3.1.0",
"typescript": "^4.8.4"
"typescript": "^5.6.2"
},

@@ -52,5 +64,7 @@ "repository": {

"coverage": "npm run test -- --coverage",
"clean": "rm -fr lib",
"clean": "rm -fr lib esm",
"prebuild": "npm run clean",
"build": "tsc",
"build:cjs": "tsc -p tsconfig.cjs.json",
"build:esm": "tsc -p tsconfig.esm.json",
"build": "npm run build:cjs && npm run build:esm",
"build:watch": "npm run build -- -w"

@@ -62,3 +76,4 @@ },

"dependencies": {
"@ocap/util": "1.18.166",
"@ocap/util": "1.19.0",
"@simplewebauthn/server": "^13.0.0",
"bn.js": "5.2.1",

@@ -78,3 +93,3 @@ "crypto-js": "^4.2.0",

},
"gitHead": "58c8356b3b8c238728560e4c3fef6ed1704d3ac4"
"gitHead": "1b6fac03988fb18507c8ef4c21de282762005f87"
}

@@ -5,3 +5,3 @@ ![mcrypto:js](https://www.arcblock.io/.netlify/functions/badge/?text=mcrypto:js)

[![docs](https://img.shields.io/badge/powered%20by-arcblock-green.svg)](https://docs.arcblock.io)
[![Gitter](https://badges.gitter.im/ArcBlock/community.svg)](https://gitter.im/ArcBlock/community?utm_source=badge\&utm_medium=badge\&utm_campaign=pr-badge)
[![Gitter](https://badges.gitter.im/ArcBlock/community.svg)](https://gitter.im/ArcBlock/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

@@ -47,13 +47,13 @@ > Forge [mcrypto](https://github.com/ArcBlock/mcrypto) implementation for javascript, just a wrapper around existing javascript crypto libraries.

* keccakf1600: js-sha3
* sha2: hash.js
* sha3: js-sha3
- keccakf1600: js-sha3
- sha2: hash.js
- sha3: js-sha3
### Signer
* [`ed25519`](https://github.com/ArcBlock/blockchain/commit/ed25519): tweetnacl
* secp256k1: elliptic
- [`ed25519`](https://github.com/ArcBlock/blockchain/commit/ed25519): tweetnacl
- secp256k1: elliptic
### Crypter
* aes-cbc-256: crypto-js
- aes-cbc-256: crypto-js
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc