Closed VityaSchel closed 9 months ago
Under the default configuration, the payload format is:
+-------------------------------+----------+----------+-----------------+
| 65 Bytes | 16 Bytes | 16 Bytes | == data size |
+-------------------------------+----------+----------+-----------------+
| Sender Public Key (ephemeral) | Nonce/IV | Tag/MAC | Encrypted data |
+-------------------------------+----------+----------+-----------------+
| Secp256k1 | AES-256-GCM |
+-------------------------------+---------------------------------------+
UInt8Array
is literally byte array, you can just array.slice(start, end)
. Note that the key derivation is HKDF-SHA256 and symmetric cipher is AES-256-GCM (or XChaCha20-Poly1305 by config), which are different from eccrypto
It turns out they have their own library for managing crypto. Very much thanks for your explanation though!
I'm trying to adapt example from Payselection to use it in browsers, and luckily first part with public key and encryption worked. However, I have no clue how to get encrypted.ciphertext, encrypted.ephemPublicKey, encrypted.iv, encrypted.mac properties because ecies.encrypt methods returns Uint8Array