raindrop sdk
1.0.0
แพ็คเกจนี้มีฟังก์ชั่นความสะดวกสบายเพื่อลดความซับซ้อนของการรวมการรับรองความถูกต้องของน้ำฝนของ Hydro ลงในโครงการของคุณ ข้อมูลเพิ่มเติมรวมถึงเอกสาร API โดยละเอียดมีอยู่ในเอกสาร Raindrop
Raindrop มีสองรสชาติ:
Raindrop ฝั่งไคลเอ็นต์เป็นโซลูชัน 2FA รุ่นต่อไป Hydro ได้เปิดแหล่งน้ำฝนฝั่งไคลเอ็นต์ที่ให้พลังงานแก่ไคลเอ็นต์
Raindrop ฝั่งเซิร์ฟเวอร์เป็นโปรโตคอลความปลอดภัยระดับองค์กรเพื่อรักษาความปลอดภัย API และทรัพยากรที่ใช้ร่วมกันอื่น ๆ Hydro ได้เปิดแหล่งน้ำฝนที่มีการเปิดใช้งานรหัสเซิร์ฟเวอร์
composer require adrenth/raindrop-sdk
require __DIR__ . '/../vendor/autoload.php';
$clientId = '...';
$clientSecret = '...';
$applicationId = '...';
$settings = new AdrenthRaindropApiSettings(
$clientId,
$clientSecret,
new AdrenthRaindropEnvironmentSandboxEnvironment
);
// Create token storage for storing the API's access token.
$tokenStorage = new AdrenthRaindropTokenStorageFileTokenStorage(__DIR__ . '/token.txt');
// Ideally create your own TokenStorage adapter.
// The shipped FileTokenStorage is purely an example of how to create your own.
/*
* Client-side calls
*/
$client = new AdrenthRaindropClient($settings, $tokenStorage, $applicationId);
// (Un)register a user by it's Hydro ID
$client->registerUser($hydroId);
$client->unregisterUser($hydroId);
// Generate 6 digit message
$message = $client->generateMessage();
// Verify signature
$client->verifySignature($hydroId, $message);
/*
* Server-side calls
*/
$server = new AdrenthRaindropServer($settings, $tokenStorage);
$server->whitelist('0x..'); // Provide ETH address
$server->challenge('41579b51-c365-406e-86a8-3839fcad576f');
$server->authenticate('41579b51-c365-406e-86a8-3839fcad576f');