deprecated import { generateOthersAESKeyEncrypted as generateOthersAESKeyEncryptedV40 , encrypt1ToN as encrypt1ToN40 , } from './crypto-alpha-40' ; import type { AESJsonWebKey , EC_Private_JsonWebKey , EC_Public_JsonWebKey } from '@masknet/shared-base' ; export type PublishedAESKey = { encryptedKey : string ; salt : string ; } ; export type PublishedAESKeyRecordV39OrV38 = { aesKey : PublishedAESKey ; receiverKey : EC_Public_JsonWebKey ; } ; export async function generateOthersAESKeyEncrypted ( version , AESKey , privateKeyECDH , othersPublicKeyECDH ) { const othersPublicKeyECDH_ = othersPublicKeyECDH . map ( ( x , index ) => ( { key : x , name : index . toString ( ) } ) ) ; const othersAESKeyEncrypted = await generateOthersAESKeyEncryptedV40 ( - 40 , AESKey , privateKeyECDH , othersPublicKeyECDH_ ) ; const othersAESKeyEncrypted_ = othersAESKeyEncrypted . map < PublishedAESKeyRecordV39OrV38 > ( ( key ) => ( { aesKey : key . key , receiverKey : othersPublicKeyECDH [ Number . parseInt ( key . name , 10 ) ] , } ) ) ; return othersAESKeyEncrypted_ ; } /**
 * Encrypt 1 to N
 *
 * This function is generally based on encrypt1ToN in crypto-alpha-40
 */ export async function encrypt1ToN ( info ) { const othersPublicKeyECDH = info . othersPublicKeyECDH . map ( ( x , index ) => ( { key : x , name : index . toString ( ) } ) ) ; const { encryptedContent , iv , othersAESKeyEncrypted , ownersAESKeyEncrypted , postAESKey } = await encrypt1ToN40 ( { ... info , othersPublicKeyECDH , version : - 40 , } ) ; const othersAESKeyEncrypted_ = othersAESKeyEncrypted . map ( ( key ) => ( { aesKey : key . key , receiverKey : othersPublicKeyECDH [ Number . parseInt ( key . name , 10 ) ] . key , } ) ) ; return { encryptedContent , iv , version : info . version , ownersAESKeyEncrypted , othersAESKeyEncrypted : othersAESKeyEncrypted_ , postAESKey , } ; } export { encrypt1To1 , decryptMessage1To1 } from './crypto-alpha-40' ; export { decryptMessage1ToNByOther , decryptMessage1ToNByMyself , extractAESKeyInMessage } from './crypto-alpha-40' ; export { encryptWithAES , decryptWithAES } from './crypto-alpha-40' ; export { encryptComment , decryptComment } from './crypto-alpha-40' ; export { typedMessageStringify , typedMessageParse } from './crypto-alpha-40' ;