Socket
Socket
Sign inDemoInstall

@vechain/sdk-core

Package Overview
Dependencies
Maintainers
8
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vechain/sdk-core - npm Package Compare versions

Comparing version 1.0.0-beta.25 to 1.0.0-beta.26

6

package.json
{
"name": "@vechain/sdk-core",
"version": "1.0.0-beta.25",
"version": "1.0.0-beta.26",
"description": "Includes modules for fundamental operations like hashing and cryptography",

@@ -44,4 +44,4 @@ "author": "vechain Foundation",

"@types/elliptic": "^6.4.18",
"@vechain/sdk-errors": "1.0.0-beta.25",
"@vechain/sdk-logging": "1.0.0-beta.25",
"@vechain/sdk-errors": "1.0.0-beta.26",
"@vechain/sdk-logging": "1.0.0-beta.26",
"bignumber.js": "^9.1.2",

@@ -48,0 +48,0 @@ "blakejs": "^1.2.1",

@@ -76,4 +76,22 @@ import * as n_utils from '@noble/curves/abstract/utils';

*/
function generatePrivateKey(): Uint8Array {
return n_secp256k1.utils.randomPrivateKey();
async function generatePrivateKey(): Promise<Uint8Array> {
try {
return n_secp256k1.utils.randomPrivateKey();
} catch (error) {
// Generate an ECDSA key pair
const cryptoKey = await global.crypto.subtle.generateKey(
{
name: 'AES-GCM',
length: 256
},
true,
['encrypt', 'decrypt']
);
// Export the private key to raw format
const rawKey = await global.crypto.subtle.exportKey('raw', cryptoKey);
// Convert the ArrayBuffer to Uint8Array
return new Uint8Array(rawKey);
}
}

@@ -154,3 +172,7 @@

function randomBytes(bytesLength?: number | undefined): Uint8Array {
return _randomBytes(bytesLength);
try {
return _randomBytes(bytesLength);
} catch (error) {
return global.crypto.getRandomValues(new Uint8Array(bytesLength ?? 32));
}
}

@@ -157,0 +179,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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