Skip to content

Gun-Vue docs v0.21.4Docs


Gun-Vue docs v0.21.4 / Crypto / encFor

Function: encFor()

encFor(data, sender, receiver): Promise<string>

Encrypts data for one receiver entity.

  1. Generates encryption secret using receiver's epub and sender's pair.
  2. Encrypts data with this secret.

Parameters

data: string

Stringified data to be encrypted.

sender: any

SEA Pair of the sender – epriv key will be used to encrypt the data.

receiver: Entity

An object with pub and epub strings - the user.is object of the receiver's account.

Returns

Promise<string>

  • Encrypted data string to be sent.

Defined in

src/crypto/useCrypto.js:37

MIT