Identity Verification
Use identity verification to secure your chat from user impersonation
const { createHmac } = require("node:crypto");
const secret = "GENERATED_IDENTITY_SECRET";
const email = "CHAT_USER_EMAIL";
const secretBytes = Buffer.from(secret, "hex");
const verificationHash = createHmac("sha256", secretBytes)
.update(email)
.digest("hex");import hmac
import hashlib
def sign_message_with_hmac(message, secret):
secret_bytes = bytes.fromhex(secret)
signature = hmac.new(secret_bytes, message.encode(), hashlib.sha256).hexdigest()
return signaturepackage auth
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
)
func SignMessageWithHMAC(message, secret string) (*string, error) {
secretBytes, err := hex.DecodeString(secret)
if err != nil {
return nil, errors.New("unable to decode secret")
}
h := hmac.New(sha256.New, secretBytes)
h.Write([]byte(message))
signature := h.Sum(nil)
signedMsg := hex.EncodeToString(signature)
return &signedMsg, nil
}window.pylon.chat_settings.email_hash = HMAC_HASH
Last updated
Was this helpful?

