webcrypto-core
Advanced tools
Comparing version 1.0.12 to 1.0.13
@@ -175,3 +175,3 @@ | ||
checkKeyData(format: KeyFormat, keyData: any): void; | ||
protected prepareData(data: any): ArrayBuffer; | ||
protected prepareData(data: any): ArrayBuffer | SharedArrayBuffer; | ||
} | ||
@@ -446,3 +446,3 @@ | ||
declare class BufferSourceConverter { | ||
static toArrayBuffer(data: BufferSource): ArrayBuffer; | ||
static toArrayBuffer(data: BufferSource): ArrayBuffer | SharedArrayBuffer; | ||
static toUint8Array(data: BufferSource): Uint8Array; | ||
@@ -449,0 +449,0 @@ static isBufferSource(data: any): data is BufferSource; |
@@ -93,16 +93,16 @@ /** | ||
static toArrayBuffer(data) { | ||
if (data instanceof ArrayBuffer) { | ||
return data; | ||
} | ||
return this.toUint8Array(data).buffer; | ||
} | ||
static toUint8Array(data) { | ||
if (typeof Buffer !== "undefined" && Buffer.isBuffer(data)) { | ||
return new Uint8Array(data).buffer; | ||
return new Uint8Array(data); | ||
} | ||
if (ArrayBuffer.isView(data)) { | ||
return data.buffer; | ||
return Buffer.from(data.buffer, data.byteOffset, data.byteLength); | ||
} | ||
if (data instanceof ArrayBuffer) { | ||
return new Uint8Array(data); | ||
} | ||
throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'"); | ||
} | ||
static toUint8Array(data) { | ||
return new Uint8Array(this.toArrayBuffer(data)); | ||
} | ||
static isBufferSource(data) { | ||
@@ -109,0 +109,0 @@ return ArrayBuffer.isView(data) || data instanceof ArrayBuffer; |
@@ -97,16 +97,16 @@ /** | ||
static toArrayBuffer(data) { | ||
if (data instanceof ArrayBuffer) { | ||
return data; | ||
} | ||
return this.toUint8Array(data).buffer; | ||
} | ||
static toUint8Array(data) { | ||
if (typeof Buffer !== "undefined" && Buffer.isBuffer(data)) { | ||
return new Uint8Array(data).buffer; | ||
return new Uint8Array(data); | ||
} | ||
if (ArrayBuffer.isView(data)) { | ||
return data.buffer; | ||
return Buffer.from(data.buffer, data.byteOffset, data.byteLength); | ||
} | ||
if (data instanceof ArrayBuffer) { | ||
return new Uint8Array(data); | ||
} | ||
throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'"); | ||
} | ||
static toUint8Array(data) { | ||
return new Uint8Array(this.toArrayBuffer(data)); | ||
} | ||
static isBufferSource(data) { | ||
@@ -113,0 +113,0 @@ return ArrayBuffer.isView(data) || data instanceof ArrayBuffer; |
{ | ||
"name": "webcrypto-core", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "Common layer to be used by crypto libraries based on WebCrypto API for input validation.", | ||
@@ -35,15 +35,15 @@ "main": "build/webcrypto-core.js", | ||
"pvtsutils": "^1.0.4", | ||
"tslib": "^1.9.3" | ||
"tslib": "^1.10.0" | ||
}, | ||
"devDependencies": { | ||
"@types/mocha": "^5.2.6", | ||
"@types/node": "^10.14.4", | ||
"coveralls": "^3.0.3", | ||
"mocha": "^5.2.0", | ||
"nyc": "^13.3.0", | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^10.14.17", | ||
"coveralls": "^3.0.6", | ||
"mocha": "^6.2.0", | ||
"nyc": "^14.1.1", | ||
"reflect-metadata": "^0.1.13", | ||
"rollup": "^1.10.0", | ||
"rollup": "^1.20.3", | ||
"rollup-plugin-dts": "^0.14.0", | ||
"ts-node": "^8.0.3", | ||
"typescript": "^3.4.3" | ||
"ts-node": "^8.3.0", | ||
"typescript": "^3.6.2" | ||
}, | ||
@@ -50,0 +50,0 @@ "author": "PeculiarVentures", |
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
95203
Updatedtslib@^1.10.0