Clean methods not in the interface
This commit is contained in:
parent
3bb136cfcc
commit
2208922aa6
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue