Is SealingKey from the ring library thread-safe?

Asking about ring.

I'm keeping it now in a Mutex but I was wondering if it's thread-safe in which case I could use it directly.

Well, it's both Send and Sync, so at least sharing it between threads is supported. Changing it, however, is likely not (there are no methods for this), so if you need to be able to replace it in a thread-safe way, you obviously need Mutex.

1 Like

thank you

For thread safety wise, if your usage compiles and you've not used any unsafe block there should be no problem. That's how Rust's Send/Sync system works. If any safe usage allows such problem that's the library's critical bug.

5 Likes