التحقق من الهُوِيَّة

التحقق من الهُوِيَّة في بيفاتيل يعزز الأمان عبر التحقق من هويات المستخدمين باستخدام مصادقة قائمة على HMAC، مما يضمن الخصوصية ويمنع التنكر في المحادثات.

التحقق من الهوية في بيفاتيل

تحقق الهوية هو ميزة أمان مهمة تساعد في ضمان خصوصية وأمان المحادثات بين العملاء وموظفي الدعم. من خلال التحقق من هويات الطرفين، يساعد التحقق من الهوية في منع التنكر والوصول غير المصرح به.

إذا كان بإمكان مستخدميك تسجيل الدخول إلى تطبيقك، فإنه دائمًا يُفضل تمكين التحقق من الهوية. يستخدم بيفاتيل تحقق الهُوِيَّة القائم على HMAC، وهو خوارزمية تشفيرية تستخدم مفتاحًا سريًا (الذي يتم توفيره من قبل بيفاتيل) ومعرف فريد لإنشاء رمز. يمكن استخدام هذا الرمز للتحقق من الهُوِيَّة للمستخدم على واجهة الاستخدام.

إنشاء HMAC

لإنشاء HMAC، يجب عليك أولاً الحصول على المفتاح السري الخاص بصندوق الوارد في بيفاتيل. يمكن العثور على المفتاح في الإعدادات > الصناديق الواردة > الإعدادات > التهيئة > التحقق من الهوية.

لاستخدام HMAC في التحقق من الهوية في واجهة الويب الخاصة بك، ستحتاج إلى إنشاء HMAC باستخدام هذا المفتاح. يمكنك إنشاء هذا HMAC باستخدام أي لغة برمجة في الخلفية. معظم اللغات تحتوي على وظائف تشفير مدمجة لإنشاء الرمز، وإذا لم يكن هناك تنفيذات شائعة، يمكن دائمًا العثور على أمثلة لغات البرمجة الشائعة في نهاية هذه الصفحة.

التحقق من HMAC

بمجرد أن تقوم بإنشاء HMAC للهوية باستخدام المفتاح أعلاه، يمكنك استخدام HMAC للتحقق من هوية المرسل. للقيام بذلك، قم بإرسال HMAC جنبًا إلى جنب مع الهوية إلى خادم بيفاتيل الخاص بك عبر مكتبة التطوير البرمجي (SDK).

Verification on the web

window.$bevatel.setUser(`<unique-identifier-key-of-the-user>`, {
  name: "", // Name of the user
  email: "", // Email of the user
  identifier_hash: "<identifier-hash>" // Identifier Hash generated in the previous step
}

إذا كانت (HMAC) متطابقة، يمكنك أن تكون واثقًا من أن الشخص الذي أرسل المعرف مكلف للقيام بذلك. سيظهر جميع المستخدمين غير المتحقق منهم بعلامة تحذير، مشيرة إلى أن هويتهم غير متحققة.

Verification in React Native

You can integrate identity verification in React Native as well.

يمكنك دمج التحقق من الهوية في React Native أيضًا.

const App = () => {
  const user = {
    identifier: "john@gmail.com",
    name: "John Samuel",
    email: "john@gmail.com",
    identifier_hash: "<identifier-hash>",
  };

  return (
    <bevatelWidget
      websiteToken="WEBSITE_TOKEN"
      baseUrl="https://app.bevatel.com"
      isModalVisible={showWidget}
      user={user}
    />
  );
};

تأكيد التحقق

في حال كنت ترغب في فرض التحقق لجميع المستخدمين، يمكنك القيام بذلك عن طريق تمكين خِيار "فرض التحقق من هُوِيَّة المستخدم" في إعدادات صندوق الوارد.

PHP

<?php

// Define your key and message
$key = 'your-secret-token-for-hmac';
$message = 'some-unique-identifier';

// Generate the HMAC
$identifier_hash = hash_hmac('sha256', $message, $key);
?>

Javascript (Node.js)

const crypto = require("crypto");

// Define your key and message
const key = "your-secret-token-for-hmac";
const message = "some-unique-identifier";

// Generate the HMAC
const identifierHash = crypto
  .createHmac("sha256", key)
  .update(message)
  .digest("hex");

Ruby

require 'openssl'

# Define your key and message
key = 'your-secret-token-for-hmac'
message = 'some-unique-identifier'

# Generate the HMAC
identifier_hash = OpenSSL::HMAC.hexdigest('sha256', key, message)

Elixir

# Define your key and message
key = 'your-secret-token-for-hmac'
message = 'some-unique-identifier'

# Generate the HMAC
signature = :crypto.hmac(:sha256, key, message)

identifier_hash = Base.encode16(signature, case: :lower)

Golang

package main

import (
    "crypto/hmac"
    "crypto/sha256"
    "encoding/hex"
    "fmt"
)

func main() {
    // Define your key and message
    key := []byte("your-secret-token-for-hmac")
    message := []byte("some-unique-identifier")

    // Generate the HMAC
    hash := hmac.New(sha256.New, key)
    hash.Write(message)
    identifierHash := hex.EncodeToString(hash.Sum(nil))

    // Print the HMAC
    fmt.Println(identifierHash)
}

Python

import hashlib
import hmac

# Define your key and message
secret = bytes('your-secret-token-for-hmac', 'utf-8')
message = bytes('some-unique-identifier', 'utf-8')

# Generate the HMAC
hash = hmac.new(secret, message, hashlib.sha256)
identifier_hash = hash.hexdigest()

Last updated