webcrypto-liner
Advanced tools
Comparing version 0.1.5 to 0.1.6
{ | ||
"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"); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
149733
2944
0