New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ton

Package Overview
Dependencies
Maintainers
3
Versions
179
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ton - npm Package Compare versions

Comparing version 11.15.0 to 11.16.0

4

dist/client/safeSign.d.ts
/// <reference types="node" />
import { Cell } from "../boc/Cell";
export declare function safeSign(cell: Cell, secretKey: Buffer): Buffer;
export declare function safeSignVerify(cell: Cell, signature: Buffer, publicKey: Buffer): boolean;
export declare function safeSign(cell: Cell, secretKey: Buffer, seed?: string): Buffer;
export declare function safeSignVerify(cell: Cell, signature: Buffer, publicKey: Buffer, seed?: string): boolean;

@@ -5,12 +5,21 @@ "use strict";

const ton_crypto_1 = require("ton-crypto");
function createSafeSignHash(cell) {
return (0, ton_crypto_1.sha256_sync)(Buffer.concat([Buffer.from([0xff, 0xff]), Buffer.from('ton-safe-sign-magic'), cell.hash()]));
const MIN_SEED_LENGTH = 8;
const MAX_SEED_LENGTH = 64;
function createSafeSignHash(cell, seed) {
let seedData = Buffer.from(seed);
if (seedData.length > MAX_SEED_LENGTH) {
throw Error('Seed can\t be longer than 64 bytes');
}
if (seedData.length < MIN_SEED_LENGTH) {
throw Error('Seed must be at least 8 bytes');
}
return (0, ton_crypto_1.sha256_sync)(Buffer.concat([Buffer.from([0xff, 0xff]), seedData, cell.hash()]));
}
function safeSign(cell, secretKey) {
return (0, ton_crypto_1.sign)(createSafeSignHash(cell), secretKey);
function safeSign(cell, secretKey, seed = 'ton-safe-sign-magic') {
return (0, ton_crypto_1.sign)(createSafeSignHash(cell, seed), secretKey);
}
exports.safeSign = safeSign;
function safeSignVerify(cell, signature, publicKey) {
return (0, ton_crypto_1.signVerify)(createSafeSignHash(cell), signature, publicKey);
function safeSignVerify(cell, signature, publicKey, seed = 'ton-safe-sign-magic') {
return (0, ton_crypto_1.signVerify)(createSafeSignHash(cell, seed), signature, publicKey);
}
exports.safeSignVerify = safeSignVerify;
{
"name": "ton",
"version": "11.15.0",
"version": "11.16.0",
"repository": "https://github.com/tonwhales/ton.git",

@@ -5,0 +5,0 @@ "author": "Steve Korshakov <steve@korshakov.com>",

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