meck93/evote-crypto

View on GitHub
src/ec-elgamal/models.ts

Summary

Maintainability
A
0 mins
Test Coverage
Missing semicolon
import { curve } from 'elliptic'
Missing semicolon
import BN = require('bn.js')
 
comment must start with a space
//eslint-disable-next-line @typescript-eslint/no-empty-interface
An interface declaring no members is equivalent to its supertype.
export interface CurvePoint extends curve.short.ShortPoint {}
 
export interface SystemParameters {
Missing semicolon
p: BN // prime
Missing semicolon
n: BN // prime factor: p = 2*n+1
Missing semicolon
g: CurvePoint // generator
}
 
export interface SystemParametersSerialized {
Missing semicolon
p: string
Missing semicolon
n: string
Missing semicolon
g: string
}
 
export interface KeyPair {
Missing semicolon
h: CurvePoint
Missing semicolon
sk: BN
}
 
export interface Cipher {
Missing semicolon
a: CurvePoint
Missing semicolon
b: CurvePoint
Missing semicolon
r?: BN
}
 
TODO found
// TODO: test me
export const instanceOfSystemParametersSerialized = (
object: any
): object is SystemParametersSerialized => {
/*const test = (field: string, type: string): boolean => {
return field in object && typeof object[field] === type
}*/
return (
'p' in object &&
typeof object.p === 'string' &&
'n' in object &&
typeof object.n === 'string' &&
'g' in object &&
typeof object.g === 'string'
Missing semicolon
)
Missing semicolon
}