# @googlemaps/url-signature

> Sign a URL for Google Maps Platform requests.

Latest version **1.0.40** (published 2025-01-13) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @googlemaps/url-signature
pnpm add @googlemaps/url-signature
yarn add @googlemaps/url-signature
bun add @googlemaps/url-signature
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.0.40 |
| Published | 2025-01-13 |
| First published | 2021-10-25 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 33 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 19 |
| Author | Justin Poehnelt |
| Maintainers | google-wombot, wangela, kenough |
| Keywords | google, maps, polyline |

## Links

- npm: https://www.npmjs.com/package/@googlemaps/url-signature
- Repository: https://github.com/googlemaps/js-url-signature
- Issues: https://github.com/googlemaps/js-url-signature/issues
- npm.io page: https://npm.io/package/@googlemaps/url-signature

## Dependencies (1)

- [crypto-js](https://npm.io/package/crypto-js.md) ^4.2.0

## Recent versions

- 1.0.40 (latest) — 2025-01-13
- 1.0.39 — 2024-12-02
- 1.0.38 — 2024-10-21
- 1.0.37 — 2024-09-09
- 1.0.36 — 2024-07-29
- 1.0.35 — 2024-06-24
- 1.0.34 — 2024-05-13
- 1.0.33 — 2024-04-01
- 1.0.32 — 2024-02-19
- 1.0.31 — 2024-01-15
- 1.0.30 — 2023-12-05
- 1.0.29 — 2023-01-02
- 1.0.28 — 2022-11-14
- 1.0.27 — 2022-10-03
- 1.0.26 — 2022-08-22
- … 26 more at https://npm.io/package/@googlemaps/url-signature/versions

## README

# Google Maps JavaScript URL Signing

[![npm](https://img.shields.io/npm/v/@googlemaps/url-signature)](https://www.npmjs.com/package/@googlemaps/url-signature)
![Build](https://github.com/googlemaps/js-url-signature/workflows/Test/badge.svg)
![Release](https://github.com/googlemaps/js-url-signature/workflows/Release/badge.svg)
[![codecov](https://codecov.io/gh/googlemaps/js-url-signature/branch/main/graph/badge.svg)](https://codecov.io/gh/googlemaps/js-url-signature)
![GitHub contributors](https://img.shields.io/github/contributors/googlemaps/js-url-signature?color=green)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![](https://github.com/jpoehnelt/in-solidarity-bot/raw/main/static//badge-flat.png)](https://github.com/apps/in-solidarity)

## Description

Sign a URL for Google Maps Platform requests.

> **Warning**: It is not recommended to use this library in client side applications to avoid exposing the secret used to sign the URL.

## Install

Available via npm as the package [@googlemaps/url-signature](https://www.npmjs.com/package/@googlemaps/url-signature).

`npm i @googlemaps/url-signature`

## Documentation

Check out the [reference documentation](https://googlemaps.github.io/js-url-signature/index.html).

## Example
Create a signature for a Google Maps request [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL) or url string.

 ```ts
const signature = createSignature("https://example.com/some-path?foo=bar", "secret");
```

Returns a new [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL) having a signature parameter.

```ts
const signedUrl = signUrl("https://example.com/some-path?foo=bar", "secret");
signedUrl.href; // "https://example.com/some-path?foo=bar&signature=..."
```

Create a signature for a path and query string using Hmac SHA1.

```ts
const signature = createSignatureForPathAndQuery("/some-path?foo=bar", "secret");
 ```

> **Note**: This is not an officially supported Google product

---
_Source: https://npm.io/package/@googlemaps/url-signature · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
