Skip to content
This repository has been archived by the owner on Oct 12, 2024. It is now read-only.

Commit

Permalink
Fix aggregatePublicKeys return type.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Oct 13, 2020
1 parent 9316cfe commit 0f828f9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,16 +399,16 @@ export async function verify(signature: Bytes, message: Bytes, publicKey: Bytes)
return exp.equals(Fq12.ONE);
}

export function aggregatePublicKeys(publicKeys: Bytes[]) {
export function aggregatePublicKeys(publicKeys: Bytes[]): Uint8Array {
if (!publicKeys.length) throw new Error('Expected non-empty array');
return publicKeys.reduce(
(sum, publicKey) => sum.add(PointG1.fromCompressedHex(publicKey)),
PointG1.ZERO
);
).toCompressedHex();
}

// e(G, S) = e(G, SUM(n)(Si)) = MUL(n)(e(G, Si))
export function aggregateSignatures(signatures: Bytes[]) {
export function aggregateSignatures(signatures: Bytes[]): Uint8Array {
if (!signatures.length) throw new Error('Expected non-empty array');
const aggregatedSignature = signatures.reduce(
(sum, signature) => sum.add(PointG2.fromSignature(signature)),
Expand Down

0 comments on commit 0f828f9

Please sign in to comment.