Introduction | url-signer-rust | Spatie      

 SPATIE  

url-signer-rust
===============

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Url-signer-rust](https://spatie.be/docs/url-signer-rust/v1)  Introduction

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/url-signer-rust/v1) 

  Introduction    
- [ Introduction ](https://spatie.be/docs/url-signer-rust/v1/introduction)
- [ Support us ](https://spatie.be/docs/url-signer-rust/v1/support-us)
- [ Installation ](https://spatie.be/docs/url-signer-rust/v1/installation-and-setup)
- [ Usage ](https://spatie.be/docs/url-signer-rust/v1/usage)
- [ Testing ](https://spatie.be/docs/url-signer-rust/v1/testing)
- [ Changelog ](https://spatie.be/docs/url-signer-rust/v1/changelog)

  Url-signer-rust 
=================

 Create signed URLs with a limited lifetime 

### Useful links

- [Repository](https://github.com/spatie/url-signer-rust)
- [Discussions](https://github.com/spatie/url-signer-rust/discussions)

Introduction
------------

This package can create URLs with a limited lifetime. This is done by adding an expiration date and a signature to the URL.

```
use spatie_url_signer::Sha256UrlSigner;

let url_signer = Sha256UrlSigner::new("randomkey")?;

let signed_url = url_signer.sign("https://myapp.com", 30)?;

// The generated URL will be valid for 30 seconds.
```

This will output a URL that looks like `https://myapp.com?expires=xxxx&signature=xxxx`.

Imagine mailing this URL out to the users of your application. When a user clicks on a signed URL your application can validate it with:

```
// Returns true if valid, false if not.
assert!(url_signer.validate(&signed_url));
```

The signatures and query formatting match the [PHP package](https://github.com/spatie/url-signer). You can sign in PHP and validate in Rust, or sign in Rust and validate in PHP. See [usage](usage) for normalization rules and the compatibility tests.

Continue with [installation](installation-and-setup).

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
