node-webcrypto-ossl
Advanced tools
Comparing version 1.0.33 to 1.0.34
@@ -28,2 +28,5 @@ "use strict"; | ||
break; | ||
case "K-256": | ||
namedCurve = "secp256k1"; | ||
break; | ||
default: | ||
@@ -82,14 +85,13 @@ throw new WebCryptoError("Unsupported namedCurve in use"); | ||
} | ||
if (!alg.namedCurve) { | ||
throw new WebCryptoError("ImportKey: namedCurve property of algorithm parameter is required"); | ||
} | ||
var keyLength = 0; | ||
var crv = ""; | ||
if (keyData.length === 65) { | ||
crv = "P-256"; | ||
keyLength = 32; | ||
} | ||
else if (keyData.length === 97) { | ||
crv = "P-384"; | ||
keyLength = 48; | ||
} | ||
else if (keyData.length === 133) { | ||
crv = "P-521"; | ||
keyLength = 66; | ||
@@ -100,3 +102,3 @@ } | ||
data["kty"] = new Buffer("EC", "utf-8"); | ||
data["crv"] = nc2ssl(crv); | ||
data["crv"] = nc2ssl(alg.namedCurve.toUpperCase()); | ||
data["x"] = b64_decode(Base64Url.encode(buf_pad(x, keyLength))); | ||
@@ -187,2 +189,3 @@ data["y"] = b64_decode(Base64Url.encode(buf_pad(y, keyLength))); | ||
case "P-256": | ||
case "K-256": | ||
padSize = 32; | ||
@@ -241,2 +244,3 @@ break; | ||
case "P-256": | ||
case "K-256": | ||
padSize = 32; | ||
@@ -243,0 +247,0 @@ break; |
@@ -7,5 +7,2 @@ "use strict"; | ||
var subtle = require("./subtle"); | ||
var g = global; | ||
g.btoa = function (data) { return new Buffer(data, "binary").toString("base64"); }; | ||
g.atob = function (data) { return new Buffer(data, "base64").toString("binary"); }; | ||
var ERR_RANDOM_VALUE_LENGTH = "Failed to execute 'getRandomValues' on 'Crypto': The ArrayBufferView's byte length (%1) exceeds the number of bytes of entropy available via this API (65536)."; | ||
@@ -12,0 +9,0 @@ var WebCrypto = (function () { |
{ | ||
"name": "node-webcrypto-ossl", | ||
"version": "1.0.33", | ||
"version": "1.0.34", | ||
"repository": { | ||
@@ -37,3 +37,4 @@ "type": "git", | ||
"jwk", | ||
"polyfill" | ||
"polyfill", | ||
"secp256k1" | ||
], | ||
@@ -44,3 +45,3 @@ "dependencies": { | ||
"tslib": "^1.8.1", | ||
"webcrypto-core": "^0.1.18" | ||
"webcrypto-core": "^0.1.19" | ||
}, | ||
@@ -53,4 +54,5 @@ "devDependencies": { | ||
"nyc": "^10.1.2", | ||
"pvtsutils": "^1.0.2", | ||
"typescript": "^2.6.2" | ||
} | ||
} |
@@ -89,2 +89,8 @@ # node-webcrypto-ossl | ||
## Elliptic curve secp256k1 | ||
`secp256k1` curve is not defined by the WebCrypto specifications. This module implements `K-256` curve for ECDSA algorithm. | ||
[K-256 curve examples](https://github.com/PeculiarVentures/webcrypto-core/blob/master/spec/EC_K_256.md) | ||
## KeyStorage | ||
@@ -91,0 +97,0 @@ |
@@ -14,3 +14,3 @@ "use strict"; | ||
var DIGEST = ["SHA-1", "SHA-256", "SHA-384", "SHA-512"]; | ||
var NAMED_CURVES = ["P-256", "P-384", "P-521"]; | ||
var NAMED_CURVES = ["P-256", "P-384", "P-521", "K-256"]; | ||
@@ -17,0 +17,0 @@ var keys = []; |
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
369269
106
4149
169
7
Updatedwebcrypto-core@^0.1.19