From 693e1ee965c9a35b9699f109b2912093ed1d4b03 Mon Sep 17 00:00:00 2001 From: smiley Date: Fri, 10 Nov 2017 02:04:23 +0100 Subject: [PATCH] :sparkles: separate authenticator example --- examples/authenticator.php | 27 +++++++++++++++++++++++++++ examples/example.php | 12 ++++-------- 2 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 examples/authenticator.php diff --git a/examples/authenticator.php b/examples/authenticator.php new file mode 100644 index 000000000..fe5fc9a8b --- /dev/null +++ b/examples/authenticator.php @@ -0,0 +1,27 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +require_once '../vendor/autoload.php'; + +use chillerlan\{ + GoogleAuth\Authenticator, + QRCode\QRCode, + QRCode\Output\QRMarkup +}; + +$authenticator = new Authenticator; + +$secret = $authenticator->createSecret(); // -> userdata +$data = $authenticator->getUri($secret, 'label', 'example.com'); + +// markup - svg +echo '
'.(new QRCode($data, new QRMarkup))->output().'
'; + + diff --git a/examples/example.php b/examples/example.php index cd971df9b..9f57525b8 100644 --- a/examples/example.php +++ b/examples/example.php @@ -9,16 +9,12 @@ require_once '../vendor/autoload.php'; -use chillerlan\GoogleAuth\Authenticator; -use chillerlan\QRCode\Output\{QRMarkup, QRMarkupOptions, QRImage, QRString,QRStringOptions}; +use chillerlan\QRCode\Output\{ + QRMarkup, QRMarkupOptions, QRImage, QRString, QRStringOptions +}; use chillerlan\QRCode\QRCode; -#$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; -#$data = 'skype://echo123'; -$authenticator = new Authenticator; - -# otpauth://totp/test?secret=B3JX4VCVJDVNXNZ5&issuer=chillerlan.net -$data = $authenticator->getUri($authenticator->createSecret(), 'test', 'chillerlan.net'); +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; ?>