dev-master
9999999-devA php implementation of Stellar Js SDK's "strkey"
Apache-2.0
The Requires
- christian-riesen/base32 ^1.1@dev
- composer-plugin-api ^1.1
- php >=7.1.0
- pburggraf/crc dev-master
The Development Requires
by Boris Teoharov
A php implementation of Stellar Js SDK's "strkey"
This repo is a 1:1 PHP implementation of the StrKey helper from the Stellar Js SDK, (*1)
See it at: https://github.com/stellar/js-stellar-base/blob/master/src/strkey.js, (*2)
composer require bdteo/php-stellar-strkey
According to the Stellar implementation: the 56 character base32 encoded string key can contain binary data of public key, private key, preAuthTx or a sha256Hash. ( Stellar uses Ed25519 public/private keys - https://ed25519.cr.yp.to/ ), (*3)
You can use this class to validate Stellar addresses., (*4)
You can use this class also to check the validity of a Stellar string key, extract the payload data or encode payload data into a sting key., (*5)
Here is an example:, (*6)
use Bdteo\Stellar\StrKey; $testAddress = 'GDDJ7IIWHZV4KWEX3QH437C3QZL4RTJCSXNVRAQMFESQP6WNZAM4N32Y'; $strKey = new StrKey(); $isValid = $strKey->isValidStellarAddress($testAddress); echo $isValid ? 'Awesome ! The address is valid !' : 'Too bad ! Your address is incorrect !';
I am planning to publish more general purpose crypto tools in the near future !, (*7)
A php implementation of Stellar Js SDK's "strkey"
Apache-2.0