messages/crypto.go
func AgentSeal(msg, clientPub []byte, agentKey *ecdsa.PrivateKey) ([]byte, error) {
	pubKey, err := ethcrypto.UnmarshalPubkey(clientPub)
	if err != nil {
		return nil, err
	}

	pub := ecies.ImportECDSAPublic(pubKey)
	msgEncrypted, err := ecies.Encrypt(rand.Reader, pub, msg, nil, nil)
	if err != nil {
		return nil, err
	}

	return PackWithSignature(msgEncrypted, agentKey)
}
func AgentSeal(msg, clientPub []byte, agentKey *ecdsa.PrivateKey) ([]byte, error) {
	pubKey, err := ethcrypto.UnmarshalPubkey(clientPub)
	if err != nil {
		return nil, err
	}

	pub := ecies.ImportECDSAPublic(pubKey)
	msgEncrypted, err := ecies.Encrypt(rand.Reader, pub, msg, nil, nil)
	if err != nil {
		return nil, err
	}

	return PackWithSignature(msgEncrypted, agentKey)
}
func AgentSeal ( msg , clientPub [ ] byte , agentKey * ecdsa . PrivateKey ) ( [ ] byte , error ) { pubKey , err := ethcrypto . UnmarshalPubkey ( clientPub ) if err != nil { return nil , err } pub := ecies . ImportECDSAPublic ( pubKey ) msgEncrypted , err := ecies . Encrypt ( rand . Reader , pub , msg , nil , nil ) if err != nil { return nil , err } return PackWithSignature ( msgEncrypted , agentKey ) }
// AgentSeal encrypts message using client's public key and packs with
// agent signature.
AgentSeal encrypts message using client s public key and packs with agent signature .