From f784bd8da33bc5047fabab3f8b8819b1b3080140 Mon Sep 17 00:00:00 2001 From: Christoph Diehl Date: Tue, 21 Nov 2017 06:51:14 +0300 Subject: [PATCH] Add crypto.js for all things crypto. --- lib/make/crypto.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 lib/make/crypto.js diff --git a/lib/make/crypto.js b/lib/make/crypto.js new file mode 100644 index 0000000..c176d3b --- /dev/null +++ b/lib/make/crypto.js @@ -0,0 +1,21 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +make.crypto = { + keygenAlgorithm: () => { + const keygenAlgorithms = [ + { + name: 'ECDSA', + namedCurve: 'P-256' + }, + { + name: 'RSASSA-PKCS1-v1_5', + hash: 'SHA-256', + modulusLength: 2048, + publicExponent: new Uint8Array([1, 0, 1]) + } + ] + return random.pick(keygenAlgorithms) + } +}