v1.4 rel #10

Merged
Lisoveliy merged 5 commits from dev into main 2025-08-08 16:43:07 +02:00
5 changed files with 41 additions and 34 deletions
Showing only changes of commit 08894ee061 - Show all commits

View File

@ -32,11 +32,10 @@ Then press OK, all selected records from Google Authenticator will appear on pag
![Added records from otpauth-migration](image-7.png)
### If you use Proton Authenticator
To add 2FA TOTP records from Proton Authenticator you must go to settings and press "Export":
![alt text](photo_2025-08-08_17-10-27.jpg)
![alt text](photo_2025-08-08_17-10-27.jpg)
After this save file and open it on text editor:

View File

@ -29,10 +29,10 @@ export const content = {
renameButtons: {
rename: "Rename",
renameIssuer: "Rename Issuer",
renameClient: "Rename Client"
renameClient: "Rename Client",
},
saveButton: {
label: "Save"
label: "Save",
},
deleteButton: {
label: "Delete",

View File

@ -14,7 +14,7 @@ export function createTOTPCard({
onMoveDown,
onIssuerChange,
onClientChange,
isEditInProgress
isEditInProgress,
}) {
const infoView = View(
{
@ -40,7 +40,7 @@ export function createTOTPCard({
color: colors.text,
borderRadius: "5px",
height: "40px",
width: "200px"
width: "200px",
},
subStyle: {
display: "none",
@ -60,7 +60,7 @@ export function createTOTPCard({
color: colors.text,
borderRadius: "5px",
height: "40px",
width: "200px"
width: "200px",
},
subStyle: {
display: "none",
@ -109,8 +109,8 @@ export function createTOTPCard({
},
onClick: onRename,
}),
!isEditInProgress ?
Button({
!isEditInProgress
? Button({
label: content.deleteButton.label,
style: {
margin: "5px",
@ -118,7 +118,8 @@ export function createTOTPCard({
color: colors.text,
},
onClick: onDelete,
}): null,
})
: null,
],
);

View File

@ -7,5 +7,5 @@ export class ProtonTotpRecord {
content = {
uri,
entry_type,
}
};
}

View File

@ -6,23 +6,26 @@ import { ProtonBackupExport } from "./protonBackupExport";
const otpauthScheme = "otpauth://";
const googleMigrationScheme = "otpauth-migration://";
export function getTOTPByLink(link) {
try { //proton export
try {
//proton export
const json = JSON.parse(link);
console.log(json)
console.log(json);
return getByProtonBackup(json);
} catch (e) {
if (link.startsWith(googleMigrationScheme)) { //google migration export
if (link.startsWith(googleMigrationScheme)) {
//google migration export
return getByGoogleMigrationScheme(link);
}
if (link.startsWith(otpauthScheme)) {//otpauth export
if (link.startsWith(otpauthScheme)) {
//otpauth export
return getByOtpauthScheme(link);
}
throw new Error(`Unsupported link type. Please use an otpauth:// or otpauth-migration:// link\n ERR: ${e}`);
throw new Error(
`Unsupported link type. Please use an otpauth:// or otpauth-migration:// link\n ERR: ${e}`,
);
}
}
function getHashType(algorithm) {
if (algorithm == "SHA1") return "SHA-1";
if (algorithm == "SHA256") return "SHA-256";
@ -32,17 +35,21 @@ function getHashType(algorithm) {
function getByProtonBackup(protonjson) {
try {
if ("entries" in protonjson && protonjson.version == 1) { //Is proton export?
console.log(1)
const protonBE = Object.assign(new ProtonBackupExport(), protonjson)
const res = protonBE.entries.map(x => {
if ("entries" in protonjson && protonjson.version == 1) {
//Is proton export?
console.log(1);
const protonBE = Object.assign(
new ProtonBackupExport(),
protonjson,
);
const res = protonBE.entries.map((x) => {
return getByOtpauthScheme(x.content.uri);
});
console.log(res)
console.log(res);
return res;
} else throw new Error("use proton export backup with version: 1");
} catch (e) {
console.log(e)
console.log(e);
throw new Error(`Unsupported JSON type: ${e}`);
}
}