mirror of
https://github.com/librekeys/picoforge.git
synced 2026-07-28 08:01:19 -07:00
chore: rename device dir to hal and create models module for repo storage
This commit is contained in:
Generated
+9
-9
@@ -5,11 +5,11 @@
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1769996383,
|
||||
"narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=",
|
||||
"lastModified": 1782949081,
|
||||
"narHash": "sha256-vp6Y/Grm98ESt6ceOkWiHWyZRDV3J1RID4w+6NWK9yA=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "57928607ea566b5db3ad13af0e57e921e6b12381",
|
||||
"rev": "17c9d6cdfc60c64f4ee8d306f9bc0b4ccb51481e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -20,11 +20,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1771369470,
|
||||
"narHash": "sha256-0NBlEBKkN3lufyvFegY4TYv5mCNHbi5OmBDrzihbBMQ=",
|
||||
"lastModified": 1782959384,
|
||||
"narHash": "sha256-xnJJk+ct+D2+wdRxj1wk36w5zV9RVESwRqcklPdt3fM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0182a361324364ae3f436a63005877674cf45efb",
|
||||
"rev": "65179426c83bb3f6bc14898b42ea1c6f01d374b0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -36,11 +36,11 @@
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1769909678,
|
||||
"narHash": "sha256-cBEymOf4/o3FD5AZnzC3J9hLbiZ+QDT/KDuyHXVJOpM=",
|
||||
"lastModified": 1782614948,
|
||||
"narHash": "sha256-ePjCwr1sNm9NYUqywL7QfK3JnlS015msC+eBu2zKlp8=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "72716169fe93074c333e8d0173151350670b824c",
|
||||
"rev": "db3f255737b94216eb71cce308e2912cf6bc2d7c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -89,8 +89,8 @@ use serde_cbor_2::{Value, from_slice, to_vec};
|
||||
use std::collections::BTreeMap;
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::device::fido::constants::*;
|
||||
use crate::error::PFError;
|
||||
use crate::hal::fido::constants::*;
|
||||
|
||||
/// Size of a single USB HID report in bytes (CTAP2 §11.2 mandates 64-byte reports).
|
||||
const HID_REPORT_SIZE: usize = 64;
|
||||
@@ -58,11 +58,11 @@ pub mod constants;
|
||||
pub mod hid;
|
||||
|
||||
use crate::{
|
||||
device::types::{
|
||||
error::PFError,
|
||||
hal::types::{
|
||||
AppConfig, AppConfigInput, DeviceInfo, DeviceMethod, FidoDeviceInfo, FirmwareType,
|
||||
FullDeviceStatus, PICOFIDO_AAGUID, RSKEY_AAGUID, StoredCredential,
|
||||
},
|
||||
error::PFError,
|
||||
};
|
||||
use base64::{Engine as _, engine::general_purpose};
|
||||
use constants::*;
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#![allow(unused)]
|
||||
|
||||
use crate::{device::fido, device::rescue, device::types::*, error::PFError};
|
||||
use crate::{error::PFError, hal::fido, hal::rescue, hal::types::*};
|
||||
|
||||
// ── Shared: functions that use both rescue and FIDO ─────────────────────────
|
||||
|
||||
@@ -159,8 +159,8 @@
|
||||
|
||||
pub mod constants;
|
||||
|
||||
use crate::device::{rescue::constants::*, types::*};
|
||||
use crate::error::PFError;
|
||||
use crate::hal::{rescue::constants::*, types::*};
|
||||
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
|
||||
use pcsc::{Context, Protocols, Scope, ShareMode};
|
||||
use std::io::Cursor;
|
||||
+1
-1
@@ -821,8 +821,8 @@ use gpui_component::Root;
|
||||
use gpui_component::{Theme, ThemeMode, ThemeSet};
|
||||
use ui::rootview::ApplicationRoot;
|
||||
|
||||
mod device;
|
||||
pub mod error;
|
||||
mod hal;
|
||||
pub mod logging;
|
||||
mod ui;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::device::types::DeviceMethod;
|
||||
use crate::hal::types::DeviceMethod;
|
||||
use crate::ui::components::button::PFIconButton;
|
||||
use crate::ui::types::{ActiveView, DeviceConnectionState};
|
||||
use gpui::*;
|
||||
@@ -223,7 +223,7 @@ impl<V: 'static> AppSidebar<V> {
|
||||
&state.status
|
||||
{
|
||||
let is_rskey = status.firmware_type
|
||||
== crate::device::types::FirmwareType::RSKey;
|
||||
== crate::hal::types::FirmwareType::RSKey;
|
||||
let fw_label =
|
||||
if is_rskey { "RS-Key" } else { "Pico-FIDO" };
|
||||
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
pub mod assets;
|
||||
pub mod colors;
|
||||
pub mod components;
|
||||
pub mod models;
|
||||
pub mod rootview;
|
||||
pub mod screens;
|
||||
pub mod types;
|
||||
pub mod views;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
use crate::hal::types::{FidoDeviceInfo, FullDeviceStatus, LedStatusConfig, ManagementAppConfig};
|
||||
use gpui::*;
|
||||
|
||||
// Repo Events:
|
||||
pub enum DeviceEvent {
|
||||
Updated,
|
||||
}
|
||||
|
||||
impl EventEmitter<DeviceEvent> for DeviceRepo {}
|
||||
|
||||
// Repo Definition:
|
||||
pub struct DeviceRepo {
|
||||
pub status: Option<FullDeviceStatus>,
|
||||
pub fido_info: Option<FidoDeviceInfo>,
|
||||
pub led_status: Option<LedStatusConfig>,
|
||||
pub management_apps: Option<ManagementAppConfig>,
|
||||
pub error: Option<String>,
|
||||
pub loading: bool,
|
||||
}
|
||||
|
||||
impl DeviceRepo {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
status: None,
|
||||
fido_info: None,
|
||||
led_status: None,
|
||||
management_apps: None,
|
||||
error: None,
|
||||
loading: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
mod device;
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
use crate::device::io;
|
||||
use crate::hal::io;
|
||||
use crate::ui::components::sidebar::AppSidebar;
|
||||
use crate::ui::types::{ActiveView, DeviceConnectionState, LayoutState, ViewCache};
|
||||
use crate::ui::views::{
|
||||
use crate::ui::screens::{
|
||||
about::AboutView, config::ConfigView, home::HomeView, passkeys::PasskeysEvent,
|
||||
passkeys::PasskeysView, security::SecurityView,
|
||||
};
|
||||
use crate::ui::types::{ActiveView, DeviceConnectionState, LayoutState, ViewCache};
|
||||
use gpui::prelude::*;
|
||||
use gpui::*;
|
||||
use gpui_component::Root;
|
||||
@@ -76,8 +76,8 @@ impl ApplicationRoot {
|
||||
}
|
||||
}
|
||||
|
||||
if status.firmware_type == crate::device::types::FirmwareType::RSKey
|
||||
&& status.method == crate::device::types::DeviceMethod::Rescue
|
||||
if status.firmware_type == crate::hal::types::FirmwareType::RSKey
|
||||
&& status.method == crate::hal::types::DeviceMethod::Rescue
|
||||
{
|
||||
self.device.led_status = io::read_led_config().ok();
|
||||
self.device.management_apps = io::read_management_config().ok();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use crate::device::rescue::constants::{
|
||||
use crate::hal::rescue::constants::{
|
||||
LedColor, LedStatus, USB_CAP_FIDO2, USB_CAP_OATH, USB_CAP_OPENPGP, USB_CAP_OTP, USB_CAP_PIV,
|
||||
USB_CAP_U2F,
|
||||
};
|
||||
use crate::device::types::{AppConfigInput, DeviceMethod};
|
||||
use crate::device::{fido, io};
|
||||
use crate::hal::types::{AppConfigInput, DeviceMethod};
|
||||
use crate::hal::{fido, io};
|
||||
use crate::ui::components::dialog::PinPromptContent;
|
||||
use crate::ui::components::{card::Card, dialog, dialog::StatusContent, page_view::PageView};
|
||||
use crate::ui::rootview::ApplicationRoot;
|
||||
@@ -254,7 +254,7 @@ impl ConfigView {
|
||||
fn write_config_to_device(
|
||||
&mut self,
|
||||
changes: AppConfigInput,
|
||||
method: crate::device::types::DeviceMethod,
|
||||
method: crate::hal::types::DeviceMethod,
|
||||
pin: Option<String>,
|
||||
dialog_handle: StatusDialogHandle,
|
||||
cx: &mut Context<Self>,
|
||||
@@ -529,7 +529,7 @@ impl ConfigView {
|
||||
}
|
||||
}
|
||||
|
||||
fn status_supports_legacy_fido_config(status: &crate::device::types::FullDeviceStatus) -> bool {
|
||||
fn status_supports_legacy_fido_config(status: &crate::hal::types::FullDeviceStatus) -> bool {
|
||||
status.method == DeviceMethod::Fido
|
||||
&& fido::firmware_supports_legacy_fido_hardware_config(&status.info.firmware_version)
|
||||
}
|
||||
@@ -1300,7 +1300,7 @@ impl Render for ConfigView {
|
||||
let columns = if is_wide { 2 } else { 1 };
|
||||
|
||||
let is_rskey = status.as_ref().map(|s| &s.firmware_type)
|
||||
== Some(&crate::device::types::FirmwareType::RSKey);
|
||||
== Some(&crate::hal::types::FirmwareType::RSKey);
|
||||
|
||||
let mut grid_children = vec![identity_card, led_card, touch_card, options_card];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::device::types::DeviceMethod;
|
||||
use crate::hal::types::DeviceMethod;
|
||||
use crate::ui::components::{card::Card, page_view::PageView, tag::Tag};
|
||||
use crate::ui::types::DeviceConnectionState;
|
||||
use gpui::prelude::FluentBuilder;
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::device::io;
|
||||
use crate::device::types::StoredCredential;
|
||||
use crate::hal::io;
|
||||
use crate::hal::types::StoredCredential;
|
||||
use crate::ui::components::{
|
||||
button::{PFButton, PFIconButton},
|
||||
card::Card,
|
||||
@@ -1138,7 +1138,7 @@ impl PasskeysView {
|
||||
// 1. Wait for unplug
|
||||
while start.elapsed().as_secs() < 15 {
|
||||
std::thread::sleep(std::time::Duration::from_millis(200));
|
||||
if crate::device::fido::hid::HidTransport::open().is_err() {
|
||||
if crate::hal::fido::hid::HidTransport::open().is_err() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1146,7 +1146,7 @@ impl PasskeysView {
|
||||
// 2. Wait for replug
|
||||
while start.elapsed().as_secs() < 15 {
|
||||
std::thread::sleep(std::time::Duration::from_millis(500));
|
||||
if crate::device::fido::hid::HidTransport::open().is_ok() {
|
||||
if crate::hal::fido::hid::HidTransport::open().is_ok() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1750,7 +1750,7 @@ impl Render for PasskeysView {
|
||||
let has_fido = device
|
||||
.status
|
||||
.as_ref()
|
||||
.map(|s| s.method == crate::device::types::DeviceMethod::Fido)
|
||||
.map(|s| s.method == crate::hal::types::DeviceMethod::Fido)
|
||||
.unwrap_or(false)
|
||||
|| device.fido_info.is_some();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user