Xác thực danh tính giúp đảm bảo các cuộc hội thoại giữa khách hàng và nhân viên hỗ trợ được bảo mật. Nó cũng giúp ngăn chặn mạo danh.
Xác thực danh tính có thể được bật bằng cách tạo HMAC.
Khóa dùng để tạo HMAC cho mỗi web widget khác nhau và có thể sao chép từ Inboxes -> Settings -> Configuration -> Identity Validation -> Sao chép token được hiển thị ở đó.
Bạn có thể tạo HMAC bằng các ngôn ngữ lập trình khác nhau, như được hiển thị bên dưới.
Tạo HMAC
PHP
<?php
$key = '<webwidget-hmac-token>';
$message = '<identifier>';
$identifier_hash = hash_hmac('sha256', $message, $key);
?>
Javascript (Node.js)
const crypto = require('crypto');
const key = '<webwidget-hmac-token>';
const message = '<identifier>';
const hash = crypto.createHmac('sha256', key).update(message).digest('hex');
Ruby
require 'openssl'
require 'base64'
key = '<webwidget-hmac-token>'
message = '<identifier>'
OpenSSL::HMAC.hexdigest('sha256', key, message)
Elixir
key = '<webwidget-hmac-token>'
message = '<identifier>'
signature = :crypto.hmac(:sha256, key, message)
Base.encode16(signature, case: :lower)
Golang
package main
import (
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"encoding/hex"
)
func main() {
secret := []byte("<webwidget-hmac-token>")
message := []byte("<identifier>")
hash := hmac.New(sha256.New, secret)
hash.Write(message)
hex.EncodeToString(hash.Sum(nil))
}
Python
import hashlib
import hmac
import base64
secret = bytes('<webwidget-hmac-token>', 'utf-8')
message = bytes('<identifier>', 'utf-8')
hash = hmac.new(secret, message, hashlib.sha256)
hash.hexdigest()
