#1547 Remove usage of crypto libraries

This commit is contained in:
Knut Sveidqvist
2020-07-16 10:48:37 +02:00
parent bbc9532444
commit 594ae20a6e
9 changed files with 308878 additions and 23545 deletions

View File

@@ -15,7 +15,7 @@ import {
import { logger } from './logger';
import { sanitizeUrl } from '@braintree/sanitize-url';
import common from './diagrams/common/common';
import cryptoRandomString from 'crypto-random-string';
// import cryptoRandomString from 'crypto-random-string';
// Effectively an enum of the supported curve types, accessible by name
const d3CurveTypes = {
@@ -408,8 +408,18 @@ export const generateId = () => {
);
};
function makeid(length) {
var result = '';
var characters = '0123456789abcdef';
var charactersLength = characters.length;
for (var i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
export const random = options => {
return cryptoRandomString(options);
return makeid(options.length);
};
/**