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

metautil

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metautil - npm Package Compare versions

Comparing version 3.7.0 to 3.7.1

10

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

## [3.7.1][] - 2023-03-12
- Use native UUID from `node:crypto`
- Remove `defaultHash` (empty string) in crypto module
- Use `crypto.randomInt` for `generateKey`
- Fix `fetch` polyfill
## [3.7.0][] - 2023-03-04

@@ -187,3 +194,4 @@

[unreleased]: https://github.com/metarhia/metautil/compare/v3.7.0....HEAD
[unreleased]: https://github.com/metarhia/metautil/compare/v3.7.1....HEAD
[3.7.1]: https://github.com/metarhia/metautil/compare/v3.7.0...v3.7.1
[3.7.0]: https://github.com/metarhia/metautil/compare/v3.6.0...v3.7.0

@@ -190,0 +198,0 @@ [3.6.0]: https://github.com/metarhia/metautil/compare/v3.5.25...v3.6.0

24

lib/crypto.js

@@ -31,16 +31,3 @@ 'use strict';

const generateUUID = () => {
const h1 = randomPrefetcher.next().toString('hex');
const h2 = randomPrefetcher.next().toString('hex');
const buf = randomPrefetcher.next();
buf[0] = (buf[0] & 0x0f) | 0x40;
buf[2] = (buf[2] & 0x3f) | 0x80;
const h3 = buf.toString('hex');
const h4 = randomPrefetcher.next().toString('hex');
const d2 = h2.substring(0, 4);
const d3 = h3.substring(0, 4);
const d4 = h3.substring(4, 8);
const d5 = h2.substring(4, 8) + h4;
return [h1, d2, d3, d4, d5].join('-');
};
const generateUUID = crypto.randomUUID;

@@ -51,3 +38,3 @@ const generateKey = (length, possible) => {

for (let i = 0; i < length; i++) {
const index = Math.floor(cryptoRandom() * base);
const index = crypto.randomInt(0, base);
key += possible[index];

@@ -129,8 +116,3 @@ }

let defaultHash;
hashPassword('').then((hash) => {
defaultHash = hash;
});
const validatePassword = (password, serHash = defaultHash) => {
const validatePassword = (password, serHash) => {
const { params, salt, hash } = deserializeHash(serHash);

@@ -137,0 +119,0 @@ return new Promise((resolve, reject) => {

@@ -8,8 +8,7 @@ 'use strict';

if (!body) return { headers };
const data = JSON.stringify(body);
const content = {
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(data),
'Content-Length': Buffer.byteLength(body),
};
return { body: data, headers: { ...content, ...headers } };
return { body, headers: { ...content, ...headers } };
};

@@ -31,4 +30,5 @@

const parse = (data) => async () => JSON.parse(data.toString());
const text = (data) => async () => data.toString();
receiveBody(res)
.then((data) => resolve({ json: parse(data) }))
.then((data) => resolve({ json: parse(data), text: text(data) }))
.catch(reject);

@@ -35,0 +35,0 @@ };

@@ -123,3 +123,3 @@ import { EventEmitter } from 'node:events';

headers?: object;
body?: object;
body?: ArrayBuffer | Buffer | string;
};

@@ -126,0 +126,0 @@

{
"name": "metautil",
"version": "3.7.0",
"version": "3.7.1",
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>",

@@ -5,0 +5,0 @@ "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