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

webcrypto-liner

Package Overview
Dependencies
Maintainers
2
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webcrypto-liner - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

2

package.json
{
"name": "webcrypto-liner",
"version": "0.1.5",
"version": "0.1.6",
"description": "A WebCrypto pollyfill that \"smooths out\" the rough-edges in existing User Agent implementations.",

@@ -5,0 +5,0 @@ "main": "build/index.js",

@@ -17,3 +17,3 @@ export let Browser = {

};
if (typeof module === "object" && module.exports !== void 0)
if (typeof window !== "object" && typeof self !== void "object")
return {

@@ -70,1 +70,12 @@ name: "NodeJS",

}
export function assign(target: any, ...sources: any[]) {
let res = arguments[0];
for (let i = 1; i < arguments.length; i++) {
let obj = arguments[i];
for (let prop in obj) {
res[prop] = obj[prop];
}
}
return res;
}
export * from "./init";
export * from "./main";
export * from "./main";
export * from "./crypto";

@@ -1,4 +0,9 @@

let _w: any = self;
let _w: any;
if (typeof self === "undefined") {
_w = { crypto: { subtle: {} } };
}
else
_w = self;
export const nativeCrypto: NativeCrypto = _w.msCrypto || _w.crypto;
export const nativeSubtle: NativeSubtleCrypto = nativeCrypto.subtle || (nativeCrypto as any).webkitSubtle;

@@ -10,3 +10,3 @@ // Core

import { CryptoKey, CryptoKeyPair } from "./key";
import { string2buffer, buffer2string, concat } from "./helper";
import { string2buffer, buffer2string, concat, Browser, BrowserInfo, assign } from "./helper";

@@ -172,3 +172,3 @@ // Crypto

.then((result: boolean) => {
if (typeof result === "boolean") return new Promise(resolve => resolve(signature));
if (typeof result === "boolean") return new Promise(resolve => resolve(result));
let Class: typeof BaseCrypto;

@@ -422,4 +422,6 @@ switch (_alg.name.toLowerCase()) {

if (msg) {
if (format === "jwk" && msg instanceof ArrayBuffer)
if (format === "jwk" && msg instanceof ArrayBuffer) {
msg = buffer2string(new Uint8Array(msg));
msg = JSON.parse(msg);
}
return Promise.resolve(msg);

@@ -458,2 +460,9 @@ }

_data = keyData;
// Fix: Safari
if (BrowserInfo().name === Browser.Safari) {
// Converts JWK to ArrayBuffer
args[1] = string2buffer(JSON.stringify(keyData)).buffer;
}
// End: Fix
if (ArrayBuffer.isView(keyData)) {

@@ -460,0 +469,0 @@ _data = PrepareData(keyData, "keyData");

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