merge incoming conns and "authorized" section

This commit is contained in:
Ferdinand Schober
2024-09-28 18:41:12 +02:00
parent cf4a06a44a
commit f6a7010d17
3 changed files with 13 additions and 44 deletions

View File

@@ -6,9 +6,9 @@
<property name="modal">True</property>
<property name="width-request">880</property>
<property name="default-width">880</property>
<property name="height-request">340</property>
<property name="default-height">340</property>
<property name="title" translatable="yes">Add Public Key Fingerprint</property>
<property name="height-request">380</property>
<property name="default-height">380</property>
<property name="title" translatable="yes">Add Certificate Fingerprint</property>
<property name="content">
<object class="AdwToolbarView">
<child type="top">
@@ -24,7 +24,12 @@
<property name="spacing">18</property>
<child>
<object class="GtkLabel">
<property name="label">you can find the fingerprint of a device under the `General` section</property>
<property name="label">The certificate fingerprint serves as a unique identifier for your device.</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">You can find it under the `General` section of the device you want to connect</property>
</object>
</child>
<child>

View File

@@ -180,7 +180,7 @@
</child>
<child>
<object class="AdwActionRow" id="fingerprint_row">
<property name="title">public key fingerprint</property>
<property name="title">certificate fingerprint</property>
<property name="icon-name">auth-fingerprint-symbolic</property>
<child>
<object class="GtkButton" id="copy-fingerprint-button">
@@ -229,32 +229,13 @@
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Incoming Connections</property>
<child>
<object class="GtkListBox" id="connection_list">
<property name="selection-mode">none</property>
<child type="placeholder">
<object class="AdwActionRow">
<property name="title">no incoming connections!</property>
<property name="subtitle">devices that control this pc will show up here</property>
</object>
</child>
<style>
<class name="boxed-list" />
</style>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Authorized Keys</property>
<property name="header-suffix">
<object class="GtkButton">
<signal name="clicked" handler="handle_add_cert_fingerprint" swapped="true"/>
<property name="child">
<object class="AdwButtonContent">
<property name="icon-name">auth-fingerprint-symbolic</property>
<property name="label" translatable="yes">Add</property>
<property name="label" translatable="yes">Authorize</property>
</object>
</property>
<style>
@@ -267,8 +248,8 @@
<property name="selection-mode">none</property>
<child type="placeholder">
<object class="AdwActionRow" id="authorized_placeholder">
<property name="title">no fingerprints!</property>
<property name="subtitle">add a public key fingerprint via the + button</property>
<property name="title">no devices registered!</property>
<property name="subtitle">authorize a new device via the "Authorize" button</property>
</object>
</child>
<style>

View File

@@ -11,27 +11,10 @@ use webrtc_dtls::crypto::Certificate;
#[derive(Debug, Error)]
pub enum Error {
#[error("block is not a private key, unable to load key")]
ErrBlockIsNotPrivateKey,
#[error("unknown key time in PKCS#8 wrapping, unable to load key")]
ErrUnknownKeyTime,
#[error("no private key found, unable to load key")]
ErrNoPrivateKeyFound,
#[error("block is not a certificate, unable to load certificates")]
ErrBlockIsNotCertificate,
#[error("no certificate found, unable to load certificates")]
ErrNoCertificateFound,
#[error(transparent)]
Io(#[from] io::Error),
#[error(transparent)]
Dtls(#[from] webrtc_dtls::Error),
#[error("{0}")]
Other(String),
#[error("a file containing the public key is missing")]
PkMissing,
#[error("a file containing the private key is missing")]
SkMissing,
}
pub fn generate_fingerprint(cert: &[u8]) -> String {