Merge pull request #79 from randombit/jack/update-readme-for-bls-short-sigs
Update the README to describe BLS short signature support
This commit is contained in:
commit
5c21fa3855
22
README.md
22
README.md
@ -579,6 +579,14 @@ Main methods and properties are:
|
|||||||
- `Signature` property with `fromHex`, `toHex` methods
|
- `Signature` property with `fromHex`, `toHex` methods
|
||||||
- `fields` containing `Fp`, `Fp2`, `Fp6`, `Fp12`, `Fr`
|
- `fields` containing `Fp`, `Fp2`, `Fp6`, `Fp12`, `Fr`
|
||||||
|
|
||||||
|
The default BLS uses short public keys (with public keys in G1 and signatures in G2).
|
||||||
|
Short signatures (public keys in G2 and signatures in G1) is also supported, using:
|
||||||
|
|
||||||
|
- `getPublicKeyForShortSignatures(privateKey)`
|
||||||
|
- `signShortSignature(message, privateKey)`
|
||||||
|
- `verifyShortSignature(signature, message, publicKey)`
|
||||||
|
- `aggregateShortSignatures(signatures)`
|
||||||
|
|
||||||
Right now we only implement BLS12-381 (compatible with ETH and others),
|
Right now we only implement BLS12-381 (compatible with ETH and others),
|
||||||
but in theory defining BLS12-377, BLS24 should be straightforward. An example:
|
but in theory defining BLS12-377, BLS24 should be straightforward. An example:
|
||||||
|
|
||||||
@ -627,15 +635,25 @@ Full types:
|
|||||||
|
|
||||||
```ts
|
```ts
|
||||||
getPublicKey: (privateKey: PrivKey) => Uint8Array;
|
getPublicKey: (privateKey: PrivKey) => Uint8Array;
|
||||||
|
getPublicKeyForShortSignatures: (privateKey: PrivKey) => Uint8Array;
|
||||||
sign: {
|
sign: {
|
||||||
(message: Hex, privateKey: PrivKey): Uint8Array;
|
(message: Hex, privateKey: PrivKey): Uint8Array;
|
||||||
(message: ProjPointType<Fp2>, privateKey: PrivKey): ProjPointType<Fp2>;
|
(message: ProjPointType<Fp2>, privateKey: PrivKey): ProjPointType<Fp2>;
|
||||||
};
|
};
|
||||||
|
signShortSignature: {
|
||||||
|
(message: Hex, privateKey: PrivKey): Uint8Array;
|
||||||
|
(message: ProjPointType<Fp>, privateKey: PrivKey): ProjPointType<Fp>;
|
||||||
|
};
|
||||||
verify: (
|
verify: (
|
||||||
signature: Hex | ProjPointType<Fp2>,
|
signature: Hex | ProjPointType<Fp2>,
|
||||||
message: Hex | ProjPointType<Fp2>,
|
message: Hex | ProjPointType<Fp2>,
|
||||||
publicKey: Hex | ProjPointType<Fp>
|
publicKey: Hex | ProjPointType<Fp>
|
||||||
) => boolean;
|
) => boolean;
|
||||||
|
verifyShortSignature: (
|
||||||
|
signature: Hex | ProjPointType<Fp>,
|
||||||
|
message: Hex | ProjPointType<Fp>,
|
||||||
|
publicKey: Hex | ProjPointType<Fp2>
|
||||||
|
) => boolean;
|
||||||
verifyBatch: (
|
verifyBatch: (
|
||||||
signature: Hex | ProjPointType<Fp2>,
|
signature: Hex | ProjPointType<Fp2>,
|
||||||
messages: (Hex | ProjPointType<Fp2>)[],
|
messages: (Hex | ProjPointType<Fp2>)[],
|
||||||
@ -649,6 +667,10 @@ aggregateSignatures: {
|
|||||||
(signatures: Hex[]): Uint8Array;
|
(signatures: Hex[]): Uint8Array;
|
||||||
(signatures: ProjPointType<Fp2>[]): ProjPointType<Fp2>;
|
(signatures: ProjPointType<Fp2>[]): ProjPointType<Fp2>;
|
||||||
};
|
};
|
||||||
|
aggregateShortSignatures: {
|
||||||
|
(signatures: Hex[]): Uint8Array;
|
||||||
|
(signatures: ProjPointType<Fp>[]): ProjPointType<Fp>;
|
||||||
|
};
|
||||||
millerLoop: (ell: [Fp2, Fp2, Fp2][], g1: [Fp, Fp]) => Fp12;
|
millerLoop: (ell: [Fp2, Fp2, Fp2][], g1: [Fp, Fp]) => Fp12;
|
||||||
pairing: (P: ProjPointType<Fp>, Q: ProjPointType<Fp2>, withFinalExponent?: boolean) => Fp12;
|
pairing: (P: ProjPointType<Fp>, Q: ProjPointType<Fp2>, withFinalExponent?: boolean) => Fp12;
|
||||||
G1: CurvePointsRes<Fp> & ReturnType<typeof htf.createHasher<Fp>>;
|
G1: CurvePointsRes<Fp> & ReturnType<typeof htf.createHasher<Fp>>;
|
||||||
|
Loading…
Reference in New Issue
Block a user