iamxid/iamx-server-wallet
Composer 安装命令:
composer require iamxid/iamx-server-wallet
包简介
IAMX server wallet is a Laravel package to create and manage your IAMX wallet in your laravel application
README 文档
README
IAMX server wallet is a Laravel package to create and manage your IAMX wallet in your laravel application.
Installation
Install the current version of the iamxid/iamx-server-wallet package via composer:
composer require iamxid/iamx-server-wallet:dev-main
Configuration
No configuration needed
Usage
You do receive a UUID and a PIN after completing your KYC process at https://kyc.iamx.id.
To create your server wallet using your KYC data you need to run the following command:
php artisan iamx:create-wallet <UUID> <PIN>
This will create your public and private key file and your encrypted identity data in two subfolders of the application storage folder:
├──storage
├────iamx_wallet
├──────identity # identity.json
├──────keys # private_key.pem and public_key.pem
Just call the command iamx:delete-wallet if you want to delete your server wallet.
php artisan iamx:delete-wallet
Examples
Import the ServerWallet Facade in any controller you like to use the server wallet.
Fetch a defined scope of your identity:
<?php namespace App\Http\Controllers; use IAMXID\IamxServerWallet\Facades\ServerWallet; class TestController extends Controller { public function test() { ServerWallet::setScope(['did' => '', 'person' => [], 'address' => []]); $identityArray = ServerWallet::getScopedIdentity(); dd($identityArray); } }
Encrypt and decrypt data using your iamx server wallet:
<?php namespace App\Http\Controllers; use IAMXID\IamxServerWallet\Facades\ServerWallet; class TestController extends Controller { public function test() { $encrypted = ServerWallet::encrypt('This is a test message'); echo $encrypted."<br><br>"; $decrypted = ServerWallet::decrypt($encrypted); echo $decrypted; } }
Sign and verify data using your iamx server wallet:
<?php namespace App\Http\Controllers; use IAMXID\IamxServerWallet\Facades\ServerWallet; class TestController extends Controller { public function test() { $signature = ServerWallet::sign('This is a test message'); echo $signature."<br>"; $verify = ServerWallet::verify('This is a test message', $signature); if ($verify) { echo "verified"; } else { echo "not verified"; } } }
Bugs and Suggestions
Copyright and License
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-01