From e830b82b9c32c03c7722d6be7ba23d3f4ecab786 Mon Sep 17 00:00:00 2001 From: Goncalo Frade Date: Thu, 18 Jul 2024 15:23:20 +0100 Subject: [PATCH] feat(didcomm): added support for optional chachapoly --- Package.swift | 2 +- Sources/DIDCommSwift/Helper/AnonAlg+JWE.swift | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index 9d369d6..5dcebac 100644 --- a/Package.swift +++ b/Package.swift @@ -21,7 +21,7 @@ let package = Package( dependencies: [ .package(url: "https://github.com/swift-libp2p/swift-multibase.git", .upToNextMajor(from: "0.0.1")), .package(url: "https://github.com/beatt83/didcore-swift.git", .upToNextMinor(from: "2.0.0")), - .package(url: "https://github.com/beatt83/jose-swift.git", .upToNextMajor(from: "3.1.0")) + .package(url: "https://github.com/beatt83/jose-swift.git", .upToNextMajor(from: "3.2.0")) ], targets: [ .target( diff --git a/Sources/DIDCommSwift/Helper/AnonAlg+JWE.swift b/Sources/DIDCommSwift/Helper/AnonAlg+JWE.swift index 02aa80e..6e8aa73 100644 --- a/Sources/DIDCommSwift/Helper/AnonAlg+JWE.swift +++ b/Sources/DIDCommSwift/Helper/AnonAlg+JWE.swift @@ -25,7 +25,7 @@ extension AnonymousEncryptionAlgorithms { case .a256GCM: return (ContentEncryptionAlgorithm.a256GCM, KeyManagementAlgorithm.ecdhESA256KW) case .XC20P: - fatalError("This is not supported") + return (ContentEncryptionAlgorithm.xC20PKW, KeyManagementAlgorithm.ecdhESA256KW) } } @@ -35,6 +35,8 @@ extension AnonymousEncryptionAlgorithms { return .a256CBCHS512 case (.ecdhESA256KW, .a256GCM): return .a256GCM + case (.ecdhESA256KW, .xC20PKW): + return .XC20P default: throw DIDCommError.unsupportedCryptoAlgorithme(algorithm: keyAlg.rawValue, encoding: encAlg.rawValue) }