Show pairing keys everywhere and always shorten to 8 chars
The previous key was 64 freakin characters long which made it more prone to being ignored, and thus less secure.
This commit is contained in:
parent
3afcca8a1d
commit
af4ce1c33c
5 changed files with 9 additions and 9 deletions
|
@ -127,7 +127,7 @@ Kirigami.ScrollablePage {
|
||||||
Kirigami.PlaceholderMessage {
|
Kirigami.PlaceholderMessage {
|
||||||
// FIXME: not accessible. screen readers won't read this. Idem for the other PlaceholderMessages
|
// FIXME: not accessible. screen readers won't read this. Idem for the other PlaceholderMessages
|
||||||
// https://invent.kde.org/frameworks/kirigami/-/merge_requests/1482
|
// https://invent.kde.org/frameworks/kirigami/-/merge_requests/1482
|
||||||
text: i18nd("kdeconnect-app", "This device is not paired")
|
text: i18nd("kdeconnect-app", "This device is not paired.\nKey: %1", root.currentDevice.verificationKey)
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
visible: root.currentDevice && root.currentDevice.isReachable && !root.currentDevice.isPaired && !root.currentDevice.isPairRequestedByPeer && !root.currentDevice.isPairRequested
|
visible: root.currentDevice && root.currentDevice.isReachable && !root.currentDevice.isPaired && !root.currentDevice.isPairRequestedByPeer && !root.currentDevice.isPairRequested
|
||||||
helpfulAction: Kirigami.Action {
|
helpfulAction: Kirigami.Action {
|
||||||
|
@ -138,7 +138,7 @@ Kirigami.ScrollablePage {
|
||||||
}
|
}
|
||||||
|
|
||||||
Kirigami.PlaceholderMessage {
|
Kirigami.PlaceholderMessage {
|
||||||
text: i18nd("kdeconnect-app", "Pair requested")
|
text: i18nd("kdeconnect-app", "Pair requested\nKey: " + root.currentDevice.verificationKey)
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
visible: root.currentDevice && root.currentDevice.isReachable && root.currentDevice.isPairRequested
|
visible: root.currentDevice && root.currentDevice.isReachable && root.currentDevice.isPairRequested
|
||||||
QQC2.BusyIndicator {
|
QQC2.BusyIndicator {
|
||||||
|
@ -147,7 +147,7 @@ Kirigami.ScrollablePage {
|
||||||
}
|
}
|
||||||
|
|
||||||
Kirigami.PlaceholderMessage {
|
Kirigami.PlaceholderMessage {
|
||||||
text: i18n("Pair requested")
|
text: i18n("Pair requested\nKey: " + root.currentDevice.verificationKey)
|
||||||
visible: root.currentDevice && root.currentDevice.isPairRequestedByPeer
|
visible: root.currentDevice && root.currentDevice.isPairRequestedByPeer
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: Kirigami.Units.largeSpacing
|
spacing: Kirigami.Units.largeSpacing
|
||||||
|
|
|
@ -468,7 +468,7 @@ QSslCertificate Device::certificate() const
|
||||||
return d->m_deviceInfo.certificate;
|
return d->m_deviceInfo.certificate;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Device::verificationKey() const
|
QString Device::verificationKey() const
|
||||||
{
|
{
|
||||||
auto a = KdeConnectConfig::instance().certificate().publicKey().toDer();
|
auto a = KdeConnectConfig::instance().certificate().publicKey().toDer();
|
||||||
auto b = certificate().publicKey().toDer();
|
auto b = certificate().publicKey().toDer();
|
||||||
|
@ -479,7 +479,7 @@ QByteArray Device::verificationKey() const
|
||||||
QCryptographicHash hash(QCryptographicHash::Sha256);
|
QCryptographicHash hash(QCryptographicHash::Sha256);
|
||||||
hash.addData(a);
|
hash.addData(a);
|
||||||
hash.addData(b);
|
hash.addData(b);
|
||||||
return hash.result().toHex();
|
return QString::fromLatin1(hash.result().toHex().left(8).toUpper());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Device::pluginIconName(const QString &pluginName)
|
QString Device::pluginIconName(const QString &pluginName)
|
||||||
|
|
|
@ -26,6 +26,7 @@ class KDECONNECTCORE_EXPORT Device : public QObject
|
||||||
Q_PROPERTY(QString type READ typeAsString NOTIFY typeChanged)
|
Q_PROPERTY(QString type READ typeAsString NOTIFY typeChanged)
|
||||||
Q_PROPERTY(QString name READ name NOTIFY nameChanged)
|
Q_PROPERTY(QString name READ name NOTIFY nameChanged)
|
||||||
Q_PROPERTY(QString iconName READ iconName CONSTANT)
|
Q_PROPERTY(QString iconName READ iconName CONSTANT)
|
||||||
|
Q_PROPERTY(QString verificationKey READ verificationKey CONSTANT)
|
||||||
Q_PROPERTY(QString statusIconName READ statusIconName NOTIFY statusIconNameChanged)
|
Q_PROPERTY(QString statusIconName READ statusIconName NOTIFY statusIconNameChanged)
|
||||||
Q_PROPERTY(bool isReachable READ isReachable NOTIFY reachableChanged)
|
Q_PROPERTY(bool isReachable READ isReachable NOTIFY reachableChanged)
|
||||||
Q_PROPERTY(bool isPaired READ isPaired NOTIFY pairStateChanged)
|
Q_PROPERTY(bool isPaired READ isPaired NOTIFY pairStateChanged)
|
||||||
|
@ -64,7 +65,7 @@ public:
|
||||||
};
|
};
|
||||||
QString iconName() const;
|
QString iconName() const;
|
||||||
QString statusIconName() const;
|
QString statusIconName() const;
|
||||||
Q_SCRIPTABLE QByteArray verificationKey() const;
|
Q_SCRIPTABLE QString verificationKey() const;
|
||||||
Q_SCRIPTABLE QString encryptionInfo() const;
|
Q_SCRIPTABLE QString encryptionInfo() const;
|
||||||
|
|
||||||
// Add and remove links
|
// Add and remove links
|
||||||
|
|
|
@ -53,8 +53,7 @@ public:
|
||||||
notification->setIconName(QStringLiteral("dialog-information"));
|
notification->setIconName(QStringLiteral("dialog-information"));
|
||||||
notification->setComponentName(QStringLiteral("kdeconnect"));
|
notification->setComponentName(QStringLiteral("kdeconnect"));
|
||||||
notification->setTitle(QStringLiteral("KDE Connect"));
|
notification->setTitle(QStringLiteral("KDE Connect"));
|
||||||
notification->setText(
|
notification->setText(i18n("Pairing request from %1\nKey: %2", device->name().toHtmlEscaped(), device->verificationKey()));
|
||||||
i18n("Pairing request from %1\nKey: %2...", device->name().toHtmlEscaped(), QString::fromUtf8(device->verificationKey().left(8))));
|
|
||||||
QString deviceId = device->id();
|
QString deviceId = device->id();
|
||||||
auto openSettings = [deviceId, notification] {
|
auto openSettings = [deviceId, notification] {
|
||||||
OpenConfig oc;
|
OpenConfig oc;
|
||||||
|
|
|
@ -180,7 +180,7 @@ void KdeConnectKcm::resetCurrentDevice()
|
||||||
|
|
||||||
void KdeConnectKcm::resetDeviceView()
|
void KdeConnectKcm::resetDeviceView()
|
||||||
{
|
{
|
||||||
kcmUi.verificationKey->setText(i18n("Key: %1", QString::fromUtf8(currentDevice->verificationKey())));
|
kcmUi.verificationKey->setText(i18n("Key: %1", currentDevice->verificationKey()));
|
||||||
|
|
||||||
kcmUi.name_label->setText(currentDevice->name());
|
kcmUi.name_label->setText(currentDevice->name());
|
||||||
setWhenAvailable(
|
setWhenAvailable(
|
||||||
|
|
Loading…
Reference in a new issue