aboutsummaryrefslogtreecommitdiff
path: root/node_modules/create-ecdh
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
commitcc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 (patch)
tree92c5d88706a6ffc654d1b133618d357890e7096b /node_modules/create-ecdh
parent3771b4d6b67b34c130f3a9a1a15f42deefdb2eda (diff)
downloadwallet-core-cc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585.tar.xz
remove node_modules
Diffstat (limited to 'node_modules/create-ecdh')
-rw-r--r--node_modules/create-ecdh/.travis.yml7
-rw-r--r--node_modules/create-ecdh/browser.js124
-rw-r--r--node_modules/create-ecdh/index.js3
-rw-r--r--node_modules/create-ecdh/package.json35
-rw-r--r--node_modules/create-ecdh/readme.md4
5 files changed, 0 insertions, 173 deletions
diff --git a/node_modules/create-ecdh/.travis.yml b/node_modules/create-ecdh/.travis.yml
deleted file mode 100644
index 4ceadcbea..000000000
--- a/node_modules/create-ecdh/.travis.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-language: node_js
-sudo: false
-node_js:
- - 6
- - 8
- - 9
- - 10
diff --git a/node_modules/create-ecdh/browser.js b/node_modules/create-ecdh/browser.js
deleted file mode 100644
index 3613b4514..000000000
--- a/node_modules/create-ecdh/browser.js
+++ /dev/null
@@ -1,124 +0,0 @@
-var elliptic = require('elliptic')
-var BN = require('bn.js')
-
-module.exports = function createECDH (curve) {
- return new ECDH(curve)
-}
-
-var aliases = {
- secp256k1: {
- name: 'secp256k1',
- byteLength: 32
- },
- secp224r1: {
- name: 'p224',
- byteLength: 28
- },
- prime256v1: {
- name: 'p256',
- byteLength: 32
- },
- prime192v1: {
- name: 'p192',
- byteLength: 24
- },
- ed25519: {
- name: 'ed25519',
- byteLength: 32
- },
- secp384r1: {
- name: 'p384',
- byteLength: 48
- },
- secp521r1: {
- name: 'p521',
- byteLength: 66
- }
-}
-
-aliases.p224 = aliases.secp224r1
-aliases.p256 = aliases.secp256r1 = aliases.prime256v1
-aliases.p192 = aliases.secp192r1 = aliases.prime192v1
-aliases.p384 = aliases.secp384r1
-aliases.p521 = aliases.secp521r1
-
-function ECDH (curve) {
- this.curveType = aliases[curve]
- if (!this.curveType) {
- this.curveType = {
- name: curve
- }
- }
- this.curve = new elliptic.ec(this.curveType.name) // eslint-disable-line new-cap
- this.keys = void 0
-}
-
-ECDH.prototype.generateKeys = function (enc, format) {
- this.keys = this.curve.genKeyPair()
- return this.getPublicKey(enc, format)
-}
-
-ECDH.prototype.computeSecret = function (other, inenc, enc) {
- inenc = inenc || 'utf8'
- if (!Buffer.isBuffer(other)) {
- other = new Buffer(other, inenc)
- }
- var otherPub = this.curve.keyFromPublic(other).getPublic()
- var out = otherPub.mul(this.keys.getPrivate()).getX()
- return formatReturnValue(out, enc, this.curveType.byteLength)
-}
-
-ECDH.prototype.getPublicKey = function (enc, format) {
- var key = this.keys.getPublic(format === 'compressed', true)
- if (format === 'hybrid') {
- if (key[key.length - 1] % 2) {
- key[0] = 7
- } else {
- key[0] = 6
- }
- }
- return formatReturnValue(key, enc)
-}
-
-ECDH.prototype.getPrivateKey = function (enc) {
- return formatReturnValue(this.keys.getPrivate(), enc)
-}
-
-ECDH.prototype.setPublicKey = function (pub, enc) {
- enc = enc || 'utf8'
- if (!Buffer.isBuffer(pub)) {
- pub = new Buffer(pub, enc)
- }
- this.keys._importPublic(pub)
- return this
-}
-
-ECDH.prototype.setPrivateKey = function (priv, enc) {
- enc = enc || 'utf8'
- if (!Buffer.isBuffer(priv)) {
- priv = new Buffer(priv, enc)
- }
-
- var _priv = new BN(priv)
- _priv = _priv.toString(16)
- this.keys = this.curve.genKeyPair()
- this.keys._importPrivate(_priv)
- return this
-}
-
-function formatReturnValue (bn, enc, len) {
- if (!Array.isArray(bn)) {
- bn = bn.toArray()
- }
- var buf = new Buffer(bn)
- if (len && buf.length < len) {
- var zeros = new Buffer(len - buf.length)
- zeros.fill(0)
- buf = Buffer.concat([zeros, buf])
- }
- if (!enc) {
- return buf
- } else {
- return buf.toString(enc)
- }
-}
diff --git a/node_modules/create-ecdh/index.js b/node_modules/create-ecdh/index.js
deleted file mode 100644
index 841d085ec..000000000
--- a/node_modules/create-ecdh/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-var createECDH = require('crypto').createECDH
-
-module.exports = createECDH || require('./browser')
diff --git a/node_modules/create-ecdh/package.json b/node_modules/create-ecdh/package.json
deleted file mode 100644
index b804cac43..000000000
--- a/node_modules/create-ecdh/package.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "name": "create-ecdh",
- "version": "4.0.3",
- "description": "createECDH but browserifiable",
- "main": "index.js",
- "browser": "browser.js",
- "scripts": {
- "test": "standard && node test.js | tspec"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/crypto-browserify/createECDH.git"
- },
- "keywords": [
- "diffie",
- "hellman",
- "diffiehellman",
- "ECDH"
- ],
- "author": "Calvin Metcalf",
- "license": "MIT",
- "bugs": {
- "url": "https://github.com/crypto-browserify/createECDH/issues"
- },
- "homepage": "https://github.com/crypto-browserify/createECDH",
- "dependencies": {
- "bn.js": "^4.1.0",
- "elliptic": "^6.0.0"
- },
- "devDependencies": {
- "tap-spec": "^1.0.1",
- "tape": "^3.0.1",
- "standard": "^5.4.1"
- }
-}
diff --git a/node_modules/create-ecdh/readme.md b/node_modules/create-ecdh/readme.md
deleted file mode 100644
index 7e5ce47b5..000000000
--- a/node_modules/create-ecdh/readme.md
+++ /dev/null
@@ -1,4 +0,0 @@
-createECDH [![Build Status](https://travis-ci.org/crypto-browserify/createECDH.svg)](https://travis-ci.org/crypto-browserify/createECDH)
-====
-
-In io.js or node >= 0.11 this module is just a shortcut to crypto.createECDH. In node <= 0.11 or the browser this is a pure JavaScript implimentation, more specifically a wrapper around [elliptic](https://github.com/indutny/elliptic), to give it the same API as node. `secp256k1`, `secp224r1` (aka p224), `prime256v1` (aka p256, secp256r1), `prime192v1` (aka p192, secp192r1), `secp384r1` (aka p384), `secp521r1` (aka p521) curves all work in both this library and node (though only the highlighted name will work in node).