@@ -41,12 +41,12 @@ export abstract class IBEServers {
4141 * Encrypt a batch of messages for the given identity.
4242 *
4343 * @param id The identity.
44- * @param msgAndInfos The messages and an additional info parameter which will be included in the KDF .
44+ * @param msgAndIndices The messages and the corresponding indices of the share being encrypted .
4545 * @returns The encrypted messages.
4646 */
4747 abstract encryptBatched (
4848 id : Uint8Array ,
49- msgAndInfos : { msg : Uint8Array ; info : Uint8Array } [ ] ,
49+ msgAndIndices : { msg : Uint8Array ; index : number } [ ] ,
5050 randomnessKey : Uint8Array ,
5151 ) : typeof IBEEncryptions . $inferType ;
5252}
@@ -65,15 +65,15 @@ export class BonehFranklinBLS12381Services extends IBEServers {
6565
6666 encryptBatched (
6767 id : Uint8Array ,
68- msgAndInfos : { msg : Uint8Array ; info : Uint8Array } [ ] ,
68+ msgAndIndices : { msg : Uint8Array ; index : number } [ ] ,
6969 randomnessKey : Uint8Array ,
7070 ) : typeof IBEEncryptions . $inferType {
71- if ( this . publicKeys . length === 0 || this . publicKeys . length !== msgAndInfos . length ) {
71+ if ( this . publicKeys . length === 0 || this . publicKeys . length !== msgAndIndices . length ) {
7272 throw new Error ( 'Invalid public keys' ) ;
7373 }
7474 const [ r , nonce , keys ] = encapBatched ( this . publicKeys , id ) ;
75- const encryptedShares = msgAndInfos . map ( ( msgAndInfo , i ) =>
76- xor ( msgAndInfo . msg , kdf ( keys [ i ] , nonce , id , msgAndInfo . info ) ) ,
75+ const encryptedShares = msgAndIndices . map ( ( msgAndIndex , i ) =>
76+ xor ( msgAndIndex . msg , kdf ( keys [ i ] , nonce , id , this . objectIds [ i ] , msgAndIndex . index ) ) ,
7777 ) ;
7878 const encryptedRandomness = xor ( randomnessKey , r . toBytes ( ) ) ;
7979
@@ -114,9 +114,9 @@ export class BonehFranklinBLS12381Services extends IBEServers {
114114 sk : G1Element ,
115115 ciphertext : Uint8Array ,
116116 id : Uint8Array ,
117- info : Uint8Array ,
117+ [ objectId , index ] : [ string , number ] ,
118118 ) : Uint8Array {
119- return xor ( ciphertext , kdf ( decap ( nonce , sk ) , nonce , id , info ) ) ;
119+ return xor ( ciphertext , kdf ( decap ( nonce , sk ) , nonce , id , objectId , index ) ) ;
120120 }
121121}
122122
0 commit comments