-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Version 2.0.0 - Secret Key encryption logic (#14)
* Account encryption logic * Clean-up and code organization * Create script to check if all translation files has all the keys present in en.json * Fix crypto api check * Migration infrastructure * Batch update accounts logic * Update version in package.json * firstRun flag
- Loading branch information
Showing
31 changed files
with
1,741 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Check Translations on Pull Request | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
check-translations: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run translations check | ||
run: npm run translations:check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,35 @@ | ||
{ | ||
"typescript.preferences.autoImportFileExcludePatterns": ["@ionic/angular/common", "@ionic/angular/standalone"] | ||
"typescript.preferences.autoImportFileExcludePatterns": [ | ||
"@ionic/angular/common", | ||
"@ionic/angular/standalone" | ||
], | ||
"i18n-ally.localesPaths": [ | ||
"src/assets/i18n", | ||
], | ||
"i18n-ally.keystyle": "nested", | ||
"i18n-ally.keysInUse": [ | ||
"CRYPTO_API_NOT_SUPPORTED", | ||
"ACCOUNT_SELECT_MODAL.DESELECT_ALL", | ||
"ACCOUNT_SELECT_MODAL.SELECT_ALL", | ||
"ADD_ACCOUNT_MODAL.ERROR_MSGS.INVALID_SESSION", | ||
"ACCOUNT_SYNC.ERROR.CORRUPT_BACKUP_FILE", | ||
"ACCOUNT_SYNC.ERROR.EMPTY_FILE", | ||
"ACCOUNT_SYNC.ERROR.GENERIC_IMPORT_ERROR", | ||
"ACCOUNT_SYNC.ERROR.NO_ACCOUNTS_SELECTED_TO_IMPORT", | ||
"CONFIG_MENU.ENCRYPTION_ACTIVE", | ||
"CONFIG_MENU.ENCRYPTION_INACTIVE", | ||
"CRYPTO.ALREADY_DECRYPTED", | ||
"CRYPTO.ALREADY_ENCRYPTED", | ||
"CRYPTO.MISSING_ENCRYPTED_DATA", | ||
"LOGIN.VALIDATION_MSGS.EMAIL_PATTERN", | ||
"LOGIN.VALIDATION_MSGS.REQUIRED_EMAIL", | ||
"LOGIN.VALIDATION_MSGS.REQUIRED_PASSWORD", | ||
"LOGIN.ERROR_MSGS.DEFAULT_ERROR", | ||
"LOGIN.ERROR_MSGS.INVALID_PASSWORD", | ||
"LOGIN.ERROR_MSGS.TOO_MANY_ATTEMPTS_TRY_LATER", | ||
"LOGIN.ERROR_MSGS.USER_NOT_FOUND", | ||
"ACCOUNT_SERVICE.ERROR.ACCOUNT_NOT_FOUND", | ||
"UTILS.ERROR_INVALID_SEMVER_FORMAT" | ||
], | ||
"i18n-ally.sourceLanguage": "en" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
{ | ||
"name": "authleu", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"author": "Leonardo 'Leu' Pereira <[email protected]>", | ||
"homepage": "https://github.com/jlcvp/AuthLeu", | ||
"description": "Open source authenticator and 2fa code generator to use across multiple devices and platforms", | ||
"scripts": { | ||
"ng": "ng", | ||
"start": "ng serve", | ||
"prebuild": "npm run version:config", | ||
"build": "ng build", | ||
"build:githubpages": "ng build --configuration githubpages --base-href ./", | ||
"watch": "ng build --watch --configuration development", | ||
"test": "ng test", | ||
"lint": "ng lint", | ||
"translations:check": "node ./resources/scripts/translations_complete_check.js", | ||
"firebase:deploy:firestore:indexes": "firebase deploy --only firestore:indexes", | ||
"firebase:deploy:hosting": "ng build --prod && firebase deploy --only hosting", | ||
"firebase:deploy:all": "ng build --prod && firebase deploy" | ||
"firebase:deploy:all": "ng build --prod && firebase deploy", | ||
"version:config": "node ./resources/scripts/version-config.js" | ||
}, | ||
"private": true, | ||
"dependencies": { | ||
|
@@ -70,7 +74,7 @@ | |
"karma-coverage": "~2.2.0", | ||
"karma-jasmine": "~5.1.0", | ||
"karma-jasmine-html-reporter": "~2.1.0", | ||
"replace-in-file": "^6.3.5", | ||
"typescript": "~5.4.0" | ||
}, | ||
"description": "An Ionic project" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
const { exit } = require('process'); | ||
|
||
const directoryPath = path.join(__dirname, '../../src/assets/i18n'); | ||
const baseFileName = 'en.json'; | ||
const baseFilePath = path.join(directoryPath, baseFileName); | ||
|
||
function loadJson(filePath) { | ||
return JSON.parse(fs.readFileSync(filePath, 'utf8')); | ||
} | ||
|
||
function compareKeys(baseKeys, targetKeys, prefix = '') { | ||
let success = true; | ||
for (const key of baseKeys) { | ||
if (!targetKeys.includes(key)) { | ||
console.error(`Missing key in target file: ${prefix}${key}`); | ||
success = false | ||
} | ||
} | ||
return success | ||
} | ||
|
||
function getAllKeys(obj, prefix = '') { | ||
return Object.keys(obj).reduce((keys, key) => { | ||
const fullKey = prefix ? `${prefix}.${key}` : key; | ||
if (typeof obj[key] === 'object' && !Array.isArray(obj[key])) { | ||
keys.push(...getAllKeys(obj[key], fullKey)); | ||
} else { | ||
keys.push(fullKey); | ||
} | ||
return keys; | ||
}, []); | ||
} | ||
|
||
const baseFile = loadJson(baseFilePath); | ||
const baseKeys = getAllKeys(baseFile); | ||
|
||
fs.readdir(directoryPath, (err, files) => { | ||
if (err) { | ||
console.log('Unable to scan directory: ' + err); | ||
exit(1); | ||
} | ||
|
||
files.forEach(file => { | ||
if (file !== baseFileName && file.endsWith('.json')) { | ||
const targetFilePath = path.join(directoryPath, file); | ||
const targetFile = loadJson(targetFilePath); | ||
const targetKeys = getAllKeys(targetFile); | ||
|
||
process.stdout.write(`Comparing translation keys in ${baseFileName} with ${file}...`); | ||
const success = compareKeys(baseKeys, targetKeys); | ||
if (!success) { | ||
exit(1); | ||
} | ||
console.log(' OK'); | ||
} | ||
}); | ||
exit(0); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env node | ||
|
||
const replacer = require('replace-in-file') | ||
const package = require('../../package.json') | ||
|
||
const buildDate = new Date().toISOString() | ||
// get git commit hash from GITHUB_SHA environment variable | ||
const commitHash = process.env.GITHUB_SHA || 'unknown' | ||
|
||
const options = { | ||
files: 'src/environments/environment*.ts', | ||
from: [/%VERSION%/g, /%BUILD_DATE%/g, /%COMMIT_HASH%/g], | ||
to: [package.version, buildDate, commitHash], | ||
} | ||
|
||
try { | ||
const changes = replacer.sync(options) | ||
console.log('Modified files:', JSON.stringify(changes, null, 2)) | ||
} catch (error) { | ||
console.error('Error replacing version strings occurred:', error) | ||
} |
19 changes: 15 additions & 4 deletions
19
src/app/components/account-list/account-list.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.