Skip to content

Commit

Permalink
Add verifyBatch docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Dec 3, 2020
1 parent 1216d05 commit d9d0e8c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const msg = 'hello';
const messages = ['whatsup', 'all good', 'thanks'];
const signatures2 = await Promise.all(privateKeys.map((p, i) => bls.sign(messages[i], p)));
const aggSignature2 = await bls.aggregateSignatures(signatures);
const isCorrect3 = await bls.verifyMultiple(signature, messages, publicKeys);
const isCorrect3 = await bls.verifyBatch(signature, messages, publicKeys);
})();
```

Expand All @@ -74,6 +74,7 @@ const msg = 'hello';
- [`verify(signature, hash, publicKey)`](#verifysignature-hash-publickey)
- [`aggregatePublicKeys(publicKeys)`](#aggregatepublickeyspublickeys)
- [`aggregateSignatures(signatures)`](#aggregatesignaturessignatures)
- [`verifyBatch(messages, publicKeys, signature)`](#verifybatchmessages-publickeys-signature)
- [`pairing(G1Point, G2Point)`](#pairingg1point-g2point)

##### `getPublicKey(privateKey)`
Expand Down Expand Up @@ -125,6 +126,19 @@ function aggregateSignatures(signatures: (Uint8Array | string | PointG2)[]): Uin
- `signatures: (Uint8Array | string | PointG2)[]` - e.g. that have been generated by `sign`
- Returns `Uint8Array | PointG2`: one aggregated signature which calculated from signatures

##### `verifyBatch(hashes, publicKeys, signature)`
```typescript
function verifyBatch(
hashes: (Uint8Array | string | PointG2)[],
publicKeys: (Uint8Array | string | PointG1)[],
signature: Uint8Array | string | PointG2
): Promise<boolean>
```
- `hashes: (Uint8Array | string | PointG2)[]` - messages hashes that needs to be verified
- `publicKeys: (Uint8Array | string | PointG1)[]` - e.g. that were generated from `privateKeys` by `getPublicKey`
- `signature: Uint8Array | string | PointG2` - object returned by the `aggregateSignatures` function
- Returns `Promise<boolean>`: `true` / `false` whether the signature matches hashes

##### `pairing(G1Point, G2Point)`
```typescript
function pairing(
Expand Down

0 comments on commit d9d0e8c

Please sign in to comment.