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

ton-crypto-primitives

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ton-crypto-primitives - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

14

dist/native/getSecureRandom.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSecureRandomWords = exports.getSecureRandomBytes = void 0;
const crypto_1 = __importDefault(require("crypto"));
const getRandomBytes = require('expo-random').getRandomBytes;
function getSecureRandomBytes(size) {
return crypto_1.default.randomBytes(size);
return Buffer.from(getRandomBytes(size));
}
exports.getSecureRandomBytes = getSecureRandomBytes;
function getSecureRandomWords(size) {
let res = new Uint16Array(size);
crypto_1.default.randomFillSync(res);
return res;
const bytes = getSecureRandomBytes(size * 2);
// Create a new TypedArray that is of the same type as the given TypedArray but is backed with the
// array buffer containing random bytes. This is cheap and copies no data.
return new Uint16Array(bytes.buffer, bytes.byteOffset, size);
}
exports.getSecureRandomWords = getSecureRandomWords;
{
"name": "ton-crypto-primitives",
"version": "1.0.1",
"version": "2.0.0",
"repository": "https://github.com/tonwhales/ton-crypto-primitives.git",

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

@@ -28,14 +28,9 @@ # TON crypto primitives

## React Native
To make it work on react native some native modules are required:
To make it work on react native `expo-random` module is required:
`
expo install expo-standard-web-crypto
yarn install expo-random
`
```js
import { polyfillWebCrypto } from 'expo-standard-web-crypto';
polyfillWebCrypto();
```
# License
MIT
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