starkbank / ecdsa-php

A lightweight and fast PHP ECDSA library
https://starkbank.com
MIT License
82 stars 13 forks source link

signature to string #10

Closed morrning closed 3 years ago

morrning commented 3 years ago

how can i convert signature to string for transfer over webservice

cdottori-stark commented 3 years ago

Hello,

Ideally this should be done using the toBase64 method of the signature object:

$signature = EllipticCurve\Ecdsa::sign($message, $privateKey);
$base64String = $signature1->toBase64();

Then you can reverse rebuild the object from the string using the fromBase64 method:

$signature = EllipticCurve\Signature::fromBase64($base64String);