From 9b2caa2b3a17b1bcd7f35bae7e23ae3e37759a7d Mon Sep 17 00:00:00 2001 From: dtsiflit Date: Wed, 17 Jul 2024 09:57:17 +0300 Subject: [PATCH] [fix] filter empty content in jwt --- Sources/Entities/Encryption/BindingKey.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Sources/Entities/Encryption/BindingKey.swift b/Sources/Entities/Encryption/BindingKey.swift index 2540987..52e3f2e 100644 --- a/Sources/Entities/Encryption/BindingKey.swift +++ b/Sources/Entities/Encryption/BindingKey.swift @@ -72,7 +72,12 @@ public extension BindingKey { JWTClaimNames.audience: aud, JWTClaimNames.nonce: cNonce ?? "", JWTClaimNames.issuer: issuer ?? "" - ] + ].filter { key, value in + if let string = value as? String, string.isEmpty { + return false + } + return true + } let payload = Payload(try dictionary.toThrowingJSONData()) @@ -126,7 +131,12 @@ public extension BindingKey { JWTClaimNames.audience: aud, JWTClaimNames.nonce: cNonce ?? "", JWTClaimNames.issuer: issuer ?? "" - ] + ].filter { key, value in + if let string = value as? String, string.isEmpty { + return false + } + return true + } let payload = Payload(try dictionary.toThrowingJSONData())