v1.3 Fix of Google Authenticator migration support #9
14
README.md
14
README.md
@ -1,17 +1,15 @@
|
|||||||
# TOTPFIT
|
# TOTPFIT
|
||||||
### Another 2FAuthenticator based on TOTP for Zepp Amazfit GTS 4
|
### Another 2FAuthenticator based on TOTP for Zepp Amazfit GTS 4 with Google Authenticator migration Support
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Features:
|
### Features:
|
||||||
- Supports of otpauth links with parameters "issuer", "algorithm", "digits", "period"
|
- Supports of otpauth links with parameters "issuer", "algorithm", "digits", "period"
|
||||||
- Addition/Edition/Deletion of TOTPs from mobile settings app
|
- Addition/Edition/Deletion of TOTPs from mobile app
|
||||||
|
- Support of google migration links formated: ```otpauth-migration://offline?data=...```
|
||||||
|
|
||||||
### Google Migration Support:
|
### Guides:
|
||||||
- Support of google migration links formated: ```otpauth-migration://offline?data=...``` (BETA)
|
|
||||||
|
|
||||||
### Screenshots:
|
[How to add 2FA TOTP records (keys) on app](/docs/guides/how-to-add-totps/README.md)
|
||||||
|
|
||||||

|
#### This repo has mirror for issues on [GitHub](https://github.com/Lisoveliy/totpfit)
|
||||||
|
|
||||||

