Bitwarden", "Loksi")
builder_config()
# Signature ad hoc sur ce Mac tant qu'il n'y a pas de Developer ID : l'identité vient
# de CSC_NAME, jamais de la recherche amont qui prendrait la première identité
# Apple du trousseau (celle de la Personal Team iOS, par exemple).
after_pack = APP / "scripts/after-pack.js"
text = after_pack.read_text()
start = text.index(" // Only use the Bitwarden Identities on CI\n")
end = text.index(" id = identities[0].id;\n }\n") + len(" id = identities[0].id;\n }\n")
text = (text[:start] + " // Loksi : CSC_NAME quand un Developer ID existera, signature ad hoc sinon.\n"
" id = process.env.CSC_NAME || \"-\";\n" + text[end:])
if text.count("--timestamp") != 4:
raise RuntimeError("after-pack.js : 4 --timestamp attendus")
text = text.replace("--timestamp", "${id === \"-\" ? \"\" : \"--timestamp\"}")
# Fusibles Electron : l'amont ne les pose sur macOS que pour le paquet universel. Le
# paquet arm64 notarisé le 03/10/2026 est sorti sans aucun (RunAsNode actif, intégrité
# asar coupée), vu le 04/10. Loksi les pose aussi sur un paquet d'une seule
# architecture ; les deux moitiés d'un universel restent sans, comme l'amont.
old = "context.packager.platform.nodeName !== \"darwin\" || context.arch === builder.Arch.universal"
if text.count(old) != 1:
raise RuntimeError("after-pack.js : condition des fusibles amont modifiée")
text = text.replace(old, old + " || process.env.LOKSI_MAC_ARCH !== \"universal\"")
old = "resetAdHocDarwinSignature: platform === \"darwin\" && context.arch === builder.Arch.universal,"
if text.count(old) != 1:
raise RuntimeError("after-pack.js : resetAdHocDarwinSignature amont modifié")
text = text.replace(old, "resetAdHocDarwinSignature: platform === \"darwin\",")
write(after_pack, text)
# Entitlements macOS : ceux de l'équipe Apple de Bitwarden retirés, le JIT reste.
plist = APP / "resources/entitlements.mac.plist"
data = plistlib.loads(plist.read_bytes())
if data.pop("com.apple.application-identifier") != TEAM_BITWARDEN + ".com.bitwarden.desktop":
raise RuntimeError("entitlements.mac.plist amont modifié")
data.pop("com.apple.developer.team-identifier")
write_bytes(plist, plistlib.dumps(data))
def builder_config():
"""electron-builder.loksi.json : la config amont, réduite à macOS et Windows."""
config = json.loads((APP / "electron-builder.json").read_text())
for key in ("afterSign", "publish", "mas", "appx", "snap", "deb", "rpm", "appImage",
"linux", "nsisWeb", "portable", "dmg"):
config.pop(key)
config["afterPack"] = "after-pack.loksi.cjs"
config.update(
extraMetadata={"name": CONFIG["executable_name"]}, productName=CONFIG["product_name"],
# Panneau À propos natif de macOS (NSHumanReadableCopyright) et LegalCopyright de
# Loksi.exe : la mention commune, en une ligne.
appId=APP_ID, copyright=MENTION["fr"].replace("\n", " "),
publish=None, protocols=config["protocols"])
# Licence de la police Loksi (OFL) et avis de dérivation, livrés dans les ressources.
shutil.copy2(REPO / "brand/propositions/harmonisation-klepsi/sources/OFL-Raleway.txt",
APP / "resources/OFL-police-Loksi.txt")
touched.add(rel(APP / "resources/OFL-police-Loksi.txt"))
write(APP / "resources/LOKSI-NOTICE.txt",
"Loksi, application de bureau adaptée par Aleop.\n"
"Basée sur Bitwarden clients " + CONFIG["tag"] + " (" + CONFIG["commit"] + ").\n"
"Code amont et adaptations : GPL v3, licences tierces conservées.\n"
"Modifications : identité, serveur à saisir, textes, visuels, identifiants locaux.\n"
"Police Loksi : instances de Raleway renommées, SIL Open Font License 1.1\n"
"(OFL-police-Loksi.txt).\n"
"Ni affiliée ni approuvée par Bitwarden.\n")
notices = [{"from": "resources/OFL-police-Loksi.txt", "to": "OFL-police-Loksi.txt"},
{"from": "resources/LOKSI-NOTICE.txt", "to": "LOKSI-NOTICE.txt"}]
mac = config["mac"]
mac["extraResources"] = list(notices)
config["win"]["extraResources"] = config["win"]["extraResources"] + notices
for key in ("provisioningProfile",):
mac.pop(key)
# Nom du zip avec l'architecture, x64 compris (electron-builder l'omet pour x64).
mac.update(identity="-", target=["zip"], artifactName="${productName}-${version}-${arch}-mac.${ext}")
win = config["win"]
win.pop("signtoolOptions")
# Noms Loksi des exécutables installés. Le binaire construit garde le nom de son
# crate (« from ») ; l'importeur Chromium cherche le sien sous le nouveau nom.
renommes = [f for f in win["extraFiles"] if f.get("to") in WIN_EXE_NOMS]
if len(renommes) != len(WIN_EXE_NOMS):
raise RuntimeError("Point d'adaptation amont modifié : extraFiles Windows")
for fichier in renommes:
fichier["to"] = WIN_EXE_NOMS[fichier["to"]]
# Signature et paquet Store : ajoutés par electron-builder.loksi.cjs, sur variables
# d'environnement seulement. Sans elles, un installateur NSIS non signé.
win.update(target=[{"target": "nsis", "arch": ["x64"]}], signExts=[".dll", ".node"])
config["nsis"] = {
"oneClick": False, "perMachine": False, "allowToChangeInstallationDirectory": False,
"artifactName": "${productName}-Setup-${version}-${arch}.${ext}",
"uninstallDisplayName": "${productName}", "deleteAppDataOnUninstall": True,
"include": "installer.nsh", "installerSidebar": "installerSidebar.bmp",
"uninstallerSidebar": "installerSidebar.bmp",
# makensis 3.13 de brew : des chaînes de langue manquent dans ses fichiers
# de langue, simples avertissements que l'option -WX rendrait bloquants.
"warningsAsErrors": False, "installerLanguages": ["fr_FR", "en_US"],
"multiLanguageInstaller": True,
}
config["appx"] = {
"artifactName": "${productName}-${version}-${arch}.${ext}", "applicationId": "Loksi",
"backgroundColor": "#003087", "displayName": "Loksi",
"languages": ["fr-FR", "en-US"],
}
# Le schéma bitwarden:// reste : retour SSO du bureau (DESKTOP_SSO_CALLBACK), Duo et
# cookie SSO. Vaultwarden 1.37.3 attend ce retour, comme pour les applis mobiles.
config["protocols"] = [{"name": "Loksi", "schemes": ["bitwarden"]}]
write_json(APP / "electron-builder.loksi.json", config)
# L'installateur NSIS d'electron-builder copie l'exe d'installation dans
# %LOCALAPPDATA%\-updater\installer.exe (mises à jour différentielles), et la
# désinstallation ne le retire jamais : 115 Mo laissés sur VSOP-SIG01 le 09/10/2026.
# Loksi n'a pas de canal de mise à jour, le dossier part avec l'appli. Même
# contexte que la copie (installer.nsh d'electron-builder) : utilisateur courant.
replace_once(APP / "installer.nsh", " ${endIf}\n!macroend", f"""\
${{if}} $installMode == "all"
SetShellVarContext current
${{endif}}
RMDir /r "$LOCALAPPDATA\\{UPDATER_DIR}"
${{if}} $installMode == "all"
SetShellVarContext all
${{endif}}
${{endIf}}
!macroend""")
for source, target in (("electron-builder.cjs", "electron-builder.loksi.cjs"),
("after-pack.cjs", "after-pack.loksi.cjs")):
shutil.copy2(ROOT / source, APP / target)
touched.add(rel(APP / target))
# ---------------------------------------------------------------- natif (Rust)
def native_sources():
ipc = NATIVE / "core/src/ipc/mod.rs"
# Tuyaux et sockets propres à Loksi : sans cela l'appli Bitwarden installée sur le
# même poste répondrait aux messages de l'extension Loksi, et inversement.
replace_once(ipc, r'format!(r"\\.\pipe\{hash_b64}.s.{name}").into()',
r'format!(r"\\.\pipe\{hash_b64}.loksi.s.{name}").into()')
replace_once(ipc, 'home.join("Library/Group Containers/' + TEAM_BITWARDEN + '.com.bitwarden.desktop")',
'home.join("Library/Group Containers/' + APP_ID + '")')
replace_once(ipc, 'let path_dir = home.join("com.bitwarden.desktop");',
'let path_dir = home.join("' + APP_ID + '");')
# Agent SSH : socket et dossier Flatpak propres à Loksi (~/.loksi-ssh-agent.sock).
for path, count in (("core/src/ssh_agent/unix.rs", 2), ("ssh_agent/src/server/listener/unix.rs", 2)):
replace_count(NATIVE / path, ".bitwarden-ssh-agent.sock", ".loksi-ssh-agent.sock", count)
replace_once(NATIVE / path, '".var/app/com.bitwarden.desktop/data"', '".var/app/' + APP_ID + '/data"')
# Windows Hello : la clé biométrique a son propre nom dans le coffre d'identifiants.
replace_count(NATIVE / "biometric/src/windows.rs", "BitwardenBiometricsV2", "LoksiBiometricsV2", 2)
# Info.plist incrusté dans le binaire du proxy (embed_plist) : identifiant Loksi.
replace_once(APP / "resources/info.desktop_proxy.plist", "com.bitwarden.desktop",
"" + APP_ID + "")
proxy = NATIVE / "proxy/src/main.rs"
replace_once(proxy, 'path.set_extension("bitwarden.log");', 'path.set_extension("loksi.log");')
replace_once(proxy, 'info!("Starting Bitwarden IPC Proxy.");', 'info!("Starting Loksi IPC Proxy.");')
# Inventaire du 09/10/2026, décision de Romain : plus de « bitwarden » visible hors
# obligation. Variable de l'agent SSH, dossier de données et AAGUID de la passkey
# Windows, tuyau et nom de l'aide à l'import Chromium, clé de préférences macOS.
replace_count(NATIVE / "core/src/ssh_agent/unix.rs", "BITWARDEN_SSH_AUTH_SOCK", "LOKSI_SSH_AUTH_SOCK", 4)
replace_count(NATIVE / "ssh_agent/src/server/listener/unix.rs", "BITWARDEN_SSH_AUTH_SOCK",
"LOKSI_SSH_AUTH_SOCK", 7)
plugin = NATIVE / "windows_plugin_authenticator/src"
replace_once(plugin / "main.rs", 'std::env::var("BITWARDEN_APPDATA_DIR")', 'std::env::var("LOKSI_APPDATA_DIR")')
replace_once(plugin / "main.rs", ' "Bitwarden",\n', ' "Loksi",\n')
replace_once(plugin / "lib.rs", '"' + AAGUID_BITWARDEN + '"', '"' + AAGUID + '"')
importer = NATIVE / "chromium_importer/src/chromium/platform/windows"
replace_once(importer / "abe_config.rs", r"\\.\pipe\bitwarden-to-bitwarden-chromium-importer-helper",
r"\\.\pipe\loksi-chromium-importer-helper")
for amont, loksi in WIN_EXE_NOMS.items():
if "chromium" in amont:
replace_once(importer / "mod.rs", 'const ADMIN_EXE_FILENAME: &str = "' + amont + '";',
'const ADMIN_EXE_FILENAME: &str = "' + loksi + '";')
replace_once(NATIVE / "objc/src/native/chromium_importer/browser_access_manager.m",
'@"com.bitwarden.chromiumImporter.bookmarks"', '@"' + APP_ID + '.chromiumImporter.bookmarks"')
# ---------------------------------------------------------------- processus principal
def main_process():
main = APP / "src/main.ts"
replace_once(main, ' this.desktopCredentialStorageListener = new DesktopCredentialStorageListener(\n'
' "Bitwarden",',
' this.desktopCredentialStorageListener = new DesktopCredentialStorageListener(\n'
' "Loksi",')
replace_once(main, '"bitwarden-appdata"', '"loksi-appdata"')
replace_once(APP / "src/platform/main/desktop-credential-storage-listener.ts",
'if (serviceName == "Bitwarden_biometric") {', 'if (serviceName == "Loksi_biometric") {')
replace_once(APP / "src/key-management/biometrics/os-biometrics-mac.service.ts",
'const SERVICE = "Bitwarden_biometric";', 'const SERVICE = "Loksi_biometric";')
# Pas de mise à jour automatique : le canal amont installerait l'appli Bitwarden.
replace_once(APP / "src/main/updater.main.ts",
" this.canUpdate =\n !this.userDisabledUpdates() &&",
" // Loksi : aucun canal de mise à jour, celui de l'amont installerait Bitwarden.\n"
" this.canUpdate =\n false &&\n !this.userDisabledUpdates() &&")
about = APP / "src/main/menu/menu.about.ts"
replace_once(about, ' "\\nArchitecture " +\n process.arch;',
' "\\nArchitecture " +\n process.arch +\n "\\n\\n" +\n'
' this.localize("loksiBasedOn") +\n "\\n" +\n'
' this.localize("loksiAboutOrigin") +\n "\\n\\n" +\n'
' this.localize("loksiSourceCode");')
# « Version AAAA.M.n (build) » (règle du 06/10/2026). Le numéro de build est posé dans
# le package.json de l'asar par electron-builder.cjs (extraMetadata.loksiBuild).
replace_once(about, 'import { BrowserWindow, clipboard, dialog, MenuItemConstructorOptions } from "electron";\n',
'import * as fs from "fs";\nimport * as path from "path";\n\n'
'import { app, BrowserWindow, clipboard, dialog, MenuItemConstructorOptions } from "electron";\n')
replace_once(about, "export class AboutMenu implements IMenubarMenu {",
"// Loksi : numéro de build du paquet, lu dans le package.json de l'asar.\n"
"function loksiBuild(): string {\n try {\n"
' const file = path.join(app.getAppPath(), "package.json");\n'
' return String(JSON.parse(fs.readFileSync(file, "utf8")).loksiBuild);\n'
' } catch {\n return "?";\n }\n}\n\n'
"export class AboutMenu implements IMenubarMenu {")
replace_once(about, 'this.localize("version", this._version) +',
'this.localize("version", this._version + " (" + loksiBuild() + ")") +')
# En-tête Bitwarden-Client-Version et version cliente du SDK : la version Bitwarden de
# la base de code, pas celle de Loksi. Le serveur décide de fonctionnalités selon elle,
# il doit voir ce que le code sait faire.
replace_once(APP / "src/platform/services/electron-platform-utils.service.ts",
" async getApplicationVersionNumber(): Promise {\n"
" return (await this.getApplicationVersion()).split(/[+|-]/)[0].trim();\n }\n",
" async getApplicationVersionNumber(): Promise {\n"
" // Loksi : version Bitwarden de la base, envoyée au serveur et au SDK.\n"
" return " + json.dumps(BITWARDEN_VERSION) + ";\n }\n")
# Menu Aide : l'aide et la confidentialité de Loksi. Les réseaux, magasins et
# rapports de bogue de Bitwarden sont retirés (brand/README.md).
help_menu = APP / "src/main/menu/menu.help.ts"
replace_once(help_menu, " this.helpAndFeedback,\n this.fileBugReport,\n this.legal,\n"
" this.separator,\n this.followUs,\n this.separator,\n"
" this.goToWebVault,\n this.separator,\n this.getMobileApp,\n"
" this.getBrowserExtension,\n this.separator,\n",
" this.helpAndFeedback,\n this.legal,\n this.contactUs,\n this.separator,\n"
" this.goToWebVault,\n this.separator,\n")
# « Nous contacter », comme les autres clients (demande de Romain du 30/09/2026) :
# confirmation, puis la messagerie sur loksi@aleop.eu.
replace_once(help_menu, 'import { MenuItemConstructorOptions, app } from "electron";',
'import { MenuItemConstructorOptions, app, dialog, shell } from "electron";')
replace_once(help_menu, " private get separator(): MenuItemConstructorOptions {",
" private get contactUs(): MenuItemConstructorOptions {\n return {\n"
' id: "loksiContactUs",\n label: this.localize("loksiContactUs"),\n'
" click: async () => {\n const result = await dialog.showMessageBox({\n"
' type: "question",\n message: this.localize("loksiContactTitle"),\n'
' detail: this.localize("loksiContactBody"),\n'
' buttons: [this.localize("ok"), this.localize("cancel")],\n'
" defaultId: 0,\n cancelId: 1,\n noLink: true,\n });\n"
" if (result.response === 0) {\n"
' void shell.openExternal("mailto:loksi@aleop.eu");\n }\n },\n'
" };\n }\n\n private get separator(): MenuItemConstructorOptions {")
replace_once(help_menu, 'this.shell.openExternal("https://bitwarden.com/help", UrlType.WebUrl)',
'this.shell.openExternal(' + json.dumps(AIDE) + ', UrlType.WebUrl)')
replace_once(help_menu, ' visible: isMacAppStore(),\n submenu: this.legalSubmenu,',
' visible: true || isMacAppStore(),\n submenu: this.legalSubmenu,')
text = help_menu.read_text()
start = text.index(' {\n id: "termsOfService",')
end = text.index(' {\n id: "privacyPolicy",')
write(help_menu, text[:start] + text[end:])
replace_once(help_menu, 'this.shell.openExternal("https://bitwarden.com/privacy/", UrlType.WebUrl)',
'this.shell.openExternal(' + json.dumps(CONFIDENTIALITE) + ', UrlType.WebUrl)')
# Variable de dossier de données (lue aussi par la passkey Windows), partition de
# session Electron, nom du rapport de diagnostic, liens de l'écran d'inscription.
replace_count(main, "BITWARDEN_APPDATA_DIR", "LOKSI_APPDATA_DIR", 2)
replace_once(APP / "src/main/window.main.ts", '"persist:bitwarden"', '"persist:loksi"')
# Barre de menus native de Windows (Fichier, Édition...) masquée, Alt l'affiche :
# demande de Romain du 09/10/2026, vue blanche et hors charte dans l'appli Store. La
# sortie du mode fenêtre réduite (popup-modal-styles) la remettait visible.
replace_once(APP / "src/main/window.main.ts", ' titleBarStyle: isMac() ? "hiddenInset" : undefined,\n',
' titleBarStyle: isMac() ? "hiddenInset" : undefined,\n autoHideMenuBar: true,\n')
replace_once(APP / "src/platform/popup-modal-styles.ts",
" window.setWindowButtonVisibility?.(true);\n window.setMenuBarVisibility?.(true);\n",
" window.setWindowButtonVisibility?.(true);\n window.setMenuBarVisibility?.(false);\n")
replace_count(SOURCE / "libs/logging/src/flight-recorder-export.ts", "Bitwarden-diagnostic-report-",
"Loksi-diagnostic-report-", 2)
inscription = SOURCE / "libs/auth/src/angular/registration/registration-start/registration-start.component.html"
replace_once(inscription, 'href="https://bitwarden.com/terms/"', 'href="' + CONDITIONS + '"')
replace_once(inscription, 'href="https://bitwarden.com/privacy/"', 'href="' + CONFIDENTIALITE + '"')
replace_once(inscription, 'href="https://bitwarden.com/email-preferences"', 'href="' + CONFIDENTIALITE + '"')
# Liens d'aide bitwarden.com/help des écrans (réglages biométrie, création de
# compte, import, etc.) : tous vers l'aide Loksi. 34 dans les sources au 09/10/2026.
motif = re.compile(r"https?://(www\.)?bitwarden\.com/help(/[^\"'`\s)]*)?")
liens = 0
for dossier in (APP / "src", SOURCE / "libs"):
for chemin in sorted(dossier.rglob("*")):
if chemin.suffix not in (".ts", ".html") or ".spec." in chemin.name or ".stories." in chemin.name:
continue
texte = chemin.read_text()
nouveau, n = motif.subn(AIDE, texte)
if n:
write(chemin, nouveau)
liens += n
if liens < 20:
raise RuntimeError(f"Liens d'aide Bitwarden : {liens} trouvés, l'amont a changé")
native_messaging()
def native_messaging():
path = APP / "src/main/native-messaging.main.ts"
# Hôte de messagerie native propre à Loksi, clés de registre et fichiers compris.
replace_count(path, "com.8bit.bitwarden", HOST, 20)
replace_count(path, '"Bitwarden desktop <-> browser bridge"', '"Loksi desktop <-> browser bridge"', 2)
replace_once(path, '"Bitwarden desktop <-> DuckDuckGo bridge"', '"Loksi desktop <-> DuckDuckGo bridge"')
replace_once(path, 'allowed_extensions: ["{446900e4-71c2-419f-a6a7-df9c091e268b}"],',
"allowed_extensions: " + json.dumps(CONFIG["native_messaging"]["firefox_extension_ids"]) + ",")
text = path.read_text()
start = text.index(" const ids: Set = new Set([\n")
end = text.index(" ]);\n", start) + len(" ]);\n")
chrome = ["chrome-extension://" + i + "/" for i in CONFIG["native_messaging"]["chrome_extension_ids"]]
text = text[:start] + " const ids: Set = new Set(" + json.dumps(chrome) + ");\n" + text[end:]
write(path, text)
# L'extension Loksi est chargée non empaquetée : son identifiant Chromium dépend du
# poste. Le balayage des profils que l'amont réserve au développement tourne donc
# toujours, et les extensions Bitwarden officielles sont écartées du résultat.
replace_once(path, " if (!isDev()) {\n return Array.from(ids);\n }\n", "")
replace_once(path, " return Array.from(ids);\n }\n\n private binaryPath() {",
" const bitwarden = " + json.dumps(list(CHROME_BITWARDEN)) + ";\n"
" return Array.from(ids).filter((id) => !bitwarden.some((b) => id.includes(b)));\n"
" }\n\n private binaryPath() {")
# ---------------------------------------------------------------- serveur et connexion
def server_entry():
"""Pas de serveur par défaut ni de choix de région : le client saisit son coffre."""
env = SOURCE / "libs/common/src/platform/services/default-environment.service.ts"
# Sans rien de saisi, un marqueur en .invalid (RFC 6761) qui ne se résout jamais,
# comme les applis mobiles. Les régions Bitwarden restent dans le code, non proposées.
replace_count(env, " if (region == Region.SelfHosted && isEmpty(urls)) {\n region = DEFAULT_REGION;\n }\n",
" if (region == Region.SelfHosted && isEmpty(urls)) {\n"
" urls = { base: " + json.dumps(UNSET) + " };\n }\n", 2)
selector = SOURCE / "libs/angular/src/auth/environment-selector/environment-selector.component"
html = Path(str(selector) + ".html")
if html.read_text().count("toggle(ServerEnvironmentType.SelfHosted)") != 1:
raise RuntimeError("Sélecteur de région amont modifié")
write(html, '
\n
\n'
' {{ "loksiConnectingTo" | i18n }} :\n'
' \n
\n
\n')
ts = Path(str(selector) + ".ts")
replace_once(ts, " private destroy$ = new Subject();\n",
" // Loksi : l'adresse du coffre saisi, rien tant que c'est le marqueur.\n"
" protected loksiHost$: Observable = this.environmentService.globalEnvironment$.pipe(\n"
" map((env) => (env.getUrls().base === " + json.dumps(UNSET) + " ? null : env.getHostname())),\n"
" );\n\n private destroy$ = new Subject();\n")
dialog = SOURCE / "libs/angular/src/auth/self-hosted-env-config-dialog/self-hosted-env-config-dialog.component.ts"
replace_once(dialog, ' baseUrl: urls.base || "",',
' baseUrl: urls.base === ' + json.dumps(UNSET) + ' ? "" : urls.base || "",')
replace_once(Path(str(SOURCE / "libs/angular/src/auth/self-hosted-env-config-dialog/"
"self-hosted-env-config-dialog.component.html")),
" Self-hosted environment",
'{{ "loksiVaultTitle" | i18n }}')
# Pas de création de compte : un compte Loksi est créé par l'administrateur.
secondary = SOURCE / "libs/auth/src/angular/login/login-secondary-content.component.ts"
text = secondary.read_text()
start = text.index(" template: `\n")
end = text.index(" `,\n", start) + len(" `,\n")
write(secondary, text[:start] + ' template: `\n
\n'
' {{ "loksiAccountByAdmin" | i18n }}\n
\n `,\n' + text[end:])
def locales():
for path in sorted((APP / "src/locales").glob("*/messages.json")):
lang = path.parent.name
data = json.loads(path.read_text())
for key, value in data.items():
message = value.get("message", "")
if key in BITWARDEN_GARDE or "bitwarden" not in message.lower():
continue
# « le coffre web de bitwarden.com » devient « le coffre web de Loksi ».
value["message"] = (message.replace("bitwarden.company.com", "loksi.company.com")
.replace("bitwarden.com", "Loksi").replace("Bitwarden", "Loksi"))
# Langues non proposées : quelques « bitwarden » en minuscules, et
# bitwarden.net (nb). Tout reste en Loksi, sans égard à la casse.
value["message"] = re.sub(r"bitwarden(\.(com|net|eu))?", "Loksi", value["message"],
flags=re.IGNORECASE)
for key, text in TEXTES["fr" if lang == "fr" else "en"].items():
if lang in ("en", "fr") or key == "selfHostedBaseUrlHint":
data[key] = {"message": text}
write_json(path, data)
# ---------------------------------------------------------------- charte
def prefixed(drawing, prefix):
"""Identifiants internes d'un SVG préfixés, pour qu'un dessin n'aille pas chercher
ses dégradés ou masques dans un autre de la même page."""
if "`" in drawing or "${" in drawing:
raise RuntimeError("Dessin Loksi inattendu")
drawing = re.sub(r'id="([^"]+)"', lambda m: 'id="' + prefix + m.group(1) + '"', drawing)
return re.sub(r"url\(#([^)]+)\)", lambda m: "url(#" + prefix + m.group(1) + ")", drawing)
def charte():
svgs = SOURCE / "libs/assets/src/svg/svgs"
wordmark = extension.theme_pair(REPO / "brand/sources/loksi-logo-clair.svg",
REPO / "brand/sources/loksi-logo-sombre.svg", "logo")
for name, export in (("bitwarden-logo.icon.ts", "BitwardenLogo"),
("bitwarden-logo-beta.icon.ts", "BitwardenLogoBeta")):
write(svgs / name, 'import { svg } from "../svg";\nexport const ' + export + ' = svg`' + wordmark + '`;\n')
# Logo de la barre latérale, toujours sur le navy de la navigation : le logo sombre.
nav = (REPO / "brand/sources/loksi-logo-sombre.svg").read_text().strip()
nav = re.sub(r'id="([^"]+)"', lambda m: 'id="loksi-nav-' + m.group(1) + '"', nav)
nav = re.sub(r"url\(#([^)]+)\)", lambda m: "url(#loksi-nav-" + m.group(1) + ")", nav)
nav = nav.replace("")]
if corps.count('fill="#0B1120"') != 1:
raise RuntimeError("loksi-icon-mono.svg inattendu")
corps = corps.replace('fill="#0B1120"', 'style="fill: rgb(var(--color-primary-600))"')
gauche = prefixed('", "loksi-fond-")
write(svgs / "background-left-illustration.ts",
'import { svg } from "../svg";\n\nexport const BackgroundLeftIllustration = svg`' + gauche + '`;\n')
write(svgs / "background-right-illustration.ts",
'import { svg } from "../svg";\n\nexport const BackgroundRightIllustration = svg`'
+ extension.illustration("coffre").replace('data-loksi="coffre"', 'data-loksi="fond-coffre"') + '`;\n')
(CACHE / "illustrations-amont.json").write_text(json.dumps(signatures, indent=2) + "\n")
with (APP / "src/scss/styles.scss").open("a") as scss:
scss.write("\n.loksi-illustration-sombre,\n.theme_dark .loksi-illustration-clair {\n"
" display: none;\n}\n\n.theme_dark .loksi-illustration-sombre {\n display: block;\n}\n")
touched.add(rel(APP / "src/scss/styles.scss"))
# Palette de l'extension, mêmes blocs de tw-theme.css.
theme = SOURCE / "libs/components/src/tw-theme.css"
css = theme.read_text()
for block, values in extension.PALETTE.items():
start = css.index("\n" + block + "\n")
end = css.index("\n}\n", start)
body = css[start:end]
for name, value in values.items():
body, count = re.subn(r"(\n " + re.escape(name) + r": )[^;]+;", lambda m: m.group(1) + value + ";", body)
if count != 1:
raise RuntimeError("Couleur amont introuvable : " + block + " " + name)
css = css[:start] + body + css[end:]
write(theme, css)
variables = APP / "src/scss/variables.scss"
replace_once(variables, "$brand-primary: #175ddc;", "$brand-primary: #003087;")
replace_once(variables, " primaryColor: #6f9df1,\n primaryAccentColor: #6f9df1,",
" primaryColor: #009cde,\n primaryAccentColor: #009cde,")
replace_once(variables, '$font-family-sans-serif: Inter, ', '$font-family-sans-serif: Loksi, Inter, ')
# Police : Raleway renommée « Loksi », mêmes fichiers que l'extension.
extension_fonts.CACHE = CACHE / "fonts"
extension_fonts.VENV = CACHE / "fonts-venv"
extension_fonts.PYTHON = extension_fonts.VENV / ("Scripts/python.exe" if WINDOWS_HOST else "bin/python")
extension_fonts.OUT = extension_fonts.CACHE / "out"
extension_fonts.WOFF2 = extension_fonts.CACHE / "woff2"
extension_fonts.main()
webfonts = SOURCE / "libs/components/src/webfonts"
faces = []
for filename, weight, style in (("loksi-400.woff2", 400, "normal"), ("loksi-600.woff2", 600, "normal"),
("loksi-700.woff2", 700, "normal"), ("loksi-400-italic.woff2", 400, "italic")):
shutil.copy2(extension_fonts.WOFF2 / filename, webfonts / filename)
touched.add(rel(webfonts / filename))
faces.append('@font-face {\n font-family: Loksi;\n src: url("~@bitwarden/components/src/webfonts/'
+ filename + '") format("woff2");\n font-display: swap;\n font-weight: '
+ str(weight) + ';\n font-style: ' + style + ';\n}\n')
fonts_css = SOURCE / "libs/components/src/theme.css"
replace_once(fonts_css, " --font-sans:\n Inter, ", " --font-sans:\n Loksi, Inter, ")
replace_once(fonts_css, "/**\n * CSS variables\n */", "".join(faces) + "\n/**\n * CSS variables\n */")
def ico(pngs):
"""Fichier ICO à entrées PNG, lu par Windows depuis Vista."""
entries, blobs = [], []
offset = 6 + 16 * len(pngs)
for size, data in pngs:
entries.append(struct.pack(" process.stdout.write(JSON.stringify({w: info.width, h: info.height,"
" c: info.channels, d: data.toString('base64')})));\n")
out = json.loads(subprocess.run(["node", "-e", code, str(png)], cwd=node, check=True,
capture_output=True, text=True).stdout)
w, h, c, raw = out["w"], out["h"], out["c"], __import__("base64").b64decode(out["d"])
if c != 3:
raise RuntimeError("bandeau : 3 canaux attendus")
stride = (w * 3 + 3) & ~3
rows = []
for y in range(h - 1, -1, -1):
row = bytearray()
for x in range(w):
r, g, b = raw[(y * w + x) * 3:(y * w + x) * 3 + 3]
row += bytes((b, g, r))
rows.append(bytes(row) + b"\0" * (stride - w * 3))
pixels = b"".join(rows)
header = struct.pack("<2sIHHI", b"BM", 54 + len(pixels), 0, 0, 54)
info = struct.pack(" 1:
raise RuntimeError("Plusieurs Developer ID Application de l'équipe Aleop : en garder un seul")
return found[0] if found else None
def notary_profile():
"""Nom du profil notarytool s'il existe dans le trousseau, sinon None. Sa sortie
(liste des envois) n'est jamais affichée."""
name = CONFIG["apple_notary_profile"]["name"]
probe = subprocess.run(["xcrun", "notarytool", "history", "--keychain-profile", name],
capture_output=True, text=True)
return name if probe.returncode == 0 else None
def mac_signing(env):
"""Developer ID et notarisation quand ils existent, signature ad hoc sinon."""
identity = developer_id()
if identity is None:
print("Loksi : pas de Developer ID Application de l'équipe "
+ CONFIG["apple_team"]["id"] + ", signature ad hoc, paquet de test seulement.")
return
env["CSC_NAME"] = identity
profile = notary_profile()
if profile:
env["APPLE_KEYCHAIN_PROFILE"] = profile
print("Loksi : signature Developer ID de l'équipe " + CONFIG["apple_team"]["id"]
+ " et notarisation par le profil " + profile)
elif os.environ.get("LOKSI_SANS_NOTARISATION") == "1":
print("Loksi : signature Developer ID SANS notarisation (LOKSI_SANS_NOTARISATION=1).")
else:
raise RuntimeError("Developer ID présent mais profil notarytool « "
+ CONFIG["apple_notary_profile"]["name"] + " » absent du trousseau. "
"Le créer (README, section Signature) ou poser LOKSI_SANS_NOTARISATION=1")
def check_version(version, build, previous):
"""Règle du 06/10/2026 : AAAA.M.n sans zéro devant, build entier qui monte. Refus."""
refus = []
if not isinstance(version, str) or not VERSION_RE.fullmatch(version):
refus.append(f"version {version!r} : AAAA.M.n attendu, sans zéro devant (2026.10.0)")
if not isinstance(build, int) or isinstance(build, bool) or build <= previous:
refus.append(f"build {build!r} : doit dépasser {previous}, jamais réutilisé")
return refus
def check_client_version(code):
"""Version envoyée au serveur (Bitwarden-Client-Version) et au SDK : la version
Bitwarden de la base, en dur dans getApplicationVersionNumber. Vaultwarden décide de
fonctionnalités selon elle. Refus si une définition de la méthode ne la rend pas."""
refus, found = [], 0
for match in re.finditer(r"getApplicationVersionNumber\(\)(?:: Promise)?\s*\{", code):
found += 1
body = code[match.end():match.end() + 200]
literal = re.search(r'return\s*"([^"]*)"', body)
if "split(" in body or not literal or literal.group(1) != BITWARDEN_VERSION:
refus.append("getApplicationVersionNumber ne rend pas " + BITWARDEN_VERSION + " : "
+ " ".join(body.split())[:90])
if not found:
refus.append("getApplicationVersionNumber introuvable")
return refus
def next_build():
"""Monte le compteur de build d'upstream.json et l'écrit. Le numéro part du plus
grand entre ce fichier et origin/main, pour qu'une branche ne reprenne pas un numéro
déjà livré depuis une autre. Un build qui échoue garde son numéro consommé."""
current = CONFIG["app_version"]["build"]
main = subprocess.run(["git", "show", "origin/main:desktop/upstream.json"], cwd=REPO,
capture_output=True, text=True)
on_main = json.loads(main.stdout)["app_version"].get("build", 0) if main.returncode == 0 else 0
previous = max(current, on_main)
number = previous + 1
refus = check_version(VERSION, number, previous)
if refus:
raise RuntimeError("Numérotation : " + " ; ".join(refus))
path = ROOT / "upstream.json"
text, count = re.subn(r'("build": )\d+', lambda m: m.group(1) + str(number), path.read_text())
if count != 1:
raise RuntimeError("upstream.json : un seul champ build attendu")
path.write_text(text)
CONFIG["app_version"]["build"] = number
print(f"Loksi {VERSION}, build {previous} vers {number} (upstream.json, à commiter)")
return number
def dist_dir(platform, arch="arm64"):
"""dist/mac pour arm64 (comme avant), dist/mac-x64 et dist/mac-universal sinon."""
return DIST / (platform if platform == "win" or arch == "arm64" else platform + "-" + arch)
def build(platform, arch="arm64"):
if platform not in ("mac", "win") or arch not in MAC_ARCHS:
raise ValueError("Plateforme : mac [arm64|x64|universal] ou win")
changes()
number = next_build()
native(platform, arch)
webpack()
env = dict(tool_env(), CSC_IDENTITY_AUTO_DISCOVERY="false", LOKSI_MAC_ARCH=arch,
LOKSI_BUILD=str(number), LOKSI_VERSION=VERSION)
if platform == "win":
if not WINDOWS_HOST:
env["ELECTRON_BUILDER_NSIS_DIR"] = str(nsis_dir())
else:
mac_signing(env)
target = ["--mac", "--" + arch] if platform == "mac" else ["--win", "--x64"]
out = APP / "dist"
if out.exists():
shutil.rmtree(out)
run(["node", SOURCE / "node_modules/electron-builder/cli.js", "--config", "electron-builder.loksi.cjs",
*target, "-p", "never"], cwd=APP, env=env)
target_dir = dist_dir(platform, arch)
if target_dir.exists():
shutil.rmtree(target_dir)
target_dir.mkdir(parents=True)
for item in out.iterdir():
if item.is_dir() and item.name.endswith("-unpacked") or item.name.startswith("mac"):
shutil.copytree(item, target_dir / item.name, symlinks=True)
elif item.suffix in (".zip", ".exe", ".appx"):
shutil.copy2(item, target_dir / item.name)
verify(platform, arch)
run([sys.executable, ROOT / "dependencies.py", platform] + ([arch] if platform == "mac" else []))
def asar_files(asar):
work = Path(tempfile.mkdtemp(prefix="loksi-asar-"))
run(["node", SOURCE / "node_modules/@electron/asar/bin/asar.js", "extract", asar, work])
return work
def check_source(messages, where):
"""Ligne « Code source » d'À propos : l'adresse de la source GPL publique."""
message = messages.get("loksiSourceCode", {}).get("message", "")
if not message.endswith(SOURCE_GPL):
raise AssertionError(where + " : Code source absent d'À propos")
def check_texts(messages, where):
restes = [k for k, v in messages.items()
if "bitwarden" in v.get("message", "").lower() and k not in BITWARDEN_GARDE]
if restes:
raise AssertionError(where + " : Bitwarden dans " + ", ".join(restes[:8]))
def check_renderer(bundle):
signatures = json.loads((CACHE / "illustrations-amont.json").read_text())
for export, signature in signatures.items():
if signature in bundle:
raise AssertionError("Illustration Bitwarden : " + export)
# Le bureau n'importe qu'une partie des illustrations, le reste est élagué : aucune
# signature amont ne doit rester, et ces trois dessins-là doivent être présents.
for name in ("logo", "nav", "verrou", "icone", "fond", "fond-coffre"):
if 'data-loksi="' + name + '"' not in bundle:
raise AssertionError("Dessin Loksi absent : " + name)
return sorted({name for _, name in extension.ILLUSTRATION_TABLE.values()
if 'data-loksi="' + name + '"' in bundle})
def macho_archs(path):
"""Architectures d'un fichier Mach-O selon lipo, None si ce n'en est pas un."""
with open(path, "rb") as handle:
magic = handle.read(4)
if magic not in (b"\xcf\xfa\xed\xfe", b"\xce\xfa\xed\xfe", b"\xca\xfe\xba\xbe", b"\xca\xfe\xba\xbf"):
return None
out = subprocess.run(["lipo", "-archs", str(path)], capture_output=True, text=True)
if out.returncode != 0:
return None # 0xcafebabe d'une classe Java, par exemple
return set(out.stdout.split())
def check_archs(app, arch):
"""Chaque binaire Mach-O du paquet porte toutes les architectures demandées.
Exception, celle de l'amont (singleArchFiles, x64ArchFiles) : les modules napi sont un
fichier par architecture, desktop_napi.darwin-.node. Chacun doit porter
l'architecture de son nom, et il en faut un pour chaque architecture demandée.
Retourne le nombre de binaires vus et la liste des refus.
"""
wanted = MAC_ARCHS[arch]["lipo"]
refus, seen, napi = [], 0, set()
for path in sorted(Path(app).rglob("*")):
if path.is_symlink() or not path.is_file():
continue
archs = macho_archs(path)
if archs is None:
continue
seen += 1
name = str(path.relative_to(app))
match = re.fullmatch(r"desktop_napi\.darwin-(arm64|x64)\.node", path.name)
if match:
if archs != {NAPI_LIPO[match.group(1)]}:
refus.append(name + " : " + " ".join(sorted(archs)) + " au lieu de " + NAPI_LIPO[match.group(1)])
napi |= archs
elif not wanted <= archs:
refus.append(name + " : " + " ".join(sorted(archs)) + ", manque " + " ".join(sorted(wanted - archs)))
for missing in sorted(wanted - napi):
refus.append("module napi absent pour " + missing)
return seen, refus
def check_fuses(framework):
"""Fusibles Electron posés dans chaque tranche de Electron Framework. Liste des refus."""
refus, start, found = [], 0, 0
while (index := framework.find(FUSE_SENTINEL, start)) >= 0:
found += 1
wire = framework[index + len(FUSE_SENTINEL) + 2:index + len(FUSE_SENTINEL) + 2 + framework[index + len(FUSE_SENTINEL) + 1]]
for position, expected in FUSES.items():
if wire[position:position + 1].decode() != expected:
refus.append(f"tranche {found} : fusible {position} à {wire[position:position + 1].decode()!r}, "
f"attendu {expected!r} (fil {wire.decode()})")
start = index + 1
if not found:
refus.append("fil de fusibles introuvable")
return found, refus
def file_version(exe):
"""Valeur de la chaîne FileVersion de la ressource de version, ou None.
Chercher « AAAA.M.n.build » n'importe où dans l'exe ne suffit pas : sous Windows
natif, ProductVersion la portait et FileVersion valait « 3 », le contrôle passait
(vu le 09/10/2026). Structure String de VS_VERSIONINFO : wLength, wValueLength
(en caractères, zéro final compris), wType, la clé en UTF-16 terminée par zéro,
alignement sur 4 octets depuis le début de la structure, puis la valeur.
"""
key = "FileVersion\0".encode("utf-16-le")
at = exe.find(key)
while at >= 6:
start = at - 6
length, chars, kind = struct.unpack_from("= 6 + len(key):
offset = start + ((6 + len(key) + 3) & ~3)
return exe[offset:offset + 2 * chars].decode("utf-16-le", "replace").rstrip("\0")
at = exe.find(key, at + 2)
return None
def verify(platform, arch="arm64"):
target = dist_dir(platform, arch)
if platform == "mac":
app = next(target.glob("mac*/Loksi.app"))
seen, refus = check_archs(app, arch)
assert not refus, "architectures : " + " ; ".join(refus[:8])
print(f"Architectures : {seen} binaires Mach-O, tous {'+'.join(sorted(MAC_ARCHS[arch]['lipo']))}")
slices, refus = check_fuses((app / "Contents/Frameworks/Electron Framework.framework/Versions/A/"
"Electron Framework").read_bytes())
assert not refus, "fusibles Electron : " + " ; ".join(refus)
print(f"Fusibles Electron posés dans {slices} tranche(s)")
info = plistlib.loads((app / "Contents/Info.plist").read_bytes())
assert info["CFBundleIdentifier"] == APP_ID, info["CFBundleIdentifier"]
assert info["CFBundleName"] == "Loksi" and info["CFBundleExecutable"] == "Loksi"
# Le build se lit dans le paquet : un autre build a pu monter le compteur depuis.
assert info["CFBundleShortVersionString"] == VERSION, "version : " + info["CFBundleShortVersionString"]
assert info["CFBundleVersion"].isdigit(), "CFBundleVersion : " + info["CFBundleVersion"]
build_number = int(info["CFBundleVersion"])
assert info["NSHumanReadableCopyright"] == MENTION["fr"].replace("\n", " "), "mention du panneau À propos"
signature = subprocess.run(["codesign", "-d", "--entitlements", "-", "--xml", str(app)],
capture_output=True).stdout.decode(errors="replace")
assert TEAM_BITWARDEN not in signature and "application-identifier" not in signature, "entitlements"
subprocess.run(["codesign", "--verify", "--deep", "--strict", str(app)], check=True)
for lipo in sorted(MAC_ARCHS[arch]["lipo"]):
# Signature de chaque tranche, celle que vérifiera un Mac de cette architecture.
subprocess.run(["codesign", "--verify", "--deep", "--strict", "--arch", lipo, str(app)], check=True)
details = subprocess.run(["codesign", "-dv", "--verbose=2", str(app)],
capture_output=True, text=True).stderr
team = re.search(r"^TeamIdentifier=(.*)$", details, re.M).group(1)
if team == "not set":
print("Signature ad hoc : paquet de test, refusé par Gatekeeper hors de ce Mac.")
else:
assert team == CONFIG["apple_team"]["id"], "équipe de signature inattendue : " + team
assert "Developer ID Application" in details, "pas un certificat Developer ID"
assert "runtime" in details, "hardened runtime absent"
proxy_team = subprocess.run(["codesign", "-dv", str(app / "Contents/MacOS/desktop_proxy")],
capture_output=True, text=True).stderr
assert "TeamIdentifier=" + team in proxy_team, "desktop_proxy pas signé par l'équipe"
gatekeeper = subprocess.run(["spctl", "-a", "-t", "exec", "-vv", str(app)],
capture_output=True, text=True)
if "source=Notarized Developer ID" in gatekeeper.stderr:
subprocess.run(["xcrun", "stapler", "validate", str(app)], check=True)
print("Signature Developer ID " + team + ", notarisée et agrafée, acceptée par Gatekeeper.")
else:
assert os.environ.get("LOKSI_SANS_NOTARISATION") == "1", \
"Gatekeeper refuse le paquet : " + gatekeeper.stderr.strip()[:200]
print("Signature Developer ID " + team + " sans notarisation : Gatekeeper refusera.")
# codesign --verify accepte une appli que dyld refuse ensuite de lancer (vu le
# 30/09/2026 avec le hardened runtime) : on la lance vraiment, 10 secondes, dans
# l'architecture de ce Mac. La tranche x86_64 n'est lancée nulle part ici : pas de
# Rosetta sur ce Mac, décision de Romain du 04/10/2026.
host = platform_machine()
if host not in MAC_ARCHS[arch]["lipo"]:
print(f"Lancement : non fait, paquet {arch} et ce Mac est {host} sans Rosetta.")
else:
# Dossier de données à part (LOKSI_APPDATA_DIR, lu par main.ts) : le
# Loksi installé et ouvert sur ce Mac fait sinon quitter cette seconde instance
# (verrou d'instance unique, vu le 03/10 puis le 06/10), et le test lisait ses
# vraies données.
appdata = tempfile.mkdtemp(prefix="loksi-verify-")
process = subprocess.Popen(["arch", "-" + host, str(app / "Contents/MacOS/Loksi")],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
env=dict(os.environ, LOKSI_APPDATA_DIR=appdata))
try:
process.wait(10)
raise AssertionError("Loksi s'arrête au lancement : "
+ process.stdout.read().decode(errors="replace")[:400])
except subprocess.TimeoutExpired:
process.terminate()
try:
process.wait(10)
except subprocess.TimeoutExpired:
# Paquet universel du 04/10 : toujours là 10 s après SIGTERM.
process.kill()
process.wait(10)
print(f"Lancement : Loksi tient 10 s en {host}, données dans {appdata}.")
finally:
shutil.rmtree(appdata, ignore_errors=True)
resources = app / "Contents/Resources"
proxy = (app / "Contents/MacOS/desktop_proxy").read_bytes()
napi = b"".join(p.read_bytes() for p in (resources / "app.asar.unpacked").rglob("desktop_napi.darwin-*.node"))
assert napi, "module napi absent"
icon = (resources / "icon.icns").read_bytes()
else:
unpacked = target / "win-unpacked"
resources = unpacked / "resources"
exe = (unpacked / "Loksi.exe").read_bytes()
assert MENTION["fr"].replace("\n", " ").encode("utf-16-le") in exe, "LegalCopyright de Loksi.exe"
for text in ("Loksi", "Aleop"):
assert ("CompanyName\0" if text == "Aleop" else "ProductName\0").encode("utf-16-le") in exe
assert text.encode("utf-16-le") in exe, "métadonnées de Loksi.exe : " + text
assert "GitHub, Inc.".encode("utf-16-le") not in exe, "métadonnées Electron dans Loksi.exe"
build_number = None # lu dans l'asar plus bas, puis cherché dans Loksi.exe
assert list(target.glob("Loksi-Setup-*-x64.exe")), "installateur NSIS absent"
assert f'RMDir /r "$LOCALAPPDATA\\{UPDATER_DIR}"' in (APP / "installer.nsh").read_text(), \
"désinstallation : cache " + UPDATER_DIR + " non retiré"
proxy = (unpacked / "desktop_proxy.exe").read_bytes()
napi = next((resources / "app.asar.unpacked").rglob("desktop_napi.win32-x64*.node")).read_bytes()
assert b"LoksiBiometricsV2" in napi.replace(b"\0", b""), "clé Windows Hello"
config = json.loads((resources / "plugin_authenticator_config.json").read_text())
assert config == {"clsid": CONFIG["windows_plugin_authenticator_clsid"], "name": "Loksi"}
# Inventaire du 09/10/2026 : exécutables installés sous leur nom Loksi, plus
# aucun bitwarden_*.exe ; AAGUID, dossier de données et tuyau de l'importeur.
restes = sorted(p.name for p in unpacked.rglob("*") if p.is_file() and p.name.lower().startswith("bitwarden"))
assert not restes, "fichiers Bitwarden dans le paquet : " + ", ".join(restes[:6])
for nom in WIN_EXE_NOMS.values():
assert (unpacked / nom).is_file(), nom + " absent"
plugin = (unpacked / WIN_EXE_NOMS["bitwarden_plugin_authenticator.exe"]).read_bytes()
# L'AAGUID est dans le napi, qui inscrit la passkey (relevé sur le build du 03/10).
assert AAGUID.encode() in napi and AAGUID_BITWARDEN.encode() not in napi, "AAGUID de la passkey"
assert b"LOKSI_APPDATA_DIR" in plugin and b"BITWARDEN_APPDATA_DIR" not in plugin, "dossier de la passkey"
helper = (unpacked / WIN_EXE_NOMS["bitwarden_chromium_import_helper.exe"]).read_bytes()
for binary, name in ((helper, "aide à l'import"), (napi, "napi")):
assert b"bitwarden-to-bitwarden" not in binary, name + " : tuyau de l'importeur Chromium"
assert b"loksi-chromium-importer-helper" in binary, name + " : tuyau Loksi absent"
icon = None
for binary, name in ((proxy, "proxy"), (napi, "napi")):
assert b"com.bitwarden.desktop" not in binary, name + " : chemin IPC Bitwarden"
assert b"BITWARDEN_SSH_AUTH_SOCK" not in napi, "napi : variable de l'agent SSH"
assert b"com.bitwarden.chromiumImporter" not in napi, "napi : préférences de l'importeur"
if platform == "mac":
assert APP_ID.encode() in proxy, "proxy : chemin IPC Loksi absent"
with tarfile.open(ARCHIVE) as tar:
upstream = tar.extractfile(tar.getmember(SOURCE.name + "/apps/desktop/resources/icon.icns")).read()
assert icon != upstream, "icône Bitwarden"
for name in ("OFL-police-Loksi.txt", "LOKSI-NOTICE.txt"):
assert (resources / name).is_file(), name + " absent du paquet"
work = asar_files(resources / "app.asar")
try:
package = json.loads((work / "package.json").read_text())
assert package["productName"] == "Loksi" and package["name"] == CONFIG["executable_name"]
if build_number is None:
build_number = package.get("loksiBuild")
assert file_version(exe) == VERSION + "." + str(build_number), "FileVersion de Loksi.exe"
refus = check_version(package["version"], package.get("loksiBuild"), 0)
assert not refus, "numérotation : " + " ; ".join(refus)
assert package["version"] == VERSION and package["loksiBuild"] == build_number, "version de l'asar"
assert build_number <= CONFIG["app_version"]["build"], "build au-delà du compteur d'upstream.json"
print(f"Numérotation : version {VERSION}, build {build_number}")
main = (work / "main.js").read_text()
assert HOST in main and "com.8bit.bitwarden" not in main, "hôte de messagerie native"
for ident in CONFIG["native_messaging"]["chrome_extension_ids"]:
assert "chrome-extension://" + ident + "/" in main, "extension Chromium admise : " + ident
for ident in CONFIG["native_messaging"]["firefox_extension_ids"]:
assert json.dumps(ident) in main, "extension Firefox admise : " + ident
assert "Loksi_biometric" in main and "Bitwarden_biometric" not in main, "trousseau"
assert "artifacts.bitwarden.com" not in main, "canal de mise à jour"
assert "bitwarden.com/help" not in main and AIDE in main, "menu Aide"
# Décision du 03/10/2026 : support@ n'accepte que les clients connus.
assert "mailto:loksi@aleop.eu" in main and "support@aleop.eu" not in main, "Nous contacter"
assert "loksiBuild" in main and "loksiBasedOn" in main, "À propos : build et base Bitwarden"
assert 'this.localize("loksiSourceCode")' in main, "À propos : ligne Code source"
assert "LOKSI_APPDATA_DIR" in main and "BITWARDEN_APPDATA_DIR" not in main, "variable du dossier de données"
assert '"persist:loksi"' in main and "persist:bitwarden" not in main, "partition de session"
assert "autoHideMenuBar: true" in main, "barre de menus masquée"
assert not re.search(r"setMenuBarVisibility\)[^;]{0,80}call\(window, true\)", main), \
"barre de menus réaffichée en sortie de fenêtre réduite"
# Schéma bitwarden:// gardé, obligatoire : Vaultwarden 1.37.3 impose
# bitwarden://sso-callback aux clients desktop et mobile (src/sso.rs:198), et le
# coffre web renvoie le Duo du bureau sur bitwarden://duo-callback
# (apps/web/src/connectors/duo-redirect.ts:4). Inventaire du 09/10/2026.
assert 'setAsDefaultProtocolClient("bitwarden"' in main, "schéma de retour SSO et Duo"
renderer = "".join(p.read_text() for p in (work / "app").glob("*.js"))
refus = check_client_version(renderer)
assert not refus, "version envoyée au serveur : " + " ; ".join(refus)
assert UNSET in renderer and UNSET in main, "marqueur adresse à saisir"
assert "loksi.aleop.eu" not in renderer + main, "adresse du coffre d'Aleop"
assert "Bitwarden-diagnostic-report" not in renderer + main, "rapport de diagnostic"
for lien in ("bitwarden.com/terms", "bitwarden.com/privacy", "bitwarden.com/email-preferences",
"bitwarden.com/help"):
assert lien not in renderer, "lien " + lien
print("Illustrations Loksi dans le bundle :", ", ".join(check_renderer(renderer)))
css = "".join(p.read_text() for p in (work / "app").glob("*.css")).replace(" ", "")
assert "--color-brand-700:#003087" in css and "--color-brand-700:#175ddc" not in css, "palette"
assert "font-family:Loksi" in css or "Loksi,Inter" in css, "police"
assert list((work / "app").rglob("loksi-400*.woff2")) or list(work.rglob("loksi-400*.woff2")), "police"
for chemin in sorted((work / "locales").glob("*/messages.json")):
check_texts(json.loads(chemin.read_text()), chemin.parent.name)
for lang in ("en", "fr"):
messages = json.loads((work / "locales" / lang / "messages.json").read_text())
assert messages["loksiAboutOrigin"]["message"] == MENTION[lang], "mention d'origine " + lang
assert messages["loksiBasedOn"]["message"].endswith("Bitwarden " + BITWARDEN_VERSION), "base " + lang
check_source(messages, lang)
assert "Loksi" in (work / "index.html").read_text()
finally:
shutil.rmtree(work)
print(f"Vérifications réussies : {target}")
def canari_archs():
"""Mini paquet : un exécutable arm64 seul et un napi mal nommé doivent être refusés
pour x64 et universal, un exécutable universel accepté."""
work = Path(tempfile.mkdtemp(prefix="loksi-canari-archs-"))
try:
source = work / "main.c"
source.write_text("int main(void) { return 0; }\n")
macos = work / "Canari.app/Contents/MacOS"
napi = work / "Canari.app/Contents/Resources/app.asar.unpacked"
macos.mkdir(parents=True)
napi.mkdir(parents=True)
run(["cc", "-arch", "arm64", "-o", macos / "arm64-seul", source])
run(["cc", "-arch", "arm64", "-arch", "x86_64", "-o", macos / "universel", source])
run(["cc", "-arch", "arm64", "-o", napi / "desktop_napi.darwin-x64.node", source])
seen, refus = check_archs(work / "Canari.app", "x64")
ok = (seen == 3 and any("arm64-seul" in r for r in refus) and not any("universel" in r for r in refus)
and any("desktop_napi.darwin-x64.node : arm64 au lieu de x86_64" in r for r in refus))
print("canari architectures", "OK, refus attendus :" if ok else "RATÉ :", " ; ".join(refus))
(macos / "arm64-seul").unlink()
(napi / "desktop_napi.darwin-x64.node").unlink()
run(["cc", "-arch", "x86_64", "-o", napi / "desktop_napi.darwin-x64.node", source])
seen, refus = check_archs(work / "Canari.app", "x64")
print("témoin architectures", "OK, accepté" if not refus else "RATÉ : " + " ; ".join(refus))
return ok and not refus
finally:
shutil.rmtree(work)
def canari():
"""Les contrôles doivent refuser l'amont, sinon un contrôle muet passerait pour vert."""
ratés = []
# Fil de fusibles d'un Electron non modifié (relevé dans le paquet arm64 du 03/10),
# puis celui que pose after-pack.js amont.
found, refus = check_fuses(b"x" + FUSE_SENTINEL + b"\x01\x09101100011" + b"y")
print("canari fusibles", "OK, refus attendu :" if refus else "RATÉ", " ; ".join(refus[:2]))
if not refus:
ratés.append("fusibles")
if check_fuses(FUSE_SENTINEL + b"\x01\x09010011011")[1] or check_fuses(b"rien")[0]:
ratés.append("fusibles (témoin)")
if not canari_archs():
ratés.append("architectures")
# Numérotation : un zéro devant et un build qui ne monte pas doivent être refusés.
for version, build, previous in (("2026.09.01", 8, 7), ("2026.10.0", 7, 7), ("2026.10.00", 8, 7)):
refus = check_version(version, build, previous)
print(f"canari numérotation {version} build {build} après {previous}",
"OK, refus attendu : " + " ; ".join(refus) if refus else "RATÉ, accepté")
if not refus:
ratés.append("numérotation " + version)
if check_version("2026.10.0", 8, 7) or check_version("2026.11.12", 9, 8):
ratés.append("numérotation (témoin)")
# En-tête Bitwarden-Client-Version : le code amont (version dérivée de celle de l'appli)
# et un bundle qui rendrait la version Loksi doivent être refusés.
with tarfile.open(ARCHIVE) as tar:
amont = tar.extractfile(SOURCE.name + "/apps/desktop/src/platform/services/"
"electron-platform-utils.service.ts").read().decode()
for name, code in (("amont", amont),
("version Loksi", 'getApplicationVersionNumber(){return"' + VERSION + '"}')):
refus = check_client_version(code)
print(f"canari en-tête {name}", "OK, refus attendu : " + refus[0][:110] if refus else "RATÉ, accepté")
if not refus:
ratés.append("en-tête " + name)
if check_client_version('getApplicationVersionNumber(){return r(this,void 0,void 0,function*(){return"'
+ BITWARDEN_VERSION + '"})}'):
ratés.append("en-tête (témoin)")
with tarfile.open(ARCHIVE) as tar:
en = json.loads(tar.extractfile(SOURCE.name + "/apps/desktop/src/locales/en/messages.json").read())
logo = tar.extractfile(SOURCE.name + "/libs/assets/src/svg/svgs/lock.icon.ts").read().decode()
for name, check, value in (("textes", check_texts, en), ("dessins", check_renderer, logo),
("code source", check_source, en)):
try:
check(value, "amont") if name != "dessins" else check(value)
ratés.append(name)
except AssertionError as error:
print(f"canari {name} OK, refus attendu : {error}")
if ratés:
sys.exit("canari raté, contrôle muet : " + ", ".join(ratés))
if __name__ == "__main__":
command = sys.argv[1] if len(sys.argv) > 1 else "help"
if command in ("prepare", "changes", "canari", "webpack"):
globals()[command]()
elif command == "native":
native(sys.argv[2] if len(sys.argv) > 2 else "mac")
elif command in ("build", "verify") and sys.argv[2:3] == ["mac"] and len(sys.argv) in (3, 4):
globals()[command]("mac", sys.argv[3] if len(sys.argv) == 4 else "arm64")
elif command in ("build", "verify") and len(sys.argv) == 3:
globals()[command](sys.argv[2])
else:
sys.exit(__doc__)