Introduction | url-signer-go | Spatie       

 SPATIE  

url-signer-go
=============

spatie.be/open-source

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

 Version   v1      

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

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

  Url-signer-go 
===============

 Create signed URLs with a limited lifetime 

### Useful links

- [Repository](https://github.com/spatie/url-signer-go)
- [Discussions](https://github.com/spatie/url-signer-go/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.

```
signer, err := urlsigner.New("randomkey")
if err != nil {
    return err
}

signedURL, err := signer.Sign("https://myapp.com", 30*time.Second)
if err != nil {
    return err
}
```

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.
valid := signer.Validate(signedURL)
```

Examples use the `urlsigner` and standard-library `time` imports inside a function returning an error.

You can share signed links with applications using [spatie/url-signer](https://github.com/spatie/url-signer). See [usage](usage#url-normalization-and-shared-links) for URL normalization and the runtime settings needed for shared links.

Continue with [installation and setup](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)
