# verse-session-id
[](https://crates.io/crates/verse-session-id)
[](https://docs.rs/verse-session-id)
[](https://github.com/VerseEngine/verse-session-id/blob/main/LICENSE)
[](https://github.com/VerseEngine/verse-three/pulls)
ID with signature/verification functions.
Used as session ID in [@VerseEngine/verse-core](https://github.com/VerseEngine/verse-session-id).
## Usage
### Signature Verification
```rust
use verse_session_id::*;
...
pub fn verify_string(session_id: &str, signature: &str, data: &str) -> bool {
let Ok(sid) = session_id.parse::() else {
return false;
};
let Ok(ss) = signature.parse::() else {
return false;
};
sid.verify(vec![data.as_bytes()], &ss).is_ok()
}
```
### Generate ID
```rust
let id_pair = new_session_id_pair()?;
let session_id = id_pair.get_id();
// to string
let s = format!("{}", session_id);
```
### Create a signature
```rust
pub fn sign_string(&self, data: &str) -> Result {
let id_pair = ...;
Ok(id_pair
.sign(vec![data.as_bytes()])?
.to_string())
}
```