diff --git a/src/forms/form_static_add.php b/src/forms/form_static_add.php
index a3b17b6..c9e3705 100644
--- a/src/forms/form_static_add.php
+++ b/src/forms/form_static_add.php
@@ -41,6 +41,9 @@
Bitcoin
+
+ 2FA
+
diff --git a/src/forms/static/2fa.php b/src/forms/static/2fa.php
new file mode 100644
index 0000000..4417a4f
--- /dev/null
+++ b/src/forms/static/2fa.php
@@ -0,0 +1,48 @@
+
\ No newline at end of file
diff --git a/src/lib/StaticQrcode/StaticQrcode.php b/src/lib/StaticQrcode/StaticQrcode.php
index 0e1ed6b..dbac7cd 100644
--- a/src/lib/StaticQrcode/StaticQrcode.php
+++ b/src/lib/StaticQrcode/StaticQrcode.php
@@ -332,6 +332,37 @@ class StaticQrcode {
else
$this->requiredFieldsError();
}
+
+ /**
+ * create a qr code of type "2FA"
+ * @string algorithms -> required
+ * @string secret -> required
+ * @string label -> required
+ * @string issuer
+ * otpauth://TYPE/LABEL?PARAMETERS
+ * otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example
+ */
+ public function twofaQrcode($algorithms, $secret, $label, $issuer)
+ {
+ if($algorithms != NULL && $secret != NULL && $label != NULL){
+ $this->sData = 'otpauth://' . $algorithms . '/' . $label . '?secret=' . $secret;
+
+ if (!empty($issuer)) {
+ $this->sData .= '&issuer=' . $issuer;
+ }
+
+ $this->sContent = 'Type: ' . $algorithms . '
'.'Secret: ' . $secret . '
';
+ $this->sContent .= 'Label: ' . rawurldecode($label);
+
+ if (!empty($issuer)) {
+ $this->sContent .= '
Issuer: '. rawurldecode($issuer);
+ }
+
+ $this->addQrcode("2fa");
+ }
+ else
+ $this->requiredFieldsError();
+ }
public function getQrcode($id) {
return $this->qrcode_instance->getQrcode($id);
diff --git a/src/static_qrcode.php b/src/static_qrcode.php
index 5d59c98..35f159b 100644
--- a/src/static_qrcode.php
+++ b/src/static_qrcode.php
@@ -65,6 +65,9 @@ if($_SERVER["REQUEST_METHOD"] === "POST" && !isset($_POST["edit"])) {
case 'bitcoin': $static_qrcode_instance->bitcoinQrcode($_POST['address'], $_POST['amount'], $_POST['label'], $_POST['message']);
break;
+
+ case '2fa': $static_qrcode_instance->twofaQrcode($_POST['algorithms'], $_POST['secret'], rawurlencode($_POST['label']), rawurlencode($_POST['issuer']));
+ break;
}
}
?>