Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce otp formats #27

Open
erdemkeren opened this issue Dec 24, 2021 · 0 comments
Open

Introduce otp formats #27

erdemkeren opened this issue Dec 24, 2021 · 0 comments
Assignees
Labels
feat This issue is about a new feature

Comments

@erdemkeren
Copy link
Owner

As a developer, I want to extend the format used by the OtpService without modifying the existing classes so that I can introduce my custom name, generator, template and, notification as a group.

For example:

use Erdemkeren\Otp\OtpToken;
use \Erdemkeren\Otp\OtpFacade as Otp;
use \Erdemkeren\Otp\GenericFormat;
use App\OtpFormats\AcmeFormat\AcmeFormat;

Otp::addFormat(new AcmeFormat());

// Or on the fly:

Otp::addFormat(new GenericFormat(
    'acme',
    fn(): string => ':generator:',
    fn(OtpToken $otpToken): TokenNotification => new TokenNotification($token),
));
@erdemkeren erdemkeren added the feat This issue is about a new feature label Dec 24, 2021
@erdemkeren erdemkeren self-assigned this Dec 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat This issue is about a new feature
Projects
None yet
Development

No branches or pull requests

1 participant