ton-crypto-primitives
Advanced tools
Comparing version 1.0.1 to 2.0.0
"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 |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
17867
301
36