#Strict Concurrency Checking: JWT properties not sendable

1 messages · Page 1 of 1 (latest)

frozen wolf
#

I am seeing the following warnings in the following snippet:

import Fluent
import JWT
import Vapor

struct VidaLifeTokenPayload: JWTPayload, Sendable {
    /**
     Maps the longer Swift property names to the
     shortened keys used in the JWT payload.
     */
    enum CodingKeys: String, CodingKey {
        case subject = "sub"
        case expiration = "exp"
        case userID = "uid"
        case refreshToken = "rtok"
    }
    
    /**
     The "sub" (subject) claim identifies the principal that is the
     subject of the JWT.
     */
    let subject: SubjectClaim = "MyApp"  <<<<< Stored property 'subject' of 'Sendable'-conforming struct 'VidaLifeTokenPayload' has non-sendable type 'SubjectClaim'
    
    /**
     The "exp" (expiration time) claim identifies the expiration time on
     or after which the JWT MUST NOT be accepted for processing.
     */
    let expiration = ExpirationClaim(value: Date().addingTimeInterval(15 * 60))  <<<<< Stored property 'expiration' of 'Sendable'-conforming struct 'VidaLifeTokenPayload' has non-sendable type 'ExpirationClaim'
    
    var userID: UUID
    
    var refreshToken: String
    
    init(
        userID: UUID,
        refreshToken: String
    ) {
        self.userID = userID
        self.refreshToken = refreshToken
    }
    
    /**
     Run any additional verification logic beyond signature verification here.
     Since we have an ExpirationClaim, we will call its verify method.
     */
    func verify(using _: JWTSigner) throws {
        try expiration.verifyNotExpired()
    }
}

I get the feeling this is coming from JWT, but I'm not sure 100%.

#

Strict Concurrency Checking: JWT properties not sendable

jade ruin
#

On that one, I will poke @midnight sorrel, as he would be the one to do something about it.

frozen wolf
#

🙏🏻

midnight sorrel
#

@frozen wolf you need JWTKit v5 (and JWT v5) to have Sendable conformance

#

they're in beta still but unlikely to change before the actual release

jade ruin
#

Don't say that, that was Tanner's excuse about Vapor 4...

versed oliveBOT
frozen wolf
#

Thanks @midnight sorrel !