|
|
2
app.json
2
app.json
@ -6,7 +6,7 @@
|
|||||||
"appType": "app",
|
"appType": "app",
|
||||||
"version": {
|
"version": {
|
||||||
"code": 1,
|
"code": 1,
|
||||||
"name": "1.2.2"
|
"name": "1.3"
|
||||||
},
|
},
|
||||||
"icon": "icon.png",
|
"icon": "icon.png",
|
||||||
"vender": "zepp",
|
"vender": "zepp",
|
||||||
|
37
docs/guides/how-to-add-totps/README.md
Normal file
37
docs/guides/how-to-add-totps/README.md
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# How to add 2FA TOTP records (keys) on app
|
||||||
|
|
||||||
|
### If you use default 2FA otpauth:// links
|
||||||
|
|
||||||
|
To add 2FA TOTP records using 2FA TOTP QR-Codes, you must scan QR-Code of service providing 2FA and scan (decode) it to a URI. If you have screenshot of QR-Code -- scan it on any app providing scan from image, ex: Search screen on Google Assistant. For example, this QR-Code will represent next URI string:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Copy this URI string and paste it to app using button *"Add new TOTP record"*:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Then press OK, record will appear on page
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
You can edit your otpauth:// records using button "Change TOTP link". Your previous record will be replaced with a new otpauth:// link entered on text field, and previous link will not be shown on field.
|
||||||
|
|
||||||
|
### If you use google migrations (otpauth-migration:// links)
|
||||||
|
|
||||||
|
To add 2FA TOTP recods using migration from Google Authenticator app, you must go to menu, select "Transfer accounts" -> "Export accounts"
|
||||||
|
|
||||||
|
Select codes then screenshot QR code and and scan (decode) it to a URI. Use any app providing scan from image, ex: "Search screen" function (Google Lens) on Google Assistant.
|
||||||
|
|
||||||
|
For example, this QR-Code will represent next URI string:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
After scaning copy this URI string and paste it to app using button *"Add new TOTP record"*:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Then press OK, all selected records on Google Authenticator will appear on page
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
You can edit your records using button "Change TOTP link". Your previous record will be replaced with a new otpauth:// link entered on text field, and previous link will not be shown on field.
|
BIN
docs/guides/how-to-add-totps/image-2.png
Normal file
BIN
docs/guides/how-to-add-totps/image-2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
BIN
docs/guides/how-to-add-totps/image-4.png
Normal file
BIN
docs/guides/how-to-add-totps/image-4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
docs/guides/how-to-add-totps/image-5.png
Normal file
BIN
docs/guides/how-to-add-totps/image-5.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 448 KiB |
BIN
docs/guides/how-to-add-totps/image-6.png
Normal file
BIN
docs/guides/how-to-add-totps/image-6.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
BIN
docs/guides/how-to-add-totps/image-7.png
Normal file
BIN
docs/guides/how-to-add-totps/image-7.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
BIN
docs/guides/how-to-add-totps/image.png
Normal file
BIN
docs/guides/how-to-add-totps/image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "totpfit",
|
"name": "totpfit",
|
||||||
"version": "1.2.2",
|
"version": "1.3",
|
||||||
"description": "Another 2FAuthenticator based on TOTP for Zepp Amazfit GTS 4",
|
"description": "Another 2FAuthenticator based on TOTP for Zepp Amazfit GTS 4",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"author": "Lisoveliy",
|
"author": "Lisoveliy",
|
||||||
|
@ -2,6 +2,16 @@ import { getTOTPByLink } from "./utils/queryParser.js";
|
|||||||
|
|
||||||
let _props = null;
|
let _props = null;
|
||||||
|
|
||||||
|
const colors = {
|
||||||
|
bg: "#101010",
|
||||||
|
linkBg: "#ffffffc0",
|
||||||
|
secondaryBg: "#282828",
|
||||||
|
text: "#fafafa",
|
||||||
|
alert: "#ad3c23",
|
||||||
|
notify: "#555555",
|
||||||
|
bigText: "#fafafa"
|
||||||
|
};
|
||||||
|
|
||||||
AppSettingsPage({
|
AppSettingsPage({
|
||||||
build(props) {
|
build(props) {
|
||||||
_props = props;
|
_props = props;
|
||||||
@ -9,9 +19,23 @@ AppSettingsPage({
|
|||||||
props.settingsStorage.getItem("TOTPs") ?? "[]"
|
props.settingsStorage.getItem("TOTPs") ?? "[]"
|
||||||
);
|
);
|
||||||
const totpEntrys = GetTOTPList(storage);
|
const totpEntrys = GetTOTPList(storage);
|
||||||
|
const addTOTPsHint = storage.length < 1 ?
|
||||||
|
Text({
|
||||||
|
paragraph: true,
|
||||||
|
align: "center",
|
||||||
|
style: {
|
||||||
|
paddingTop: "10px",
|
||||||
|
marginBottom: "10px",
|
||||||
|
color: colors.text,
|
||||||
|
fontSize: 16,
|
||||||
|
verticalAlign: "middle",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"For add a 2FA TOTP record you must have otpauth:// link or otpauth-migration:// link from Google Authenticator Migration QR-Code"
|
||||||
|
) : null;
|
||||||
const createButton = TextInput({
|
const createButton = TextInput({
|
||||||
placeholder: "otpauth://",
|
placeholder: "otpauth(-migration)://",
|
||||||
label: "Add new OTP Link",
|
label: "Add new TOTP record",
|
||||||
onChange: (changes) => {
|
onChange: (changes) => {
|
||||||
let link = getTOTPByLink(changes);
|
let link = getTOTPByLink(changes);
|
||||||
if (link == null) {
|
if (link == null) {
|
||||||
@ -19,29 +43,32 @@ AppSettingsPage({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Array.isArray(link))
|
if (Array.isArray(link))
|
||||||
storage.push(...link);
|
storage.push(...link);
|
||||||
else storage.push(link);
|
else storage.push(link);
|
||||||
|
|
||||||
updateStorage(storage);
|
updateStorage(storage);
|
||||||
},
|
},
|
||||||
labelStyle: {
|
labelStyle: {
|
||||||
backgroundColor: "#14213D",
|
backgroundColor: colors.notify,
|
||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
margin: "10px",
|
margin: "10px",
|
||||||
flexGrow: 1,
|
|
||||||
fontSize: "20px",
|
fontSize: "20px",
|
||||||
color: "#FFFFFF",
|
color: colors.text,
|
||||||
borderRadius: "5px",
|
borderRadius: "5px",
|
||||||
|
position: storage.length < 1 ? "absolute" : null, //TODO: Сделать что-то с этим кошмаром
|
||||||
|
bottom: storage.length < 1 ? "0px" : null,
|
||||||
|
left: storage.length < 1 ? "0px" : null,
|
||||||
|
right: storage.length < 1 ? "0px" : null
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
var body = Section(
|
var body = Section(
|
||||||
{
|
{
|
||||||
style: {
|
style: {
|
||||||
backgroundColor: "black",
|
backgroundColor: colors.bg,
|
||||||
minHeight: "100vh",
|
minHeight: "100vh",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -52,22 +79,34 @@ AppSettingsPage({
|
|||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Text(
|
storage.length < 1 ? addTOTPsHint : Text(
|
||||||
{
|
{
|
||||||
align: "center",
|
align: "center",
|
||||||
paragraph: true,
|
paragraph: true,
|
||||||
style: {
|
style: {
|
||||||
marginBottom: "10px",
|
marginBottom: "10px",
|
||||||
color: "#fff",
|
color: colors.bigText,
|
||||||
fontSize: 23,
|
fontSize: 23,
|
||||||
|
fontWeight: "500",
|
||||||
verticalAlign: "middle",
|
verticalAlign: "middle",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"TOTPS:"
|
"TOTP records:"
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
...totpEntrys,
|
...totpEntrys,
|
||||||
createButton,
|
createButton,
|
||||||
|
View({
|
||||||
|
style: {
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "center"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Link({
|
||||||
|
source: "https://github.com/Lisoveliy/totpfit/blob/main/docs/guides/how-to-add-totps/README.md"
|
||||||
|
},
|
||||||
|
"Instruction | Report issue (GitHub)")
|
||||||
|
),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
return body;
|
return body;
|
||||||
@ -80,12 +119,12 @@ function GetTOTPList(storage) {
|
|||||||
storage.forEach((element) => {
|
storage.forEach((element) => {
|
||||||
const elementId = counter;
|
const elementId = counter;
|
||||||
const textInput = TextInput({
|
const textInput = TextInput({
|
||||||
placeholder: "otpauth://",
|
placeholder: "otpauth(-migration)://",
|
||||||
label: "Change OTP link",
|
label: "Change TOTP link",
|
||||||
onChange: (changes) => {
|
onChange: (changes) => {
|
||||||
try {
|
try {
|
||||||
let link = getTOTPByLink(changes);
|
let link = getTOTPByLink(changes);
|
||||||
if(Array.isArray(link))
|
if (Array.isArray(link))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
storage[elementId] = link;
|
storage[elementId] = link;
|
||||||
@ -95,7 +134,7 @@ function GetTOTPList(storage) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
labelStyle: {
|
labelStyle: {
|
||||||
backgroundColor: "#14213D",
|
backgroundColor: colors.notify,
|
||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
@ -103,7 +142,7 @@ function GetTOTPList(storage) {
|
|||||||
margin: "10px",
|
margin: "10px",
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
fontSize: "20px",
|
fontSize: "20px",
|
||||||
color: "#E5E5E5",
|
color: colors.text,
|
||||||
borderRadius: "5px",
|
borderRadius: "5px",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -111,8 +150,9 @@ function GetTOTPList(storage) {
|
|||||||
{
|
{
|
||||||
align: "center",
|
align: "center",
|
||||||
style: {
|
style: {
|
||||||
color: "#ffffff",
|
color: colors.text,
|
||||||
fontSize: "16px",
|
fontSize: "18px",
|
||||||
|
fontWeight: "500"
|
||||||
},
|
},
|
||||||
paragraph: true,
|
paragraph: true,
|
||||||
},
|
},
|
||||||
@ -126,29 +166,30 @@ function GetTOTPList(storage) {
|
|||||||
updateStorage(storage);
|
updateStorage(storage);
|
||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
backgroundColor: "#ba181b",
|
backgroundColor: colors.alert,
|
||||||
fontSize: "18px",
|
fontSize: "18px",
|
||||||
color: "#ffffff",
|
color: colors.text,
|
||||||
height: "fit-content",
|
height: "fit-content",
|
||||||
margin: "10px",
|
margin: "10px",
|
||||||
},
|
},
|
||||||
label: "DEL",
|
label: "Delete",
|
||||||
});
|
});
|
||||||
const text = Text(
|
const text = Text(
|
||||||
{
|
{
|
||||||
style: {
|
style: {
|
||||||
color: "#ffffff",
|
color: colors.text,
|
||||||
fontSize: "14px",
|
fontSize: "14px",
|
||||||
},
|
},
|
||||||
align: "center",
|
align: "center",
|
||||||
},
|
},
|
||||||
`${element.hashType} | ${element.digits} digits | ${element.fetchTime} seconds | offset ${element.timeOffset} seconds`
|
`${element.hashType} | ${element.digits} digits | ${element.fetchTime} seconds | ${element.timeOffset} sec offset`
|
||||||
);
|
);
|
||||||
const view = View(
|
const view = View(
|
||||||
{
|
{
|
||||||
style: {
|
style: {
|
||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
border: "2px solid white",
|
backgroundColor: colors.secondaryBg,
|
||||||
|
//border: "2px solid white",
|
||||||
borderRadius: "5px",
|
borderRadius: "5px",
|
||||||
margin: "10px",
|
margin: "10px",
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user