Skip to content

@mega-yfue/eufy-sdk / p2pCodec / eciesWrap

Function: eciesWrap() ​

ts
function eciesWrap(
   plaintext, 
   peerPublicKey, 
   options?
): Buffer;

The sealing counterpart of eciesUnwrap with verifyHmac and pkcs7 both set.

Seals plaintext for peerPublicKey (a P-256 point, compressed or uncompressed) as ephemeralPub(33, compressed) ‖ iv(16) ‖ ct ‖ HMAC(32): S = ECDH_X(ephemeral, peer) → kdf = eufyKDF(S) → ct = AES-128-CBC(kdf[0:16], iv, PKCS7(plaintext)), tagged HMAC-SHA256(kdf[16:48], iv ‖ ct).

Parameters ​

plaintext ​

Buffer

peerPublicKey ​

Buffer

options? ​

EciesWrapOptions = {}

Returns ​

Buffer

Independent and unofficial. Not affiliated with, endorsed by, or sponsored by Anker Innovations, Anker eufy, or eufy. "Anker eufy", "eufy" and "Anker" are trademarks of their respective owners. Use responsibly — rapid or failed logins can trigger captcha or temporary cooldowns.