Function decrypt
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
static async decrypt({encrypted, keys, options}) {
if (typeof encrypted.message === 'undefined') throw new Error('InvalidEncryptedMessage'); // TODO, change according to the class
if (!(encrypted.message.message instanceof Array)) throw new Error('NonArrayMessage');
const jscu = getJscu();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function decrypt
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async decrypt({encrypted, keys, options}) {
if (typeof encrypted.message === 'undefined') throw new Error('InvalidEncryptedMessage'); // TODO, change according to the class
if (!(encrypted.message.message instanceof Array)) throw new Error('NonArrayMessage');
const jscu = getJscu();
Function encrypt
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
static async encrypt({message, keys, options}) {
const jscu = getJscu();
// check options
if(typeof options === 'undefined') options = {};
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function encrypt
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async encrypt({message, keys, options}) {
const jscu = getJscu();
// check options
if(typeof options === 'undefined') options = {};
Function generateKey
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
static async generateKey({params, passphrase=null, encryptOptions={}}) {
const jscu = getJscu();
if (params.type === 'session') {
if (!params.length) throw new Error('params.length must be specified');
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function verify
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async verify({message, signature, keys, options}){
if(!keys.publicKeys) throw new Error('JscuInvalidVerificationKeys');
const jscu = getJscu();