diff --git a/.gitignore b/.gitignore index 6dd12606baa2fd31f558354b9063d39f2ed1e903..f06b49a0e10c9eacff6fce8f7b95d7c1178fd8cd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,6 @@ node_modules/ npm-debug.log bin/jpgp*.jar .idea/ -naclb/build -naclb/node_modules gui/nw # Vim swap files diff --git a/.npmignore b/.npmignore index 05cac4f53afce72d178648595fa97793dd919270..58a82be1f7e211e5fc76b7030c0412982e08c05e 100644 --- a/.npmignore +++ b/.npmignore @@ -4,8 +4,6 @@ node_modules/ npm-debug.log bin/jpgp*.jar .idea/ -naclb/build -naclb/node_modules gui/nw # Vim swap files diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d5dcb627e1cca09682d68ff5c341dbd88fc891e..a5f419dde5966d56299ffbc792c1f75fa8b76818 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,15 @@ +# CHANGELOG + ## v1.8.0 (XX XXXX 2019) ### Highlights + - Migration to Nodejs v10 ### Code + +- [enh] migrate `naclb` to rust implementation `dup-crypto-rs` +- [enh] migrate `wotb` to rust implementation `dubp-wot` - #1373: Support for Nodejs v10 - #1372: `scryptb` removal - [enh] Upgrade TypeScript to 3.4.3 @@ -13,14 +19,17 @@ - [enh] StatsDAL => replaced by LevelDB indexes ### BMA + - [enh] Document `network/ws2p/heads` - [fix] In case of wrong network configuration, Duniter could crash on startup - [fix] `/branches` should not throw if current block does not exist ### CI + +- Add dockerisation in Duniter CI - Add g1 and gt control hash has changed to add `replayable_on` -Thanks @c-geek, @Moul, @vtexier +Thanks @c-geek, @librelois, @Moul, @vtexier ## v1.7.21: (12th Fev 2020) - #1394: Former member back in the WoT with only 4 certifiers diff --git a/README.md b/README.md index 0a5c460c976f0d51f975d80dfbaaeba62785f99a..410936dd8918f4495b47aabb55bf278337af30d4 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ If you wish to participate/debate on Duniter, you can: Duniter is using modules on different git repositories: -- [WotB](https://git.duniter.org/libs/dubp-wot): compute Web of Trust. +- [Duniteroxyde](https://git.duniter.org/nodes/typescript/duniteroxyde): Neon binding for rust DUBP libs. - [Debug](https://github.com/duniter/duniter-debug): debug tool. - [Web admin](https://git.duniter.org/nodes/typescript/modules/duniter-ui): web administration interface (optional). - [GVA](https://git.duniter.org/nodes/typescript/modules/gva-api): Future client API aimed to replace BMA. GVA stands for GraphQL Validation API. diff --git a/app/lib/blockchain/DuniterBlockchain.ts b/app/lib/blockchain/DuniterBlockchain.ts index 6e8955c17438d3f67e698c91b82bd272284b9dff..cb036850ebfe0859f4c86cdf28340b4635d3c33f 100644 --- a/app/lib/blockchain/DuniterBlockchain.ts +++ b/app/lib/blockchain/DuniterBlockchain.ts @@ -38,7 +38,7 @@ import {DBTx} from "../db/DBTx" import {Underscore} from "../common-libs/underscore" import {OtherConstants} from "../other_constants" import {MonitorExecutionTime} from "../debug/MonitorExecutionTime" -import {Wot} from "dubp-wot-rs" +import {Wot} from "duniteroxyde" import { Directory } from "../system/directory" export class DuniterBlockchain { diff --git a/app/lib/common-libs/constants.ts b/app/lib/common-libs/constants.ts index c91a38579e0bc7b95ef7cf36056baceffc05c4ca..760d8969cd14914f852aa8e18197cca15e29b916 100755 --- a/app/lib/common-libs/constants.ts +++ b/app/lib/common-libs/constants.ts @@ -13,6 +13,8 @@ "use strict"; +const G1 = "g1" +const GT = "g1-test" const CURRENCY = "[a-zA-Z0-9-_ ]{2,50}" const BASE58 = "[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+" const PUBKEY = "[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{43,44}" @@ -86,6 +88,9 @@ export const duniterDocument2str = (type:DuniterDocument) => { export const CommonConstants = { + G1, + GT, + FORMATS: { CURRENCY, PUBKEY, diff --git a/app/lib/common-libs/crypto/base58.ts b/app/lib/common-libs/crypto/base58.ts deleted file mode 100644 index af39dd46bbb14e9560b781d3a4ce197c20516bbd..0000000000000000000000000000000000000000 --- a/app/lib/common-libs/crypto/base58.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Source file from duniter: Crypto-currency software to manage libre currency such as Ğ1 -// Copyright (C) 2018 Cedric Moreau <cem.moreau@gmail.com> -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -const bs58 = require('bs58') - -export const Base58encode = (bytes: Buffer) => bs58.encode(bytes) - -export const Base58decode = (data:any) => new Uint8Array(bs58.decode(data)) diff --git a/app/lib/common-libs/crypto/keyring.ts b/app/lib/common-libs/crypto/keyring.ts index a20eb7a41a9e6c6d986e55acfe97d918ec8b5924..a6b045d49e3b6b8b05d2e094d1d80db49e76b2d1 100644 --- a/app/lib/common-libs/crypto/keyring.ts +++ b/app/lib/common-libs/crypto/keyring.ts @@ -11,14 +11,7 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. -import {Base58decode, Base58encode} from "./base58" -import {decodeBase64, decodeUTF8, encodeBase64} from "./nacl-util" - -const nacl = require('tweetnacl'); -const seedrandom = require('seedrandom'); -const naclBinding = require('naclb'); - -const crypto_sign_BYTES = 64; +import {KeyPairBuilder, generateRandomSeed, seedToSecretKey} from "duniteroxyde" export class Key { @@ -39,10 +32,6 @@ export class Key { return this.sec } - private rawSec() { - return Base58decode(this.secretKey) - } - json() { return { pub: this.publicKey, @@ -50,78 +39,22 @@ export class Key { } } - signBuggy(msg:string) { - return Promise.resolve(this.signSyncBuggy(msg)) - } - - signSyncBuggy(msg:string) { - const m = decodeUTF8(msg); - const signedMsg = naclBinding.sign(m, this.rawSec()); - const sig = new Uint8Array(crypto_sign_BYTES); - for (let i = 0; i < sig.length; i++) { - sig[i] = signedMsg[i]; - } - return encodeBase64(sig) - }; - sign(msg:string) { return Promise.resolve(this.signSync(msg)) } signSync(msg:string) { - const m = decodeUTF8(msg); - const signedMsg = nacl.sign(m, this.rawSec()); - const sig = new Uint8Array(crypto_sign_BYTES); - for (let i = 0; i < sig.length; i++) { - sig[i] = signedMsg[i]; - } - return encodeBase64(sig) + const signator = KeyPairBuilder.fromSecretKey(this.secretKey); + return signator.sign(msg); }; } export function randomKey() { - const byteseed = new Uint8Array(32) - for (let i = 0; i < 32; i++) { - byteseed[i] = Math.floor(seedrandom()() * 255) + 1 - } - const keypair = nacl.sign.keyPair.fromSeed(byteseed) + const seed = generateRandomSeed(); + const secretKey = seedToSecretKey(seed); + const keypair = KeyPairBuilder.fromSecretKey(secretKey); return new Key( - Base58encode(new Buffer(keypair.publicKey)), - Base58encode(new Buffer(keypair.secretKey)) + keypair.getPublicKey(), + secretKey, ) } - -export function KeyGen(pub:string, sec:string) { - return new Key(pub, sec) -} - -/** - * Verify a signature against data & public key. - * Return true of false as callback argument. - */ -export function verifyBuggy(rawMsg:string, rawSig:string, rawPub:string) { - const msg = decodeUTF8(rawMsg); - const sig = decodeBase64(rawSig); - const pub = Base58decode(rawPub); - const m = new Uint8Array(crypto_sign_BYTES + msg.length); - const sm = new Uint8Array(crypto_sign_BYTES + msg.length); - let i; - for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i]; - for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i]; - - // Call to verification lib... - return naclBinding.verify(m, sm, pub); -} - -/** - * Verify a signature against data & public key. - * Return true of false as callback argument. - */ -export function verify(rawMsg:string, rawSig:string, rawPub:string) { - const msg = decodeUTF8(rawMsg); - const sig = decodeBase64(rawSig); - const pub = Base58decode(rawPub); - - // Call to verification lib... - return nacl.sign.detached.verify(msg, sig, pub); -} diff --git a/app/lib/common-libs/crypto/nacl-util.ts b/app/lib/common-libs/crypto/nacl-util.ts deleted file mode 100644 index b381860b101da1b28c527eeab18071088ee83d04..0000000000000000000000000000000000000000 --- a/app/lib/common-libs/crypto/nacl-util.ts +++ /dev/null @@ -1,47 +0,0 @@ -// Source file from duniter: Crypto-currency software to manage libre currency such as Ğ1 -// Copyright (C) 2018 Cedric Moreau <cem.moreau@gmail.com> -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -declare function escape(s:string): string; -declare function unescape(s:string): string; - -export const decodeUTF8 = function(s:string) { - let i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length); - for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i); - return b; -} - -export const encodeUTF8 = function(arr:any[]) { - let i, s = []; - for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i])); - return decodeURIComponent(escape(s.join(''))) -} - -export const encodeBase64 = function(arr:Uint8Array) { - if (typeof btoa === 'undefined' || !window) { - return (new Buffer(arr)).toString('base64'); - } else { - let i, s = [], len = arr.length; - for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i])); - return btoa(s.join('')); - } -} - -export const decodeBase64 = function(s:string) { - if (typeof atob === 'undefined' || !window) { - return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0)); - } else { - let i, d = atob(s), b = new Uint8Array(d.length); - for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i); - return b; - } -} \ No newline at end of file diff --git a/app/lib/common-libs/index.ts b/app/lib/common-libs/index.ts index 856bc80fb7eeb58b8e66ebd4ddbd66ebc4b9c7d3..ea6df33cb39e30b0d8206d7b242e4661172131fa 100644 --- a/app/lib/common-libs/index.ts +++ b/app/lib/common-libs/index.ts @@ -12,18 +12,11 @@ // GNU Affero General Public License for more details. import * as rawer from './rawer' -import {Base58decode, Base58encode} from "./crypto/base58" import {unlock as txunlock} from "./txunlock" import {hashf} from "../common"; -const base58 = { - decode: Base58decode, - encode: Base58encode -} - export { rawer, - base58, txunlock, hashf } diff --git a/app/lib/common.ts b/app/lib/common.ts index aecb52f0e30b113c2f1038a2fac2d68206e1a72a..8501d067a94403799229ec5f08cd397de5e7a705 100644 --- a/app/lib/common.ts +++ b/app/lib/common.ts @@ -11,12 +11,8 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. -import * as crypto from 'crypto' +import {sha256} from 'duniteroxyde' -export const hashf = function hashf(str:string) { - return crypto - .createHash("sha256") - .update(str) - .digest("hex") - .toUpperCase() +export const hashf = function hashf(str:string) { + return sha256(str) } diff --git a/app/lib/dal/fileDAL.ts b/app/lib/dal/fileDAL.ts index ef4a60730f3f39ec84f3120c9623e08aeef39298..8827044ed24718a27fdc94be2d949ee9e7a4a036 100644 --- a/app/lib/dal/fileDAL.ts +++ b/app/lib/dal/fileDAL.ts @@ -43,7 +43,7 @@ import {MetaDAL} from "./sqliteDAL/MetaDAL" import {DataErrors} from "../common-libs/errors" import {BasicRevocableIdentity, IdentityDTO} from "../dto/IdentityDTO" import {FileSystem} from "../system/directory" -import {Wot} from "dubp-wot-rs" +import {Wot} from "duniteroxyde" import {IIndexDAO} from "./indexDAL/abstract/IIndexDAO" import {BIndexDAO} from "./indexDAL/abstract/BIndexDAO" import {MIndexDAO} from "./indexDAL/abstract/MIndexDAO" diff --git a/app/lib/dto/TransactionDTO.ts b/app/lib/dto/TransactionDTO.ts index 64fcd3ed96a1324db9ad7dff5c014e5d80f58332..45e6b3749e5ffdf9c35e7e3236fc8dd6cae37af2 100644 --- a/app/lib/dto/TransactionDTO.ts +++ b/app/lib/dto/TransactionDTO.ts @@ -13,7 +13,7 @@ import {hashf} from "../common" import {Cloneable} from "./Cloneable" -import {verify, verifyBuggy} from "../common-libs/crypto/keyring" +import {verify} from "duniteroxyde" export interface BaseDTO { base: number @@ -248,7 +248,8 @@ export class TransactionDTO implements Cloneable { if (dubp_version >= 12) { sigResult.sigs[i].ok = verify(raw, sig, pub) } else { - sigResult.sigs[i].ok = verifyBuggy(raw, sig, pub) + // TODO ESZ list all invalid transactions + sigResult.sigs[i].ok = verify(raw, sig, pub) } matching = sigResult.sigs[i].ok i++ diff --git a/app/lib/indexer.ts b/app/lib/indexer.ts index e27a8a66a9c13ae4a0b626bce7408a378e5e6482..ac397110faff7e0c41d57c1fa5817c9e9010351f 100644 --- a/app/lib/indexer.ts +++ b/app/lib/indexer.ts @@ -18,7 +18,7 @@ import {RevocationDTO} from "./dto/RevocationDTO" import {CertificationDTO} from "./dto/CertificationDTO" import {TransactionDTO} from "./dto/TransactionDTO" import {DBHead} from "./db/DBHead" -import {verifyBuggy} from "./common-libs/crypto/keyring" +import {verify} from "duniteroxyde" import {rawer, txunlock} from "./common-libs/index" import {CommonConstants} from "./common-libs/constants" import {MembershipDTO} from "./dto/MembershipDTO" @@ -31,7 +31,7 @@ import {Underscore} from "./common-libs/underscore" import {DataErrors} from "./common-libs/errors" import {MonitorExecutionTime} from "./debug/MonitorExecutionTime" import {NewLogger} from "./logger" -import { wotMemCopy } from "dubp-wot-rs" +import { WotBuilder } from "duniteroxyde" const constants = CommonConstants @@ -2021,7 +2021,7 @@ export function reduceBy<T extends IndexEntry>(reducables: T[], properties: (key } async function checkPeopleAreNotOudistanced (pubkeys: string[], newLinks: { [k:string]: string[] }, newcomers: string[], conf: ConfDTO, dal:FileDAL) { - let wotb = wotMemCopy(dal.wotb); + let wotb = WotBuilder.fromWot(dal.wotb); let current = await dal.getCurrentBlockOrNull(); let membersCount = current ? current.membersCount : 0; // We add temporarily the newcomers to the WoT, to integrate their new links @@ -2086,7 +2086,7 @@ async function sigCheckRevoke(entry: MindexEntry, dal: FileDAL, currency: string sig: idty.sig, revocation: '' }); - let sigOK = verifyBuggy(rawRevocation, sig, pubkey); + let sigOK = verify(rawRevocation, sig, pubkey); if (!sigOK) { throw Error("Revocation signature must match"); } @@ -2141,7 +2141,7 @@ async function checkCertificationIsValid (block: BlockDTO, cert: CindexEntry, fi buid: buid, sig: '' }) - const verified = verifyBuggy(raw, cert.sig, cert.issuer); + const verified = verify(raw, cert.sig, cert.issuer); if (!verified) { throw constants.ERRORS.WRONG_SIGNATURE_FOR_CERT } diff --git a/app/lib/rules/global_rules.ts b/app/lib/rules/global_rules.ts index 21779706ac242ef610004fd1b321625be956fe19..3004a16494dd7243f101ea7363c222997ad7687c 100644 --- a/app/lib/rules/global_rules.ts +++ b/app/lib/rules/global_rules.ts @@ -16,7 +16,7 @@ import {FileDAL} from "../dal/fileDAL" import {DBBlock} from "../db/DBBlock" import {TransactionDTO, TxSignatureResult} from "../dto/TransactionDTO" import {BlockDTO} from "../dto/BlockDTO" -import {verifyBuggy} from "../common-libs/crypto/keyring" +import {verify} from "duniteroxyde" import {rawer, txunlock} from "../common-libs/index" import {CommonConstants} from "../common-libs/constants" import {IdentityDTO} from "../dto/IdentityDTO" @@ -322,7 +322,7 @@ async function checkCertificationShouldBeValid (block:{ number:number, currency: buid: buid, sig: '' }) - const verified = verifyBuggy(raw, cert.sig, cert.from); + const verified = verify(raw, cert.sig, cert.from); if (!verified) { throw constants.ERRORS.WRONG_SIGNATURE_FOR_CERT } diff --git a/app/lib/rules/local_rules.ts b/app/lib/rules/local_rules.ts index ad297305314e69a7c8d09ad1f3f3d913e5d67eaf..933e6b394c4b0fdd7aec3a8f7415e6ca21c82557 100644 --- a/app/lib/rules/local_rules.ts +++ b/app/lib/rules/local_rules.ts @@ -16,7 +16,7 @@ import {ConfDTO} from "../dto/ConfDTO" import {CindexEntry, IndexEntry, Indexer, MindexEntry, SindexEntry} from "../indexer" import {BaseDTO, TransactionDTO} from "../dto/TransactionDTO" import {DBBlock} from "../db/DBBlock" -import {verify, verifyBuggy} from "../common-libs/crypto/keyring" +import {verify} from "duniteroxyde" import {hashf} from "../common" import {CommonConstants} from "../common-libs/constants" import {IdentityDTO} from "../dto/IdentityDTO" @@ -27,6 +27,10 @@ import {FileDAL} from "../dal/fileDAL" const constants = CommonConstants const maxAcceleration = require('./helpers').maxAcceleration +const INVALID_G1_BLOCKS = new Set([15144, 31202, 85448, 87566, 90830, 109327, 189835, 199172, 221274, 253582]); +const INVALID_GT_BLOCKS = new Set([24316, 62067, 62551, 93288, 173118, 183706, 196196, 246027, 247211, 263207, + 307038, 328741, 335914, 377316, 395714, 396024, 407913, 422366, 496751]); + export const LOCAL_RULES_FUNCTIONS = { checkParameters: async (block:BlockDTO) => { @@ -88,12 +92,28 @@ export const LOCAL_RULES_FUNCTIONS = { checkBlockSignature: async (block:BlockDTO) => { // Historically, Duniter used a buggy version of TweetNaCl (see #1390) - // Starting with the v12 blocks, Duniter uses a fixed version of TweetNaCl. - if (block.version >= 12 && !verify(block.getSignedPart(), block.signature, block.issuer)) { - throw Error('Block\'s signature must match'); - } else if (!verifyBuggy(block.getSignedPart(), block.signature, block.issuer)) { - throw Error('Block\'s signature must match'); + // Starting with the v12 blocks, Duniter uses a fixed version of TweetNaCl. + if (!verify(block.getSignedPart(), block.signature, block.issuer)) { + if (block.version >= 12) { + throw Error('Block\'s signature must match'); + } + // If DUBP < v12, block may have invalid signature + else if (block.currency === constants.G1) { + if (!INVALID_G1_BLOCKS.has(block.number)) { + throw Error('Block\'s signature must match'); + } + } + else if (block.currency === constants.GT) { + if (!INVALID_GT_BLOCKS.has(block.number)) { + throw Error('Block\'s signature must match'); + } + } + // Unknown currencies must have valid signature + else { + throw Error('Block\'s signature must match'); + } } + return true; }, @@ -113,7 +133,7 @@ export const LOCAL_RULES_FUNCTIONS = { while (!wrongSig && i < block.identities.length) { const idty = IdentityDTO.fromInline(block.identities[i]); idty.currency = block.currency; - wrongSig = !verifyBuggy(idty.rawWithoutSig(), idty.sig, idty.pubkey); + wrongSig = !verify(idty.rawWithoutSig(), idty.sig, idty.pubkey); if (wrongSig) { throw Error('Identity\'s signature must match'); } @@ -444,7 +464,7 @@ function getTransactionDepth(txHash:string, sindex:SindexShortEntry[], localDept } function checkSingleMembershipSignature(ms:any) { - return verifyBuggy(ms.getRaw(), ms.signature, ms.issuer); + return verify(ms.getRaw(), ms.signature, ms.issuer); } function checkBunchOfTransactions(transactions:TransactionDTO[], conf:ConfDTO, medianTime: number, options?:{ dontCareAboutChaining?:boolean }){ diff --git a/app/lib/system/directory.ts b/app/lib/system/directory.ts index 0571c860225826299f775245c8b6adbb259e672e..742055668bd5131a668185b056fa90d4503b0d46 100644 --- a/app/lib/system/directory.ts +++ b/app/lib/system/directory.ts @@ -15,7 +15,7 @@ import * as path from "path" import * as fs from 'fs' import {SQLiteDriver} from "../dal/drivers/SQLiteDriver" import {CFSCore} from "../dal/fileDALs/CFSCore" -import {Wot} from "dubp-wot-rs" +import {Wot, WotBuilder} from "duniteroxyde" import {FileDALParams} from "../dal/fileDAL" import {cliprogram} from "../common-libs/programOptions" import {LevelDBDriver} from "../dal/drivers/LevelDBDriver" @@ -211,7 +211,7 @@ export const Directory = { const sqlitePath = path.join(home, Directory.DUNITER_DB_NAME + '.db'); dbf = () => new SQLiteDriver(sqlitePath); let wotbFilePath = await Directory.getWotbFilePath(home); - wotbf = () => new Wot(wotbFilePath) + wotbf = () => WotBuilder.fromFile(wotbFilePath) } return { home: params.home, diff --git a/app/modules/crawler/lib/req2fwd.ts b/app/modules/crawler/lib/req2fwd.ts index 113b1e38c0004d3c84b2ce355d15a73793fc9ace..8e7519030871b9b9912b597f959c15df65e9d971 100644 --- a/app/modules/crawler/lib/req2fwd.ts +++ b/app/modules/crawler/lib/req2fwd.ts @@ -12,7 +12,7 @@ // GNU Affero General Public License for more details. import {Contacter} from "./contacter" -import {verifyBuggy} from "../../../lib/common-libs/crypto/keyring" +import {verify} from "duniteroxyde" import {rawer} from "../../../lib/common-libs/index" import {HttpRequirements} from "../../bma/lib/dtos" @@ -80,7 +80,7 @@ export const req2fwd = async (requirements: HttpRequirements, toHost:string, toP buid: received.blockstamp }); try { - const chkSig = verifyBuggy(rawCertNoSig, received.sig, received.from) + const chkSig = verify(rawCertNoSig, received.sig, received.from) if (!chkSig) { throw "Wrong signature for certification?!" } diff --git a/app/modules/crawler/lib/sync/RemoteSynchronizer.ts b/app/modules/crawler/lib/sync/RemoteSynchronizer.ts index b430582cb3884ca3f52ae373b5e42a6fde436481..b6307ee0d717128db405c984d1c459744161ded9 100644 --- a/app/modules/crawler/lib/sync/RemoteSynchronizer.ts +++ b/app/modules/crawler/lib/sync/RemoteSynchronizer.ts @@ -35,7 +35,7 @@ import {WS2PRequester} from "../../../ws2p/lib/WS2PRequester" import {WS2PMessageHandler} from "../../../ws2p/lib/impl/WS2PMessageHandler" import {WS2PResponse} from "../../../ws2p/lib/impl/WS2PResponse" import {DataErrors} from "../../../../lib/common-libs/errors" -import {KeyGen} from "../../../../lib/common-libs/crypto/keyring" +import {Key} from "../../../../lib/common-libs/crypto/keyring" import {WS2PRemoteContacter} from "./WS2PRemoteContacter" import {Keypair} from "../../../../lib/dto/ConfDTO" @@ -141,7 +141,7 @@ export class RemoteSynchronizer extends AbstractSynchronizer { // If BMA is unreachable and the connection is not marked as strict BMA, let's try WS2P if (!api && access.isBMA !== true) { - const pair = KeyGen(keypair.pub, keypair.sec) + const pair = new Key(keypair.pub, keypair.sec) const connection = WS2PConnection.newConnectionToAddress(1, `ws://${host}:${port}${path && ' ' + path || ''}`, new (class SyncMessageHandler implements WS2PMessageHandler { diff --git a/app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts b/app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts index a1b73922d5c1e6482327d6051e1bdfd9b1bb6b0c..c2bb86ff22f19806b71d15a9305411633a514288 100644 --- a/app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts +++ b/app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts @@ -15,7 +15,7 @@ import {DuniterBlockchain, requiredBindexSizeForTail} from "../../../../../lib/b import {BlockDTO} from "../../../../../lib/dto/BlockDTO" import {Underscore} from "../../../../../lib/common-libs/underscore" import {MonitorExecutionTime} from "../../../../../lib/debug/MonitorExecutionTime" -import {Wot} from "dubp-wot-rs" +import {Wot} from "duniteroxyde" import {NewLogger} from "../../../../../lib/logger" import {CommonConstants} from "../../../../../lib/common-libs/constants" import {DBBlock} from "../../../../../lib/db/DBBlock" diff --git a/app/modules/keypair/lib/scrypt.ts b/app/modules/keypair/lib/scrypt.ts index 057b1a30d4cf2fdf25fa5e1f2b856cf963390c5b..0a348ad01a3d1d48f1d8baca568d30f9d5693f25 100644 --- a/app/modules/keypair/lib/scrypt.ts +++ b/app/modules/keypair/lib/scrypt.ts @@ -11,11 +11,8 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. -import {Base58encode} from "../../../lib/common-libs/crypto/base58" -import {decodeBase64} from "../../../lib/common-libs/crypto/nacl-util" import * as crypto from 'crypto' - -const nacl = require('tweetnacl'); +import { KeyPairBuilder, seedToSecretKey } from 'duniteroxyde' const SEED_LENGTH = 32; // Length of the key @@ -29,20 +26,16 @@ const SEED_LENGTH = 32; // Length of the key * @return keyPair An object containing the public and private keys, base58 encoded. */ export const Scrypt = async (salt:string, key:string, N = 4096, r = 16, p = 1) => { - const keyBytes = await getScryptKey(key, salt, N, r, p) - const pair = nacl.sign.keyPair.fromSeed(keyBytes); - return { - pub: Base58encode(new Buffer(pair.publicKey, 'hex')), - sec: Base58encode(new Buffer(pair.secretKey, 'hex')) - }; -} - -const getScryptKey = async (key:string, salt:string, N:number, r:number, p:number) => { - const res:any = await new Promise((resolve, reject) => { - crypto.scrypt(key, salt, SEED_LENGTH, { N, r, p }, (err:any, res:Buffer) => { + const res: { pub: string, sec: string } = await new Promise((resolve, reject) => { + crypto.scrypt(key, salt, SEED_LENGTH, { N, r, p }, (err:any, seed:Buffer) => { if (err) return reject(err) - resolve(res) + const pair = KeyPairBuilder.fromSeed(seed); + resolve({ + pub: pair.getPublicKey(), + sec: seedToSecretKey(seed) + }) }) }) - return decodeBase64(res.toString("base64")) + + return res; } diff --git a/app/modules/prover/lib/blockGenerator.ts b/app/modules/prover/lib/blockGenerator.ts index 45529c4106eb3dad6fdf60aed8aa4e79e4833f12..92dbd81e321ced5b8bebb3cb93e2264dc70bd1c5 100644 --- a/app/modules/prover/lib/blockGenerator.ts +++ b/app/modules/prover/lib/blockGenerator.ts @@ -19,7 +19,7 @@ import {GLOBAL_RULES_HELPERS} from "../../../lib/rules/global_rules" import {LOCAL_RULES_HELPERS} from "../../../lib/rules/local_rules" import {Indexer} from "../../../lib/indexer" import {DBBlock} from "../../../lib/db/DBBlock" -import {verifyBuggy} from "../../../lib/common-libs/crypto/keyring" +import {verify} from "duniteroxyde" import {rawer} from "../../../lib/common-libs/index" import {hashf} from "../../../lib/common" import {CommonConstants} from "../../../lib/common-libs/constants" @@ -380,7 +380,7 @@ export class BlockGenerator { const idty = IdentityDTO.fromJSONObject(identity); idty.currency = this.conf.currency; const createIdentity = idty.rawWithoutSig(); - const verified = verifyBuggy(createIdentity, idty.sig, idty.pubkey); + const verified = verify(createIdentity, idty.sig, idty.pubkey); if (!verified) { throw constants.ERRORS.IDENTITY_WRONGLY_SIGNED; } @@ -761,7 +761,7 @@ class NextBlockGenerator implements BlockGeneratorInterface { idty_sig: targetIdty.sig, buid: current ? [cert.block_number, targetBlock.hash].join('-') : CommonConstants.SPECIAL_BLOCK, }).getRawUnSigned(); - if (verifyBuggy(rawCert, certSig, cert.from)) { + if (verify(rawCert, certSig, cert.from)) { cert.sig = certSig; let exists = false; if (current) { diff --git a/app/modules/prover/lib/proof.ts b/app/modules/prover/lib/proof.ts index 1d723da5f768c7661b09c167407d5904949a0982..f99d53aba5d1a751ff209bca6226bf4b22752fb0 100644 --- a/app/modules/prover/lib/proof.ts +++ b/app/modules/prover/lib/proof.ts @@ -17,7 +17,7 @@ import {hashf} from "../../../lib/common" import {DBBlock} from "../../../lib/db/DBBlock" import {ConfDTO} from "../../../lib/dto/ConfDTO" import {ProverConstants} from "./constants" -import {KeyGen, verify, verifyBuggy} from "../../../lib/common-libs/crypto/keyring" +import {Ed25519Signator, KeyPairBuilder} from "duniteroxyde" import {dos2unix} from "../../../lib/common-libs/dos2unix" import {rawer} from "../../../lib/common-libs/index" import {ProcessCpuProfiler} from "../../../ProcessCpuProfiler" @@ -37,7 +37,6 @@ export function createPowWorker() { let prefix = 0; let sigFuncSaved: (msg:string) => string; - let verifyFuncSaved: (msg:string, sig:string) => boolean; let lastSecret:any, lastVersion: number, currentCPU:number = 1; process.on('uncaughtException', (err:any) => { @@ -119,27 +118,13 @@ export function createPowWorker() { const highMark = stuff.highMark; // Define sigFunc - // Use Buggy version for performance reasons + const signator = KeyPairBuilder.fromSecretKey(pair.sec); let sigFunc = null; if (sigFuncSaved && lastSecret === pair.sec) { sigFunc = sigFuncSaved; } else { lastSecret = pair.sec; - sigFunc = (msg:string) => KeyGen(pair.pub, pair.sec).signSyncBuggy(msg) - } - - // Define verifyFunc - let verifyFunc = null; - if (verifyFuncSaved && lastSecret === pair.sec && lastVersion === block.version) { - verifyFunc = verifyFuncSaved; - } else { - lastSecret = pair.sec; - lastVersion = block.version; - if (block.version >= 12) { - verifyFunc = (msg:string, sig:string) => verify(msg, sig, pair.pub) - } else { - verifyFunc = (msg:string, sig:string) => verifyBuggy(msg, sig, pair.pub) - } + sigFunc = (msg:string) => signator.sign(msg) } /***************** @@ -212,12 +197,6 @@ export function createPowWorker() { } if (charOK) { found = !!(pow[nbZeros].match(new RegExp('[0-' + highMark + ']'))) - if (found) { - let sigOk = verifyFunc(raw, sig); - if (!sigOk) { - found = false; - } - } } if (!found && nbZeros > 0 && j - 1 >= ProverConstants.POW_MINIMAL_TO_SHOW) { pSend({ pow: { pow: pow, block: block, nbZeros: nbZeros }}); diff --git a/app/modules/ws2p/lib/WS2PCluster.ts b/app/modules/ws2p/lib/WS2PCluster.ts index b5eced67809cd26869d0edaccdeb725008fd2ab1..7dad2898b9bb516888386b679e1be5ab56c3c9fa 100644 --- a/app/modules/ws2p/lib/WS2PCluster.ts +++ b/app/modules/ws2p/lib/WS2PCluster.ts @@ -24,7 +24,8 @@ import {WS2PConstants} from "./constants" import {PeerDTO, WS2PEndpoint} from '../../../lib/dto/PeerDTO'; import {GlobalFifoPromise} from "../../../service/GlobalFifoPromise" import {OtherConstants} from "../../../lib/other_constants" -import {Key, verifyBuggy} from "../../../lib/common-libs/crypto/keyring" +import {Key} from "../../../lib/common-libs/crypto/keyring" +import {verify} from "duniteroxyde" import {WS2PServerMessageHandler} from "./interface/WS2PServerMessageHandler" import {WS2PMessageHandler} from "./impl/WS2PMessageHandler" import {CommonConstants} from '../../../lib/common-libs/constants'; @@ -208,8 +209,8 @@ export class WS2PCluster { ) { const head:WS2PHead = { message: h.message, sig: h.sig, messageV2: h.messageV2, sigV2: h.sigV2, step: h.step } - const sigOK = verifyBuggy(head.message, head.sig, pub) - const sigV2OK = (head.messageV2 !== undefined && head.sigV2 !== undefined) ? verifyBuggy(head.messageV2, head.sigV2, pub):false + const sigOK = verify(head.message, head.sig, pub) + const sigV2OK = (head.messageV2 !== undefined && head.sigV2 !== undefined) ? verify(head.messageV2, head.sigV2, pub):false if ((sigV2OK && sigOK) || sigOK) { // Already known or more recent or closer ? const step = (this.headsCache[fullId]) ? this.headsCache[fullId].step || 0:0 @@ -605,9 +606,9 @@ export class WS2PCluster { const prefix = this.server.conf.prefix || ProverConstants.DEFAULT_PEER_ID const { freeMemberRoom , freeMirorRoom } = await this.countFreeRooms() const message = `${api}:HEAD:1:${key.publicKey}:${number}-${hash}:${ws2pId}:${software}:${softVersion}:${prefix}` - const sig = key.signSyncBuggy(message) + const sig = key.signSync(message) const messageV2 = `${api}:HEAD:2:${key.publicKey}:${number}-${hash}:${ws2pId}:${software}:${softVersion}:${prefix}:${freeMemberRoom}:${freeMirorRoom}` - const sigV2 = key.signSyncBuggy(messageV2) + const sigV2 = key.signSync(messageV2) const myHead:WS2PHead = { message, diff --git a/app/modules/ws2p/lib/WS2PConnection.ts b/app/modules/ws2p/lib/WS2PConnection.ts index cde3a4ae6e07c75b53c64ba9daea508fe4ebcb6c..2d124371bb03e71229eb26ff1f1fdb097ac39dfe 100644 --- a/app/modules/ws2p/lib/WS2PConnection.ts +++ b/app/modules/ws2p/lib/WS2PConnection.ts @@ -11,7 +11,8 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. -import {Key, verifyBuggy} from "../../../lib/common-libs/crypto/keyring" +import {Key} from "../../../lib/common-libs/crypto/keyring" +import {verify} from "duniteroxyde" import {WS2PMessageHandler} from "./impl/WS2PMessageHandler" import {BlockDTO} from "../../../lib/dto/BlockDTO" import {IdentityDTO} from "../../../lib/dto/IdentityDTO" @@ -129,7 +130,7 @@ export class WS2PPubkeyRemoteAuth implements WS2PRemoteAuth { async sendACK(ws: any): Promise<void> { const challengeMessage = `WS2P:ACK:${this.currency}:${this.pair.pub}:${this.challenge}` Logger.log('sendACK >>> ' + challengeMessage) - const sig = this.pair.signSyncBuggy(challengeMessage) + const sig = this.pair.signSync(challengeMessage) await ws.send(JSON.stringify({ auth: 'ACK', pub: this.pair.pub, @@ -153,7 +154,7 @@ export class WS2PPubkeyRemoteAuth implements WS2PRemoteAuth { this.givenCurrency.resolve(this.currency) const challengeMessage = (ws2pVersion > 1) ? `WS2P:${type}:${this.currency}:${pub}:${ws2pId}:${challenge}`:`WS2P:${type}:${this.currency}:${pub}:${challenge}` Logger.log('registerCONNECT >>> ' + challengeMessage) - const verified = verifyBuggy(challengeMessage, sig, pub) + const verified = verify(challengeMessage, sig, pub) if (verified) { this.remoteVersion = ws2pVersion this.challenge = challenge @@ -166,7 +167,7 @@ export class WS2PPubkeyRemoteAuth implements WS2PRemoteAuth { async registerOK(sig: string): Promise<boolean> { const challengeMessage = `WS2P:OK:${this.currency}:${this.remotePub}:${this.challenge}` Logger.log('registerOK >>> ' + challengeMessage) - this.authenticatedByRemote = verifyBuggy(challengeMessage, sig, this.remotePub) + this.authenticatedByRemote = verify(challengeMessage, sig, this.remotePub) if (!this.authenticatedByRemote) { this.serverAuthReject("Wrong signature from remote OK") } else { @@ -215,7 +216,7 @@ export class WS2PPubkeyLocalAuth implements WS2PLocalAuth { if (ws2pVersion > 1) { const challengeMessage = `WS2P:${ws2pVersion}:${connectWord}:${this.currency}:${this.pair.pub}:${this.ws2pId}:${this.challenge}` Logger.log('sendCONNECT >>> ' + challengeMessage) - const sig = this.pair.signSyncBuggy(challengeMessage) + const sig = this.pair.signSync(challengeMessage) await ws.send(JSON.stringify({ auth: `${connectWord}`, version: ws2pVersion, @@ -229,7 +230,7 @@ export class WS2PPubkeyLocalAuth implements WS2PLocalAuth { } else if (ws2pVersion == 1) { const challengeMessage = `WS2P:${connectWord}:${this.currency}:${this.pair.pub}:${this.challenge}` Logger.log('sendCONNECT >>> ' + challengeMessage) - const sig = this.pair.signSyncBuggy(challengeMessage) + const sig = this.pair.signSync(challengeMessage) await ws.send(JSON.stringify({ auth: `${connectWord}`, pub: this.pair.pub, @@ -248,7 +249,7 @@ export class WS2PPubkeyLocalAuth implements WS2PLocalAuth { } const challengeMessage = `WS2P:ACK:${this.currency}:${pub}:${this.challenge}` Logger.log('registerACK >>> ' + challengeMessage) - this.authenticated = verifyBuggy(challengeMessage, sig, pub) + this.authenticated = verify(challengeMessage, sig, pub) if (!this.authenticated) { this.serverAuthReject("Wrong signature from server ACK") } else { @@ -260,7 +261,7 @@ export class WS2PPubkeyLocalAuth implements WS2PLocalAuth { async sendOK(ws:any): Promise<void> { const challengeMessage = `WS2P:OK:${this.currency}:${this.pair.pub}:${this.challenge}` Logger.log('sendOK >>> ' + challengeMessage) - const sig = this.pair.signSyncBuggy(challengeMessage) + const sig = this.pair.signSync(challengeMessage) await ws.send(JSON.stringify({ auth: 'OK', sig diff --git a/app/service/IdentityService.ts b/app/service/IdentityService.ts index 7f16a34fcd6913d82d95751dda4f81a1e56a4545..de99c94c3c1bdc4cb5f64b8e126c03e74ea37d84 100644 --- a/app/service/IdentityService.ts +++ b/app/service/IdentityService.ts @@ -21,7 +21,7 @@ import {RevocationDTO} from "../lib/dto/RevocationDTO" import {BasicIdentity, IdentityDTO} from "../lib/dto/IdentityDTO" import {CertificationDTO} from "../lib/dto/CertificationDTO" import {DBCert} from "../lib/dal/sqliteDAL/CertDAL" -import {verifyBuggy} from "../lib/common-libs/crypto/keyring" +import {verify} from "duniteroxyde" import {FIFOService} from "./FIFOService" import {MindexEntry} from "../lib/indexer" import {DataErrors} from "../lib/common-libs/errors" @@ -121,7 +121,7 @@ export class IdentityService extends FIFOService { this.logger.info('⬇ IDTY %s %s', idty.pubkey, idty.uid); try { // Check signature's validity - let verified = verifyBuggy(createIdentity, idty.sig, idty.pubkey); + let verified = verify(createIdentity, idty.sig, idty.pubkey); if (!verified) { throw constants.ERRORS.SIGNATURE_DOES_NOT_MATCH; } @@ -271,7 +271,7 @@ export class IdentityService extends FIFOService { return this.pushFIFO<RevocationDTO>(hash, async () => { try { this.logger.info('⬇ REVOCATION %s %s', revoc.pubkey, revoc.idty_uid); - let verified = verifyBuggy(raw, revoc.revocation, revoc.pubkey); + let verified = verify(raw, revoc.revocation, revoc.pubkey); if (!verified) { throw 'Wrong signature for revocation'; } diff --git a/app/service/PeeringService.ts b/app/service/PeeringService.ts index ef5972183524a127cf935730fe787d92399d8687..67ed60c6ffc7088d74cc8453bd25f387f5627644 100755 --- a/app/service/PeeringService.ts +++ b/app/service/PeeringService.ts @@ -16,7 +16,7 @@ import {FileDAL} from "../lib/dal/fileDAL" import {DBBlock} from "../lib/db/DBBlock" import {Multicaster} from "../lib/streams/multicaster" import {PeerDTO} from "../lib/dto/PeerDTO" -import {verifyBuggy} from "../lib/common-libs/crypto/keyring" +import {verify} from "duniteroxyde" import {dos2unix} from "../lib/common-libs/dos2unix" import {rawer} from "../lib/common-libs/index" import {Server} from "../../server" @@ -82,7 +82,7 @@ export class PeeringService { const raw = rawer.getPeerWithoutSignature(p); const sig = p.signature; const pub = p.pubkey; - const signaturesMatching = verifyBuggy(raw, sig, pub); + const signaturesMatching = verify(raw, sig, pub); return !!signaturesMatching; }; diff --git a/package.json b/package.json index 3421b79cef855b44234d034afde7d9f7d2537d5c..78f4a05430ce5d5f97d8e33449880b2955230354 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,6 @@ "async": "2.2.0", "bindings": "1.2.1", "body-parser": "1.17.1", - "bs58": "^4.0.1", "child-process-promise": "^2.2.1", "cli-table": "^0.3.1", "colors": "1.1.2", @@ -71,7 +70,7 @@ "cors": "2.8.2", "daemonize2": "0.4.2", "ddos": "0.1.16", - "dubp-wot-rs": "0.7.0", + "duniteroxyde": "0.2.3", "errorhandler": "1.5.0", "event-stream": "3.3.4", "express": "4.15.2", @@ -86,7 +85,6 @@ "moment": "2.19.3", "morgan": "1.9.1", "multimeter": "0.1.1", - "naclb": "1.3.11", "nat-upnp": "^1.1.1", "node-pre-gyp": "0.6.34", "node-uuid": "1.4.8", @@ -95,12 +93,10 @@ "querablep": "^0.1.0", "request": "2.81.0", "request-promise": "4.2.0", - "seedrandom": "3.0.1", "sha1": "1.1.1", "socks-proxy-agent": "4.0.2", "sqlite3": "4.0.6", "tail": "^2.0.2", - "tweetnacl": "^1.0.1", "typedoc": "^0.11.1", "underscore": "1.8.3", "unzip": "0.1.11", diff --git a/release/arch/arm/build-arm.sh b/release/arch/arm/build-arm.sh index 2fd49096761723613e407a2454ffe23388f6a541..31df3047e249f95de65cae00ec006ce0f81723f1 100755 --- a/release/arch/arm/build-arm.sh +++ b/release/arch/arm/build-arm.sh @@ -77,10 +77,12 @@ echo $SRC # Clean unused UI modules rm -Rf node_modules/duniter-ui/node_modules -# Because we are building in a VM, Node.js could not detect that the target is ARM. So we move the modules' binaries accordingly. -#mv node_modules/naclb/lib/binding/Release/node-v48-linux-x64 node_modules/naclb/lib/binding/Release/node-v48-linux-arm -#mv node_modules/wotb/lib/binding/Release/node-v48-linux-x64 node_modules/wotb/lib/binding/Release/node-v48-linux-arm -#mv node_modules/sqlite3/lib/binding/Release/node-v48-linux-x64 node_modules/sqlite3/lib/binding/Release/node-v48-linux-arm +# Remove non production folders +rm -rf coverage test + +# Remove unused duniteroxyde intermediate binaries +rm -rf node_modules/duniteroxyde/target +rm -rf node_modules/duniteroxyde/native/target cd .. mkdir -p duniter_release diff --git a/release/arch/linux/build-lin.sh b/release/arch/linux/build-lin.sh index 84ef27abd0eb4773936e62c54ab46d80fce94648..1c509b53b18bfa5ad277fd86baac4330251a83a5 100644 --- a/release/arch/linux/build-lin.sh +++ b/release/arch/linux/build-lin.sh @@ -187,7 +187,13 @@ yarn --production || exit 1 # Patch leveldown cp "${ROOT}/release/resources/leveldown-fix.json" "${RELEASES}/duniter/node_modules/leveldown/package.json" || exit 1 -rm -rf release coverage # Non production folders +# Remove non production folders +rm -rf coverage release test + +# Remove unused duniteroxyde intermediate binaries +rm -rf node_modules/duniteroxyde/target +rm -rf node_modules/duniteroxyde/native/target + cp -r "${RELEASES}/duniter" "${RELEASES}/desktop_" || exit 1 cp -r "${RELEASES}/duniter" "${RELEASES}/server_" || exit 1 @@ -198,7 +204,6 @@ cp -r "${RELEASES}/duniter" "${RELEASES}/server_" || exit 1 echo "${NW_RELEASE}" cd "${RELEASES}/desktop_/node_modules/" -nw_compile naclb nw_copy nw_compile leveldown nw_copy "build/Release/" nw_compile sqlite3 nw_copy_node diff --git a/release/arch/windows/build.bat b/release/arch/windows/build.bat index d523fc9596d65ade4879194925ca2bee3b25bab8..89b38404b40b74fef0e19a3d7db66274dac227c1 100644 --- a/release/arch/windows/build.bat +++ b/release/arch/windows/build.bat @@ -77,21 +77,7 @@ REM call ./node_modules/.bin/install-self-peers --npm -- --production set SRC=%cd% echo %SRC% -cd node_modules/wotb -call npm install --build-from-source - -REM PREPARE common.gypi -call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 configure - -call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 configure -call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 build -copy %cd%\lib\binding\Release\node-webkit-%NW_RELEASE%-win32-x64\wotb.node %cd%\lib\binding\Release\node-v%ADDON_VERSION%-win32-x64\wotb.node /Y -cd ../naclb -call npm install --build-from-source -call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 configure -call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 build -copy %cd%\lib\binding\Release\node-webkit-%NW_RELEASE%-win32-x64\naclb.node %cd%\lib\binding\Release\node-v%ADDON_VERSION%-win32-x64\naclb.node /Y -cd ../leveldown +cd node_modules/leveldown call npm install --build-from-source echo "Patch de leveldown..." move package.json package.json.back diff --git a/release/docker/Dockerfile b/release/docker/Dockerfile index 6b0b0607a9466f1e9f472b54973ca9c27f5d1c0e..3b8cd3098a3535fdc95df6cb484c8c0244b27480 100644 --- a/release/docker/Dockerfile +++ b/release/docker/Dockerfile @@ -26,7 +26,10 @@ RUN export PATH="$HOME/.cargo/bin:$PATH" && \ export RUSTFLAGS="-C target-feature=-crt-static" && \ yarn install --production && \ yarn add duniter-ui@${DUNITER_UI_VER} && \ - rm -rf test + mv release/docker/duniter.sh docker.sh && \ + rm -rf coverage release test && \ + rm -rf node_modules/duniteroxyde/target && \ + rm -rf node_modules/duniteroxyde/native/target # ------------------------------------------------------------------------------ # Final Stage @@ -43,7 +46,7 @@ RUN mkdir -p /var/lib/duniter /etc/duniter && chown duniter:duniter /var/lib/dun COPY --from=build --chown=duniter:duniter . /duniter/duniter # copy bootstrap script -RUN cp /duniter/duniter/release/docker/duniter.sh /usr/bin/duniter && \ +RUN cp /duniter/duniter/docker.sh /usr/bin/duniter && \ chmod +x /usr/bin/duniter && \ chown duniter:duniter /usr/bin/duniter diff --git a/server.ts b/server.ts index 91b49cb944eb32ea6b20e3dc75215566239c3525..c84713ecdd7261a2c7254fdd89ab362314a4bd47 100644 --- a/server.ts +++ b/server.ts @@ -19,7 +19,7 @@ import {TransactionService} from "./app/service/TransactionsService" import {ConfDTO} from "./app/lib/dto/ConfDTO" import {FileDAL, FileDALParams} from "./app/lib/dal/fileDAL" import * as stream from "stream" -import {KeyGen, randomKey} from "./app/lib/common-libs/crypto/keyring" +import {Key, randomKey} from "./app/lib/common-libs/crypto/keyring" import {parsers} from "./app/lib/common-libs/parsers/index" import {Cloneable} from "./app/lib/dto/Cloneable" import {CommonConstants, DuniterDocument, duniterDocument2str} from "./app/lib/common-libs/constants" @@ -214,7 +214,7 @@ export class Server extends stream.Duplex implements HookableServer { this.conf.pair = randomKey().json() } // Extract key pair - this.keyPair = KeyGen(this.conf.pair.pub, this.conf.pair.sec); + this.keyPair = new Key(this.conf.pair.pub, this.conf.pair.sec); this.sign = (msg:string) => this.keyPair.sign(msg) // Update services this.IdentityService.setConfDAL(this.conf, this.dal) diff --git a/test/fast/crypto/crypto.ts b/test/fast/crypto/crypto.ts index 5cd873293ca2445beffd03cf02e88dcb8aabf543..a1cf7df733dc4e227c5ea7cd5e05b5510598d05f 100644 --- a/test/fast/crypto/crypto.ts +++ b/test/fast/crypto/crypto.ts @@ -12,51 +12,35 @@ // GNU Affero General Public License for more details. "use strict"; -import {Base58decode, Base58encode} from "../../../app/lib/common-libs/crypto/base58" -import {decodeBase64, encodeBase64} from "../../../app/lib/common-libs/crypto/nacl-util" -import {KeyGen, verify, verifyBuggy} from "../../../app/lib/common-libs/crypto/keyring" +import {Key} from "../../../app/lib/common-libs/crypto/keyring" +import {verify} from "duniteroxyde" const should = require('should'); -const enc = encodeBase64 -const dec = decodeBase64 - -let pub:Uint8Array, sec:Uint8Array, rawPub:string, rawSec:string +let rawPub:string, rawSec:string describe('ed25519 tests:', function(){ before(async () => { // Generate the keypair - const keyPair = KeyGen('HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd', '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'); - pub = Base58decode(keyPair.publicKey); - sec = Base58decode(keyPair.secretKey); - rawPub = Base58encode(new Buffer(pub)); - rawSec = Base58encode(new Buffer(sec)); + const keyPair = new Key('HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd', '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'); + rawPub = keyPair.publicKey; + rawSec = keyPair.secretKey; }) - //it('good signature from existing secret key should be verified', function(done){ - // const keys = nacl.sign.scryptKeyPair.fromSecretKey(dec("TM0Imyj/ltqdtsNG7BFOD1uKMZ81q6Yk2oz27U+4pvs9QBfD6EOJWpK3CqdNG368nJgszy7ElozAzVXxKvRmDA==")); - // const msg = "cg=="; - // const goodSig = dec("52Hh9omo9rxklulAE7gvVeYvAq0GgXYoZE2NB/gzehpCYIT04bMcGIs5bhYLaH93oib34jsVMWs9Udadr1B+AQ=="); - // const sig = crypto.signSync(msg, keys.secretKey); - // sig.should.equal(enc(goodSig)); - // crypto.verify(msg, sig, enc(keys.publicKey)).should.be.true; - // done(); - //}); - it('good signature from generated key should be verified', function(done){ const msg = "Some message to be signed"; - const sig = KeyGen(rawPub, rawSec).signSyncBuggy(msg); - const verified = verifyBuggy(msg, sig, rawPub); - verified.should.equal(true); + const sig = new Key(rawPub, rawSec).signSync(msg); + const verified = verify(msg, sig, rawPub); + should(verified).equal(true); done(); }); it('wrong signature from generated key should NOT be verified', function(done){ const msg = "Some message to be signed"; - const sig = KeyGen(rawPub, rawSec).signSyncBuggy(msg); - const verified = verifyBuggy(msg + 'delta', sig, rawPub); - verified.should.equal(false); + const sig = new Key(rawPub, rawSec).signSync(msg); + const verified = verify(msg + 'delta', sig, rawPub); + should(verified).equal(false); done(); }); @@ -68,8 +52,8 @@ describe('ed25519 tests:', function(){ "Block: 33291-0000088375C232A4DDAE171BB3D3C51347CB6DC8B7AA8BE4CD4DAEEADF26FEB8\n" + "Endpoints:\n" + "BASIC_MERKLED_API g1.duniter.org 10901\n" - const verified = verifyBuggy(msg, "u8t1IoWrB/C7T+2rS0rKYJfjPG4FN/HkKGFiUO5tILIzjFDvxxQiVC+0o/Vaz805SMmqJvXqornI71U7//+wCg==", "3AF7bhGQRt6ymcBZgZTBMoDsEtSwruSarjNG8kDnaueX"); - verified.should.equal(true); + const verified = verify(msg, "u8t1IoWrB/C7T+2rS0rKYJfjPG4FN/HkKGFiUO5tILIzjFDvxxQiVC+0o/Vaz805SMmqJvXqornI71U7//+wCg==", "3AF7bhGQRt6ymcBZgZTBMoDsEtSwruSarjNG8kDnaueX"); + should(verified).equal(true); done(); }); @@ -82,16 +66,8 @@ describe('ed25519 tests:', function(){ "Endpoints:\n" + "BASIC_MERKLED_API g1.duniter.tednet.fr 37.187.0.204 8999\n" + "BMAS g1.duniter.tednet.fr 9000\n" - const verified = verifyBuggy(msg, "ImvQDdpGv2M6CxSnBuseM/azJhBUGzWVgQhIvb5L2oGLm2GyLk/Sbi5wkb4IjbjbQfdRPdlcx5zxaHhvZCiWAA==", "Com8rJukCozHZyFao6AheSsfDQdPApxQRnz7QYFf64mm"); - verified.should.equal(true); - done(); - }); - - it('wrong block signature due to oldest tweetnacl should be verified with verifyBuggy', function(done){ - const msg = "InnerHash: 8B194B5C38CF0A38D16256405AC3E5FA5C2ABD26BE4DCC0C7ED5CC9824E6155B\nNonce: 30400000119992\n"; - const rawSig = "fJusVDRJA8akPse/sv4uK8ekUuvTGj1OoKYVdMQQAACs7OawDfpsV6cEMPcXxrQTCTRMrTN/rRrl20hN5zC9DQ=="; - const verified = verifyBuggy(msg, rawSig, "D9D2zaJoWYWveii1JRYLVK3J4Z7ZH3QczoKrnQeiM6mx"); - verified.should.equal(true); + const verified = verify(msg, "ImvQDdpGv2M6CxSnBuseM/azJhBUGzWVgQhIvb5L2oGLm2GyLk/Sbi5wkb4IjbjbQfdRPdlcx5zxaHhvZCiWAA==", "Com8rJukCozHZyFao6AheSsfDQdPApxQRnz7QYFf64mm"); + should(verified).equal(true); done(); }); @@ -99,15 +75,7 @@ describe('ed25519 tests:', function(){ const msg = "InnerHash: 8B194B5C38CF0A38D16256405AC3E5FA5C2ABD26BE4DCC0C7ED5CC9824E6155B\nNonce: 30400000119992\n"; const rawSig = "fJusVDRJA8akPse/sv4uK8ekUuvTGj1OoKYVdMQQAACs7OawDfpsV6cEMPcXxrQTCTRMrTN/rRrl20hN5zC9DQ=="; const verified = verify(msg, rawSig, "D9D2zaJoWYWveii1JRYLVK3J4Z7ZH3QczoKrnQeiM6mx"); - verified.should.equal(false); - done(); - }); - - it('rectified block signature should be NOT verified with verifyBuggy', function(done){ - const msg = "InnerHash: 8B194B5C38CF0A38D16256405AC3E5FA5C2ABD26BE4DCC0C7ED5CC9824E6155B\nNonce: 30400000119992\n"; - const rawSig = "aZusVDRJA8akPse/sv4uK8ekUuvTGj1OoKYVdMQQ/3+VMaDJ02I795GBBaLgjypZFEKYlPMssJMn/X+F/pxgAw=="; - const verified = verifyBuggy(msg, rawSig, "D9D2zaJoWYWveii1JRYLVK3J4Z7ZH3QczoKrnQeiM6mx"); - verified.should.equal(false); + should(verified).equal(false); done(); }); @@ -115,7 +83,7 @@ describe('ed25519 tests:', function(){ const msg = "InnerHash: 8B194B5C38CF0A38D16256405AC3E5FA5C2ABD26BE4DCC0C7ED5CC9824E6155B\nNonce: 30400000119992\n"; const rawSig = "aZusVDRJA8akPse/sv4uK8ekUuvTGj1OoKYVdMQQ/3+VMaDJ02I795GBBaLgjypZFEKYlPMssJMn/X+F/pxgAw=="; const verified = verify(msg, rawSig, "D9D2zaJoWYWveii1JRYLVK3J4Z7ZH3QczoKrnQeiM6mx"); - verified.should.equal(true); + should(verified).equal(true); done(); }); }); diff --git a/test/fast/crypto/randomKey.ts b/test/fast/crypto/randomKey.ts index 6ad90ed9c50458a6fb8be6dd0edb59e38f107ec1..398d37e27f2c0c44db63d24ee3cc0b7a143aded4 100644 --- a/test/fast/crypto/randomKey.ts +++ b/test/fast/crypto/randomKey.ts @@ -11,7 +11,8 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. -import {Key, KeyGen, randomKey, verifyBuggy} from "../../../app/lib/common-libs/crypto/keyring" +import {Key, randomKey} from "../../../app/lib/common-libs/crypto/keyring" +import {verify} from "duniteroxyde" const should = require('should'); @@ -26,16 +27,16 @@ describe('Random keypair', function(){ it('good signature from generated key should be verified', function(done){ const msg = "Some message to be signed"; - const sig = KeyGen(key.publicKey, key.secretKey).signSyncBuggy(msg); - const verified = verifyBuggy(msg, sig, key.publicKey); + const sig = new Key(key.publicKey, key.secretKey).signSync(msg); + const verified = verify(msg, sig, key.publicKey); verified.should.equal(true); done(); }); it('wrong signature from generated key should NOT be verified', function(done){ const msg = "Some message to be signed"; - const sig = KeyGen(key.publicKey, key.secretKey).signSyncBuggy(msg); - const verified = verifyBuggy(msg + 'delta', sig, key.publicKey); + const sig = new Key(key.publicKey, key.secretKey).signSync(msg); + const verified = verify(msg + 'delta', sig, key.publicKey); verified.should.equal(false); done(); }); diff --git a/test/fast/modules/common/common-crypto-test.ts b/test/fast/modules/common/common-crypto-test.ts index 797970fb3eacaf443b0d6640f8a58bcd57f6e376..6b6b64390b3509a6017cbf0d5c07b4cff11d3262 100644 --- a/test/fast/modules/common/common-crypto-test.ts +++ b/test/fast/modules/common/common-crypto-test.ts @@ -11,8 +11,8 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. -import {KeyGen, verifyBuggy} from "../../../../app/lib/common-libs/crypto/keyring" -import {Base58decode, Base58encode} from "../../../../app/lib/common-libs/crypto/base58" +import {Key} from "../../../../app/lib/common-libs/crypto/keyring" +import {verify} from "duniteroxyde" const should = require('should'); @@ -22,11 +22,9 @@ describe('ed25519 tests:', function(){ before(async () => { // Generate the keypair - const keyPair = KeyGen('HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd', '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'); - pub = Base58decode(keyPair.publicKey); - sec = Base58decode(keyPair.secretKey); - rawPub = Base58encode(new Buffer(pub)); - rawSec = Base58encode(new Buffer(sec)); + const keyPair = new Key('HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd', '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'); + rawPub = keyPair.publicKey; + rawSec = keyPair.secretKey; }) //it('good signature from existing secret key should be verified', function(done){ @@ -41,16 +39,16 @@ describe('ed25519 tests:', function(){ it('good signature from generated key should be verified', function(done){ const msg = "Some message to be signed"; - const sig = KeyGen(rawPub, rawSec).signSyncBuggy(msg); - const verified = verifyBuggy(msg, sig, rawPub); + const sig = new Key(rawPub, rawSec).signSync(msg); + const verified = verify(msg, sig, rawPub); verified.should.equal(true); done(); }); it('wrong signature from generated key should NOT be verified', function(done){ const msg = "Some message to be signed"; - const sig = KeyGen(rawPub, rawSec).signSyncBuggy(msg); - const verified = verifyBuggy(msg + 'delta', sig, rawPub); + const sig = new Key(rawPub, rawSec).signSync(msg); + const verified = verify(msg + 'delta', sig, rawPub); verified.should.equal(false); done(); }); diff --git a/test/fast/modules/common/common-random-key.ts b/test/fast/modules/common/common-random-key.ts index 7751264debde373b7d347c8c7acb249d94478dcd..57ac443d9495c93df16857ef21e48fda8110af9e 100644 --- a/test/fast/modules/common/common-random-key.ts +++ b/test/fast/modules/common/common-random-key.ts @@ -11,7 +11,8 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. -import {Key, KeyGen, randomKey, verifyBuggy} from "../../../../app/lib/common-libs/crypto/keyring" +import {Key, randomKey} from "../../../../app/lib/common-libs/crypto/keyring" +import {verify} from "duniteroxyde" const should = require('should'); @@ -26,16 +27,16 @@ describe('Random keypair', function(){ it('good signature from generated key should be verified', function(done){ const msg = "Some message to be signed"; - const sig = KeyGen(key.publicKey, key.secretKey).signSyncBuggy(msg); - const verified = verifyBuggy(msg, sig, key.publicKey); + const sig = new Key(key.publicKey, key.secretKey).signSync(msg); + const verified = verify(msg, sig, key.publicKey); verified.should.equal(true); done(); }); it('wrong signature from generated key should NOT be verified', function(done){ const msg = "Some message to be signed"; - const sig = KeyGen(key.publicKey, key.secretKey).signSyncBuggy(msg); - const verified = verifyBuggy(msg + 'delta', sig, key.publicKey); + const sig = new Key(key.publicKey, key.secretKey).signSync(msg); + const verified = verify(msg + 'delta', sig, key.publicKey); verified.should.equal(false); done(); }); diff --git a/test/fast/modules/keypair/keypair-crypto-test.ts b/test/fast/modules/keypair/keypair-crypto-test.ts index 1424c649e671eec4885987c3de6bebad613b8595..7d9537fcf83805bdc5cc06b901a9f721e395e580 100644 --- a/test/fast/modules/keypair/keypair-crypto-test.ts +++ b/test/fast/modules/keypair/keypair-crypto-test.ts @@ -19,19 +19,19 @@ describe('Scrypt salt // key', () => { it('abc // abc', async () => { const pair = await Scrypt('abc', 'abc'); - pair.should.have.property('pub').equal('HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd'); - pair.should.have.property('sec').equal('51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'); + should(pair).have.property('pub').equal('HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd'); + should(pair).have.property('sec').equal('51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'); }) it('abc // def', async () => { const pair = await Scrypt('abc', 'def'); - pair.should.have.property('pub').equal('G2CBgZBPLe6FSFUgpx2Jf1Aqsgta6iib3vmDRA1yLiqU'); - pair.should.have.property('sec').equal('58LDg8QLmF5pv6Dn9h7X4yFKfMTdP8fdAiWVcyDoTRJu454fwRihCLULH4MW37zncsg4ruoTGJPZneWk22QmG1w4'); + should(pair).have.property('pub').equal('G2CBgZBPLe6FSFUgpx2Jf1Aqsgta6iib3vmDRA1yLiqU'); + should(pair).have.property('sec').equal('58LDg8QLmF5pv6Dn9h7X4yFKfMTdP8fdAiWVcyDoTRJu454fwRihCLULH4MW37zncsg4ruoTGJPZneWk22QmG1w4'); }) it('azerty // def', async () => { const pair = await Scrypt('azerty', 'def'); - pair.should.have.property('pub').equal('3dbw4NYVEm5mwTH6bFrqBhan1k39qNHubkQWdrw2C5AD'); - pair.should.have.property('sec').equal('4kemdi17CPkkBPnjXiPFf6oBhdGiiqhCL3R4Tuafe9THK8mzBs1evHw5r9u3f8xts2zn6VCBJYVrRMzdaEaWn5Ch'); + should(pair).have.property('pub').equal('3dbw4NYVEm5mwTH6bFrqBhan1k39qNHubkQWdrw2C5AD'); + should(pair).have.property('sec').equal('4kemdi17CPkkBPnjXiPFf6oBhdGiiqhCL3R4Tuafe9THK8mzBs1evHw5r9u3f8xts2zn6VCBJYVrRMzdaEaWn5Ch'); }) }) diff --git a/test/integration/misc/http-api.ts b/test/integration/misc/http-api.ts index 2eb0ec0eb96d00bdcc045ab753791a135215219e..6ec11146cb3f3f5e4fe202068494191e3ce03bc9 100644 --- a/test/integration/misc/http-api.ts +++ b/test/integration/misc/http-api.ts @@ -333,7 +333,7 @@ async function expectJSON<T>(promise:Promise<T>, json:any) { try { const resJson = await promise; Underscore.keys(json).forEach(function(key){ - resJson.should.have.property(String(key)).equal(json[key]); + should(resJson).have.property(String(key)).equal(json[key]); }); } catch (err) { if (err.response) { diff --git a/test/integration/tools/TestUser.ts b/test/integration/tools/TestUser.ts index 7746b3b01245e743fee601fc5a9e5c03d07439fb..375b7b1071c1333ac11d6ac372ce118704c829a7 100644 --- a/test/integration/tools/TestUser.ts +++ b/test/integration/tools/TestUser.ts @@ -11,7 +11,7 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. -import {Key, KeyGen} from "../../../app/lib/common-libs/crypto/keyring" +import {Key} from "../../../app/lib/common-libs/crypto/keyring" import {IdentityDTO} from "../../../app/lib/dto/IdentityDTO"; import {TestingServer} from "./toolbox" import {CommonConstants} from "../../../app/lib/common-libs/constants" @@ -85,7 +85,7 @@ export class TestUser { issuer: this.pub, currency: this.node.server.conf.currency }).getRawUnSigned() - return this.createdIdentity += KeyGen(this.pub, this.sec).signSyncBuggy(this.createdIdentity) + '\n' + return this.createdIdentity += new Key(this.pub, this.sec).signSync(this.createdIdentity) + '\n' } public submitIdentity(raw:string, fromServer?: TestingServer) { @@ -116,7 +116,7 @@ export class TestUser { } Underscore.extend(cert, overrideProps || {}); const rawCert = CertificationDTO.fromJSONObject(cert).getRawUnSigned() - cert.sig = KeyGen(this.pub, this.sec).signSyncBuggy(rawCert) + cert.sig = new Key(this.pub, this.sec).signSync(rawCert) return CertificationDTO.fromJSONObject(cert) } @@ -157,7 +157,7 @@ export class TestUser { }; Underscore.extend(revocation, overrideProps || {}); const rawRevocation = RevocationDTO.fromJSONObject(revocation).getRawUnsigned() - revocation.revocation = KeyGen(this.pub, this.sec).signSyncBuggy(rawRevocation); + revocation.revocation = new Key(this.pub, this.sec).signSync(rawRevocation); return RevocationDTO.fromJSONObject(revocation) } @@ -185,7 +185,7 @@ export class TestUser { }; Underscore.extend(join, overrideProps || {}); const rawJoin = MembershipDTO.fromJSONObject(join).getRaw() - join.signature = KeyGen(this.pub, this.sec).signSyncBuggy(rawJoin) + join.signature = new Key(this.pub, this.sec).signSync(rawJoin) return MembershipDTO.fromJSONObject(join) } @@ -306,9 +306,9 @@ export class TestUser { } private signed(raw:string, user2?:TestUser) { - let signatures = [KeyGen(this.pub, this.sec).signSyncBuggy(raw)]; + let signatures = [new Key(this.pub, this.sec).signSync(raw)]; if (user2) { - signatures.push(KeyGen(user2.pub, user2.sec).signSyncBuggy(raw)); + signatures.push(new Key(user2.pub, user2.sec).signSync(raw)); } return raw + signatures.join('\n') + '\n'; } @@ -356,7 +356,7 @@ export class TestUser { }); Underscore.extend(peer, overrideProps || {}); const rawPeer = PeerDTO.fromJSONObject(peer).getRawUnsigned() - peer.signature = KeyGen(this.pub, this.sec).signSyncBuggy(rawPeer) + peer.signature = new Key(this.pub, this.sec).signSync(rawPeer) return PeerDTO.fromJSONObject(peer) } diff --git a/test/integration/wot/wotb.ts b/test/integration/wot/wotb.ts index 74fb35f9622af88ba766fa972d2edd72c36becb8..894b1c6e8e1e7c0b80ca9f68bd8310c9392c9c61 100644 --- a/test/integration/wot/wotb.ts +++ b/test/integration/wot/wotb.ts @@ -14,7 +14,7 @@ import {TestUser} from "../tools/TestUser" import {NewTestingServer, TestingServer} from "../tools/toolbox" import {BmaDependency} from "../../../app/modules/bma/index" -import {Wot, wotMemCopy} from "dubp-wot-rs" +import {Wot} from "duniteroxyde" import {Underscore} from "../../../app/lib/common-libs/underscore" import {shutDownEngine} from "../tools/shutdown-engine" import {CommonConstants} from "../../../app/lib/common-libs/constants" diff --git a/test/integration/ws2p/ws2p_connection.ts b/test/integration/ws2p/ws2p_connection.ts index 3309e0ec4164e735b02a8d1d356b689fa7e004ac..3e39d94b5b96bc745185cb9761e2bcb2770626a4 100644 --- a/test/integration/ws2p/ws2p_connection.ts +++ b/test/integration/ws2p/ws2p_connection.ts @@ -18,7 +18,8 @@ import { WS2PPubkeyRemoteAuth, WS2PRemoteAuth } from "../../../app/modules/ws2p/lib/WS2PConnection" -import {Key, verifyBuggy} from "../../../app/lib/common-libs/crypto/keyring" +import {Key} from "../../../app/lib/common-libs/crypto/keyring" +import {verify} from "duniteroxyde" import {getNewTestingPort} from "../tools/toolbox" import {WS2PMessageHandler} from "../../../app/modules/ws2p/lib/impl/WS2PMessageHandler" import {WS2PResponse} from "../../../app/modules/ws2p/lib/impl/WS2PResponse" @@ -83,7 +84,7 @@ describe('WS2P', () => { if (obj.auth) { if (nbAsk == 1 || nbAsk == 3) { const challengeMessage = `WS2P:ACK:gtest:${serverKeypair.pub}:${obj.challenge}` - const sig = serverKeypair.signSyncBuggy(challengeMessage) + const sig = serverKeypair.signSync(challengeMessage) if (nbAsk == 1) { ws.send(JSON.stringify({ auth: 'ACK', pub: serverKeypair.pub, sig: 'hiohoihio' })) } @@ -95,7 +96,7 @@ describe('WS2P', () => { // We do like if the key was wrong const clientPub = 'GgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd' const challengeMessage = `WS2P:CONNECT:${clientPub}:${obj.challenge}` - if (!verifyBuggy(challengeMessage, obj.sig, clientPub)) { + if (!verify(challengeMessage, obj.sig, clientPub)) { clientAskError = 'Wrong signature from client CONNECT' } } @@ -332,7 +333,7 @@ describe('WS2P', () => { class WS2PPubkeyAnsweringWithWrongSigForACK extends WS2PPubkeyRemoteAuth { async sendACK(ws: any): Promise<void> { const challengeMessage = `WS2P:WRONG:${this.pair.pub}:${this.challenge}` - const sig = this.pair.signSyncBuggy(challengeMessage) + const sig = this.pair.signSync(challengeMessage) await ws.send(JSON.stringify({ auth: 'ACK', pub: this.pair.pub, @@ -354,7 +355,7 @@ describe('WS2P', () => { async registerACK(sig: string, pub: string): Promise<boolean> { const challengeMessage = `WS2P:BLABLA:${pub}:${this.challenge}` - this.authenticated = verifyBuggy(challengeMessage, sig, pub) + this.authenticated = verify(challengeMessage, sig, pub) if (!this.authenticated) { this.serverAuthReject("Wrong signature from server ACK") } else { diff --git a/yarn.lock b/yarn.lock index 3792b35538f120d69f705e80db69452967aa3fb5..db292ef1566697f8931b3f39fc60a0e6b981ca34 100644 --- a/yarn.lock +++ b/yarn.lock @@ -578,13 +578,6 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= -base-x@^3.0.2: - version "3.0.5" - resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.5.tgz#d3ada59afed05b921ab581ec3112e6444ba0795a" - integrity sha512-C3picSgzPSLE+jW3tcBzJoGwitOtazb5B+5YmAxZm2ybmTi9LNgAtDO/jjVEBZwHoXmDBZ9m/IELj3elJVRBcA== - dependencies: - safe-buffer "^5.0.1" - base64-js@^1.0.2: version "1.3.0" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.0.tgz#cab1e6118f051095e58b5281aea8c1cd22bfc0e3" @@ -737,13 +730,6 @@ browser-stdout@1.3.0: resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" integrity sha1-81HTKWnTL6XXpVZxVCY9korjvR8= -bs58@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" - integrity sha1-vhYedsNU9veIrkBx9j806MTwpCo= - dependencies: - base-x "^3.0.2" - buffer-alloc-unsafe@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz#bd7dc26ae2972d0eda253be061dba992349c19f0" @@ -772,11 +758,6 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== -buffer-shims@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51" - integrity sha1-mXjOMXOIxkmth5MCjDR37wRKi1E= - buffer@^5.1.0: version "5.2.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.2.1.tgz#dd57fa0f109ac59c602479044dca7b8b3d0b71d6" @@ -1350,13 +1331,6 @@ debug@^4.1.0: dependencies: ms "^2.1.1" -debug@~2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da" - integrity sha1-+HBX6ZWxofauaklgZkE3vFbwOdo= - dependencies: - ms "0.7.1" - decamelize@^1.1.1, decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -1379,11 +1353,6 @@ deep-extend@^0.6.0, deep-extend@~0.6.0: resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== -deep-extend@~0.4.0: - version "0.4.2" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" - integrity sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8= - deep-is@~0.1.2, deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" @@ -1495,10 +1464,10 @@ doctrine@^2.1.0: dependencies: esutils "^2.0.2" -dubp-wot-rs@0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/dubp-wot-rs/-/dubp-wot-rs-0.6.0.tgz#42ecaae435840a77bfc2cf023c4a8d4f7b22924d" - integrity sha512-5imOlrpD15zAVCoBPhNF2nQPA/vcr90Rs/0SZ71SgdNtQbMFOWCkcr3LQecazsaqLzJkBEUkFyABvQF4AI1MJw== +duniteroxyde@0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/duniteroxyde/-/duniteroxyde-0.2.3.tgz#0f2d2c01aee988f87c027903541df25b6f18e493" + integrity sha512-pwGbfeOky1MWLWs/mYiYq2dozlVs2161r+vmaj8zUNCGCocCiXzap6m6/wE0p5PxZv3ADMtEXO/qWDP67ZrZ3A== dependencies: neon-cli "^0.4.0" @@ -2278,7 +2247,7 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= -fstream-ignore@^1.0.5, fstream-ignore@~1.0.5: +fstream-ignore@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/fstream-ignore/-/fstream-ignore-1.0.5.tgz#9c31dae34767018fe1d249b24dada67d092da105" integrity sha1-nDHa40dnAY/h0kmyTa2mfQktoQU= @@ -2297,7 +2266,7 @@ fstream-ignore@^1.0.5, fstream-ignore@~1.0.5: mkdirp "0.5" rimraf "2" -fstream@^1.0.0, fstream@^1.0.10, fstream@^1.0.2, fstream@~1.0.10: +fstream@^1.0.0, fstream@^1.0.10, fstream@^1.0.2: version "1.0.11" resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.11.tgz#5c1fb1f117477114f0632a0eb4b71b3cb0fd3171" integrity sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE= @@ -2403,7 +2372,7 @@ glob@7.1.1: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.0, glob@^7.0.5, glob@^7.0.6, glob@^7.1.3: +glob@^7.0.0, glob@^7.0.6, glob@^7.1.3: version "7.1.4" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== @@ -3672,7 +3641,7 @@ mixin-deep@^1.2.0: for-in "^1.0.2" is-extendable "^1.0.1" -mkdirp@0.5, mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: +mkdirp@0.5, mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= @@ -3722,11 +3691,6 @@ morgan@1.9.1: on-finished "~2.3.0" on-headers "~1.0.1" -ms@0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098" - integrity sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg= - ms@0.7.2: version "0.7.2" resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765" @@ -3759,20 +3723,6 @@ mute-stream@0.0.7: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= -naclb@1.3.11: - version "1.3.11" - resolved "https://registry.yarnpkg.com/naclb/-/naclb-1.3.11.tgz#67dfdb753bae4ce39ed0f6765c753735218e1b56" - integrity sha512-pC2iHObEf7TSSetzcpSJsDYnRi/GXnUV9b0AaXLmznHu7jTj2grOVwTcO7lJpwoiqRmwpsBESKLPVoJ+Xg5iKA== - dependencies: - bindings "1.2.1" - nan "2.13.2" - node-pre-gyp "0.6.33" - -nan@2.13.2: - version "2.13.2" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.13.2.tgz#f51dc7ae66ba7d5d55e1e6d4d8092e802c9aefe7" - integrity sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw== - nan@~2.10.0: version "2.10.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.10.0.tgz#96d0cd610ebd58d4b4de9cc0c6828cda99c7548f" @@ -3878,21 +3828,6 @@ node-abi@^2.7.0: dependencies: semver "^5.4.1" -node-pre-gyp@0.6.33: - version "0.6.33" - resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.33.tgz#640ac55198f6a925972e0c16c4ac26a034d5ecc9" - integrity sha1-ZArFUZj2qSWXLgwWxKwmoDTV7Mk= - dependencies: - mkdirp "~0.5.1" - nopt "~3.0.6" - npmlog "^4.0.1" - rc "~1.1.6" - request "^2.79.0" - rimraf "~2.5.4" - semver "~5.3.0" - tar "~2.2.1" - tar-pack "~3.3.0" - node-pre-gyp@0.6.34: version "0.6.34" resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.34.tgz#94ad1c798a11d7fc67381b50d47f8cc18d9799f7" @@ -3963,13 +3898,6 @@ nopt@^4.0.1: abbrev "1" osenv "^0.1.4" -nopt@~3.0.6: - version "3.0.6" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" - integrity sha1-xkZdvwirzU2zWTF/eaxopkayj/k= - dependencies: - abbrev "1" - normalize-package-data@^2.3.2: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" @@ -4130,13 +4058,6 @@ once@^1.3.0, once@^1.3.1, once@^1.3.3, once@^1.4.0: dependencies: wrappy "1" -once@~1.3.3: - version "1.3.3" - resolved "https://registry.yarnpkg.com/once/-/once-1.3.3.tgz#b2e261557ce4c314ec8304f3fa82663e4297ca20" - integrity sha1-suJhVXzkwxTsgwTz+oJmPkKXyiA= - dependencies: - wrappy "1" - onetime@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" @@ -4422,11 +4343,6 @@ preserve@^0.2.0: resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks= -process-nextick-args@~1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" - integrity sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M= - process-nextick-args@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" @@ -4593,16 +4509,6 @@ rc@^1.1.7, rc@^1.2.7: minimist "^1.2.0" strip-json-comments "~2.0.1" -rc@~1.1.6: - version "1.1.7" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.1.7.tgz#c5ea564bb07aff9fd3a5b32e906c1d3a65940fea" - integrity sha1-xepWS7B6/5/TpbMukGwdOmWUD+o= - dependencies: - deep-extend "~0.4.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - read-pkg-up@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" @@ -4652,19 +4558,6 @@ readable-stream@~1.0.0, readable-stream@~1.0.2, readable-stream@~1.0.31: isarray "0.0.1" string_decoder "~0.10.x" -readable-stream@~2.1.4: - version "2.1.5" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.1.5.tgz#66fa8b720e1438b364681f2ad1a63c618448c9d0" - integrity sha1-ZvqLcg4UOLNkaB8q0aY8YYRIydA= - dependencies: - buffer-shims "^1.0.0" - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "~1.0.0" - process-nextick-args "~1.0.6" - string_decoder "~0.10.x" - util-deprecate "~1.0.1" - readline2@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/readline2/-/readline2-0.1.1.tgz#99443ba6e83b830ef3051bfd7dc241a82728d568" @@ -4892,13 +4785,6 @@ rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@~2. dependencies: glob "^7.1.3" -rimraf@~2.5.1, rimraf@~2.5.4: - version "2.5.4" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.5.4.tgz#96800093cbf1a0c86bd95b4625467535c29dfa04" - integrity sha1-loAAk8vxoMhr2VtGJUZ1NcKd+gQ= - dependencies: - glob "^7.0.5" - rsvp@^3.5.0: version "3.6.2" resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-3.6.2.tgz#2e96491599a96cde1b515d5674a8f7a91452926a" @@ -4960,11 +4846,6 @@ sax@>=0.1.1, sax@^1.2.4: resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== -seedrandom@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/seedrandom/-/seedrandom-3.0.1.tgz#eb3dde015bcf55df05a233514e5df44ef9dce083" - integrity sha512-1/02Y/rUeU1CJBAGLebiC5Lbo5FnB22gQbIFFYTLkwvp1xdABZJH1sn4ZT1MzXmPpzv+Rf/Lu2NcsLJiK4rcDg== - "semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1: version "5.7.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" @@ -4975,11 +4856,6 @@ semver@^5.1.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== -semver@~5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" - integrity sha1-myzl094C0XxgEq0yaqa00M9U+U8= - send@0.15.1: version "0.15.1" resolved "https://registry.yarnpkg.com/send/-/send-0.15.1.tgz#8a02354c26e6f5cca700065f5f0cdeba90ec7b5f" @@ -5610,20 +5486,6 @@ tar-pack@^3.4.0: tar "^2.2.1" uid-number "^0.0.6" -tar-pack@~3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.3.0.tgz#30931816418f55afc4d21775afdd6720cee45dae" - integrity sha1-MJMYFkGPVa/E0hd1r91nIM7kXa4= - dependencies: - debug "~2.2.0" - fstream "~1.0.10" - fstream-ignore "~1.0.5" - once "~1.3.3" - readable-stream "~2.1.4" - rimraf "~2.5.1" - tar "~2.2.1" - uid-number "~0.0.6" - tar-stream@^1.1.2, tar-stream@^1.5.0: version "1.6.2" resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-1.6.2.tgz#8ea55dab37972253d9a9af90fdcd559ae435c555" @@ -5637,7 +5499,7 @@ tar-stream@^1.1.2, tar-stream@^1.5.0: to-buffer "^1.1.1" xtend "^4.0.0" -tar@^2.2.1, tar@~2.2.1: +tar@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.1.tgz#8e4d2a256c0e2185c6b18ad694aec968b83cb1d1" integrity sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE= @@ -5834,11 +5696,6 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0: resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= -tweetnacl@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.1.tgz#2594d42da73cd036bd0d2a54683dd35a6b55ca17" - integrity sha512-kcoMoKTPYnoeS50tzoqjPY3Uv9axeuuFAZY9M/9zFnhoVvRfxz9K29IMPD7jGmt2c8SW7i3gT9WqDl2+nV7p4A== - type-check@~0.3.1, type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" @@ -5915,7 +5772,7 @@ uglify-js@^3.1.4: commander "~2.20.3" source-map "~0.6.1" -uid-number@^0.0.6, uid-number@~0.0.6: +uid-number@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" integrity sha1-DqEOgDXo61uOREnwbaHHMGY7qoE=