From 6661a7db7b82e36aef37667dc7c6d73fdbb79029 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Mon, 28 Aug 2023 09:22:25 -0400 Subject: [PATCH] Update the README to describe BLS short signature support --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index dfeaf76..91d3c8e 100644 --- a/README.md +++ b/README.md @@ -579,6 +579,14 @@ Main methods and properties are: - `Signature` property with `fromHex`, `toHex` methods - `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), but in theory defining BLS12-377, BLS24 should be straightforward. An example: @@ -627,15 +635,25 @@ Full types: ```ts getPublicKey: (privateKey: PrivKey) => Uint8Array; +getPublicKeyForShortSignatures: (privateKey: PrivKey) => Uint8Array; sign: { (message: Hex, privateKey: PrivKey): Uint8Array; (message: ProjPointType, privateKey: PrivKey): ProjPointType; }; +signShortSignature: { + (message: Hex, privateKey: PrivKey): Uint8Array; + (message: ProjPointType, privateKey: PrivKey): ProjPointType; +}; verify: ( signature: Hex | ProjPointType, message: Hex | ProjPointType, publicKey: Hex | ProjPointType ) => boolean; +verifyShortSignature: ( + signature: Hex | ProjPointType, + message: Hex | ProjPointType, + publicKey: Hex | ProjPointType +) => boolean; verifyBatch: ( signature: Hex | ProjPointType, messages: (Hex | ProjPointType)[], @@ -649,6 +667,10 @@ aggregateSignatures: { (signatures: Hex[]): Uint8Array; (signatures: ProjPointType[]): ProjPointType; }; +aggregateShortSignatures: { + (signatures: Hex[]): Uint8Array; + (signatures: ProjPointType[]): ProjPointType; +}; millerLoop: (ell: [Fp2, Fp2, Fp2][], g1: [Fp, Fp]) => Fp12; pairing: (P: ProjPointType, Q: ProjPointType, withFinalExponent?: boolean) => Fp12; G1: CurvePointsRes & ReturnType>;