Merge pull request #42 from ChainSafe/clean-methods

Clean methods not in the interface
This commit is contained in:
Cayman 2020-11-29 15:35:50 -07:00 committed by GitHub
commit 46b317b528
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 22 deletions

View File

@ -1,7 +1,6 @@
import * as blst from "@chainsafe/blst"; import * as blst from "@chainsafe/blst";
import {bytesToHex, hexToBytes} from "../helpers"; import {bytesToHex, hexToBytes} from "../helpers";
import {IPublicKey} from "../interface"; import {IPublicKey} from "../interface";
import {Signature} from "./signature";
export class PublicKey implements IPublicKey { export class PublicKey implements IPublicKey {
readonly affine: blst.PublicKey; readonly affine: blst.PublicKey;
@ -28,10 +27,6 @@ export class PublicKey implements IPublicKey {
return new PublicKey(affine, jacobian); return new PublicKey(affine, jacobian);
} }
verifyMessage(signature: Signature, message: Uint8Array): boolean {
return signature.verify(this, message);
}
toBytes(): Uint8Array { toBytes(): Uint8Array {
return this.affine.toBytes(); return this.affine.toBytes();
} }

View File

@ -1,7 +1,6 @@
import {PublicKeyType} from "bls-eth-wasm"; import {PublicKeyType} from "bls-eth-wasm";
import {getContext} from "./context"; import {getContext} from "./context";
import {EMPTY_PUBLIC_KEY, PUBLIC_KEY_LENGTH} from "../constants"; import {EMPTY_PUBLIC_KEY, PUBLIC_KEY_LENGTH} from "../constants";
import {Signature} from "./signature";
import {bytesToHex, hexToBytes, isEqualBytes} from "../helpers"; import {bytesToHex, hexToBytes, isEqualBytes} from "../helpers";
import {IPublicKey} from "../interface"; import {IPublicKey} from "../interface";
@ -41,16 +40,6 @@ export class PublicKey implements IPublicKey {
return agg; return agg;
} }
add(other: PublicKey): PublicKey {
const agg = new PublicKey(this.value.clone());
agg.value.add(other.value);
return agg;
}
verifyMessage(signature: Signature, message: Uint8Array): boolean {
return this.value.verify(signature.value, message);
}
toBytes(): Uint8Array { toBytes(): Uint8Array {
return this.value.serialize(); return this.value.serialize();
} }

View File

@ -44,12 +44,6 @@ export class Signature implements ISignature {
return new Signature(signature); return new Signature(signature);
} }
add(other: Signature): Signature {
const agg = this.value.clone();
agg.add(other.value);
return new Signature(agg);
}
verify(publicKey: PublicKey, message: Uint8Array): boolean { verify(publicKey: PublicKey, message: Uint8Array): boolean {
return publicKey.value.verify(this.value, message); return publicKey.value.verify(this.value, message);
} }