nostriphant / nip-01
Nostr NIP-01 implementation in PHP
1.7
2024-11-20 15:52 UTC
Requires
- php: ^8.3
- ext-secp256k1_nostr: *
- nostriphant/functional-alternate: ^1.1
- simplito/elliptic-php: ^1.0
Requires (Dev)
- pestphp/pest: ^2.35
README
Nostr NIP-01 implementation in PHP, currently this contains only the private/public key related code
Key usage
use nostriphant\NIP01\Key;
$private_key = Key::fromHex('435790f13406085d153b10bd9e00a9f977e637f10ce37db5ccfc5d3440c12d6c');
$public_key = $private_key(Key::public());
$hash = hash('sha256', 'Hello World');
$signature = $private_key(Key::signer($hash));
if (Key::verify($public_key, $signature, $hash)) {
echo 'Signature belongs to hash';
}