Function deriveSecret
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
export const deriveSecret = async (publicJwk: JsonWebKey, privateJwk: JsonWebKey): Promise<Uint8Array> => {
if(publicJwk.crv !== privateJwk.crv) throw new Error('UnmatchedCurveName');
const env = util.getCrypto();
Function generateKey
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
export const generateKey = async (namedCurve: CurveTypes ='P-256'): Promise<JsonWebKeyPair> => {
const env = util.getCrypto();
let pure: boolean = false;
let keyPair: JsonWebKeyPair;
Function sign
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
export const sign = async (
msg: Uint8Array,
privateJwk: JsonWebKey,
hash: HashTypes = 'SHA-256',
signatureFormat: SignatureFormat ='raw'
Function verify
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
export const verify = async (
msg: Uint8Array,
signature: Uint8Array,
publicJwk: JsonWebKey,
hash: HashTypes = 'SHA-256',
Function deriveSecret
has 31 lines of code (exceeds 25 allowed). Consider refactoring.
export const deriveSecret = async (publicJwk: JsonWebKey, privateJwk: JsonWebKey): Promise<Uint8Array> => {
if(publicJwk.crv !== privateJwk.crv) throw new Error('UnmatchedCurveName');
const env = util.getCrypto();
Function verify
has 30 lines of code (exceeds 25 allowed). Consider refactoring.
export const verify = async (
msg: Uint8Array,
signature: Uint8Array,
publicJwk: JsonWebKey,
hash: HashTypes = 'SHA-256',
Function sign
has 30 lines of code (exceeds 25 allowed). Consider refactoring.
export const sign = async (
msg: Uint8Array,
privateJwk: JsonWebKey,
hash: HashTypes = 'SHA-256',
signatureFormat: SignatureFormat ='raw'
Function generateKey
has 30 lines of code (exceeds 25 allowed). Consider refactoring.
export const generateKey = async (namedCurve: CurveTypes ='P-256'): Promise<JsonWebKeyPair> => {
const env = util.getCrypto();
let pure: boolean = false;
let keyPair: JsonWebKeyPair;
Identical blocks of code found in 4 locations. Consider refactoring.
if (pure) {
if (e instanceof Error) {
throw new Error(`UnsupportedEnvironment: ${e.message}`);
} else {
throw new Error('UnsupportedEnvironment');
Identical blocks of code found in 4 locations. Consider refactoring.
if (pure) {
if (e instanceof Error) {
throw new Error(`UnsupportedEnvironment: ${e.message}`);
} else {
throw new Error('UnsupportedEnvironment');
Identical blocks of code found in 4 locations. Consider refactoring.
if (pure) {
if (e instanceof Error) {
throw new Error(`UnsupportedEnvironment: ${e.message}`);
} else {
throw new Error('UnsupportedEnvironment');
Identical blocks of code found in 4 locations. Consider refactoring.
if (pure) {
if (e instanceof Error) {
throw new Error(`UnsupportedEnvironment: ${e.message}`);
} else {
throw new Error('UnsupportedEnvironment');
There are no issues that match your filters.