From fee75104962548404ed2ffc4f6ef9c397b86683f Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sat, 4 Jun 2022 14:41:52 +0530 Subject: Miscellaneous cleanups (#1934) * build-logic: cleanups * coroutine-utils-testing: cleanups * coroutine-utils: cleanups * crypto-common: cleanups * crypto-pgpainless: cleanups * format-common: cleanups --- .../src/main/kotlin/dev/msfjarvis/aps/crypto/GpgIdentifier.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'crypto-pgpainless/src/main/kotlin/dev/msfjarvis') diff --git a/crypto-pgpainless/src/main/kotlin/dev/msfjarvis/aps/crypto/GpgIdentifier.kt b/crypto-pgpainless/src/main/kotlin/dev/msfjarvis/aps/crypto/GpgIdentifier.kt index d336e86c..b7dcdd0d 100644 --- a/crypto-pgpainless/src/main/kotlin/dev/msfjarvis/aps/crypto/GpgIdentifier.kt +++ b/crypto-pgpainless/src/main/kotlin/dev/msfjarvis/aps/crypto/GpgIdentifier.kt @@ -38,13 +38,12 @@ public sealed class GpgIdentifier { } public companion object { - @OptIn(ExperimentalUnsignedTypes::class) public fun fromString(identifier: String): GpgIdentifier? { if (identifier.isEmpty()) return null // Match long key IDs: // FF22334455667788 or 0xFF22334455667788 val maybeLongKeyId = - identifier.removePrefix("0x").takeIf { it.matches("[a-fA-F0-9]{16}".toRegex()) } + identifier.removePrefix("0x").takeIf { it.matches("[a-fA-F\\d]{16}".toRegex()) } if (maybeLongKeyId != null) { val keyId = maybeLongKeyId.toULong(16) return KeyId(keyId.toLong()) @@ -53,7 +52,7 @@ public sealed class GpgIdentifier { // Match fingerprints: // FF223344556677889900112233445566778899 or 0xFF223344556677889900112233445566778899 val maybeFingerprint = - identifier.removePrefix("0x").takeIf { it.matches("[a-fA-F0-9]{40}".toRegex()) } + identifier.removePrefix("0x").takeIf { it.matches("[a-fA-F\\d]{40}".toRegex()) } if (maybeFingerprint != null) { // Truncating to the long key ID is not a security issue since OpenKeychain only // accepts -- cgit v1.2.3