/** * @wharfkit/sealed-messages v1.2.0 * https://github.com/wharfkit/sealed-messages * * @license * Copyright (c) 2023 Greymass Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistribution of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * 2. Redistribution in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors * may be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * * YOU ACKNOWLEDGE THAT THIS SOFTWARE IS NOT DESIGNED, LICENSED OR INTENDED FOR USE * IN THE DESIGN, CONSTRUCTION, OPERATION OR MAINTENANCE OF ANY MILITARY FACILITY. */ import { Struct, PublicKey, UInt64, Bytes, UInt32, Checksum512, PrivateKey } from '@wharfkit/antelope'; declare class SealedMessage extends Struct { from: PublicKey; nonce: UInt64; ciphertext: Bytes; checksum: UInt32; } declare function createSymmetricKey(secret: Checksum512, nonce: UInt64): Uint8Array; declare function createIV(nonce: UInt64, secret: Checksum512): Checksum512; declare function encryptMessage(iv: Checksum512, symmetricKey: Uint8Array, message: string): Bytes; declare function decryptMessage(iv: Checksum512, symmetricKey: Uint8Array, message: Bytes): Uint8Array; /** * Seals a message using AES encryption and a shared secret derived from given keys. * @param message - The message to seal * @param privateKey - The private key to use for encryption * @param publicKey - The public key to use for encryption * @param nonce - A nonce to use for encryption * @returns The sealed message as Bytes */ declare function sealMessage(message: string, privateKey: PrivateKey, publicKey: PublicKey, nonce: UInt64): Bytes; declare function sealedMessagePayload(message: string, privateKey: PrivateKey, publicKey: PublicKey, nonce?: UInt64): SealedMessage; /** * Decrypt a message using AES and shared secret derived from given keys. * @param message - The encrypted message bytes to decrypt * @param privateKey - The private key to use for deriving the shared secret * @param publicKey - The public key to use for deriving the shared secret * @param nonce - The nonce used in the encryption process * @returns The decrypted message as a UTF-8 string * @internal */ declare function unsealMessage(message: Bytes, privateKey: PrivateKey, publicKey: PublicKey, nonce: UInt64): string; export { SealedMessage, createIV, createSymmetricKey, decryptMessage, encryptMessage, sealMessage, sealedMessagePayload, unsealMessage };