Socket
Socket
Sign inDemoInstall

webcrypto-core

Package Overview
Dependencies
Maintainers
2
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webcrypto-core - npm Package Compare versions

Comparing version 0.1.15 to 0.1.16

dist/webcrypto-core.js.map

3

dist/webcrypto-core.es.js

@@ -95,2 +95,5 @@ import { __extends } from 'tslib';

}
if (typeof Buffer !== "undefined" && Buffer.isBuffer(data)) {
return new Uint8Array(data);
}
if (ArrayBuffer.isView(data)) {

@@ -97,0 +100,0 @@ return new Uint8Array(data.buffer);

@@ -98,2 +98,5 @@ 'use strict';

}
if (typeof Buffer !== "undefined" && Buffer.isBuffer(data)) {
return new Uint8Array(data);
}
if (ArrayBuffer.isView(data)) {

@@ -100,0 +103,0 @@ return new Uint8Array(data.buffer);

@@ -0,0 +0,0 @@ declare type NativeCrypto = Crypto;

4

package.json
{
"name": "webcrypto-core",
"version": "0.1.15",
"version": "0.1.16",
"description": "Common layer to be used by crypto libraries based on WebCrypto API for input validation.",

@@ -12,3 +12,2 @@ "main": "dist/webcrypto-core.js",

"scripts": {
"prepublish": "npm run build:dist",
"build": "npm run build:es5",

@@ -21,2 +20,3 @@ "build:es5": "rollup -c",

"test": "mocha test",
"prepub": "npm run build:dist",
"pub": "npm version patch && npm publish && git push",

@@ -23,0 +23,0 @@ "precoverage": "npm run build:map",

@@ -0,0 +0,0 @@ [![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/PeculiarVentures/webcrypto-core/master/LICENSE)

@@ -0,0 +0,0 @@ var webcrypto = require("../");

@@ -0,0 +0,0 @@ var Base64Url = require("../").Base64Url;

@@ -38,26 +38,36 @@ var webcrypto = require("../");

function TestPrepareData(inData, byteLength) {
const outData = webcrypto.PrepareData(inData);
assert.equal(outData.byteLength, byteLength);
assert.equal(ArrayBuffer.isView(outData), true);
const bufInData = new Buffer(Buffer.isBuffer(inData) || inData instanceof ArrayBuffer ? inData : inData.buffer);
const bufOutData = new Buffer(outData);
assert.equal(Buffer.compare(bufInData, bufOutData), 0);
}
it("from Uint8Array", () => {
var data = webcrypto.PrepareData(new Uint8Array(10));
assert.equal(data.length, 10);
assert.equal(ArrayBuffer.isView(data), true);
const data = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]);
TestPrepareData(data, 10);
});
it("from Uint16Array", () => {
var data = webcrypto.PrepareData(new Uint16Array(10));
assert.equal(data.byteLength, 20);
assert.equal(ArrayBuffer.isView(data), true);
const data = new Uint16Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]);
TestPrepareData(data, 20);
});
it("from Uint32Array", () => {
var data = webcrypto.PrepareData(new Uint32Array(10));
assert.equal(data.byteLength, 40);
assert.equal(ArrayBuffer.isView(data), true);
const data = new Uint32Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]);
TestPrepareData(data, 40);
});
it("from ArrayBuffer", () => {
var data = webcrypto.PrepareData(new Uint8Array(10).buffer);
assert.equal(data.byteLength, 10);
assert.equal(ArrayBuffer.isView(data), true);
const data = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]).buffer;
TestPrepareData(data, 10);
});
it("from Buffer", () => {
const data = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]);
TestPrepareData(data, 10);
});
it("from wrong data", () => {

@@ -64,0 +74,0 @@ assert.throws(() => webcrypto.PrepareData("12345"), Error);

@@ -0,0 +0,0 @@ var helper = require("./helper");

@@ -0,0 +0,0 @@ var subtle = new (require("../").SubtleCrypto);

@@ -0,0 +0,0 @@ var webcrypto = require("../");

@@ -0,0 +0,0 @@ var webcrypto = require("../");

@@ -0,0 +0,0 @@ var helper = require("./helper");

@@ -0,0 +0,0 @@ var helper = require("./helper");

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /// <reference path="../index.d.ts" />

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