Skip to content

Commit

Permalink
fix: make cross platform and add warning (#16) b332dcd
Browse files Browse the repository at this point in the history
  • Loading branch information
googlemaps-bot committed Oct 25, 2021
1 parent c2d59c9 commit 78904cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ <h1>Google Maps JavaScript URL Signing</h1>
<h2>Description</h2>
</a>
<p>Sign a URL for Google Maps Platform requests.</p>
<blockquote>
<p><strong>Warning</strong>: It is not recommended to use this library in client side applications to avoid exposing the secret used to sign the URL.</p>
</blockquote>

<a href="#install" id="install" style="color: inherit; text-decoration: none;">
<h2>Install</h2>
Expand Down
6 changes: 3 additions & 3 deletions modules.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><html class="default no-js"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>@googlemaps/url-signature</title><meta name="description" content="Documentation for @googlemaps/url-signature"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script async src="assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base="."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">@googlemaps/url-signature</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><h1>@googlemaps/url-signature</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Functions</h3><ul class="tsd-index-list"><li class="tsd-kind-function"><a href="modules.html#createSignature" class="tsd-kind-icon">create<wbr/>Signature</a></li><li class="tsd-kind-function"><a href="modules.html#createSignatureForPathAndQuery" class="tsd-kind-icon">create<wbr/>Signature<wbr/>For<wbr/>Path<wbr/>And<wbr/>Query</a></li><li class="tsd-kind-function"><a href="modules.html#signUrl" class="tsd-kind-icon">sign<wbr/>Url</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Functions</h2><section class="tsd-panel tsd-member tsd-kind-function"><a id="createSignature" class="tsd-anchor"></a><h3>create<wbr/>Signature</h3><ul class="tsd-signatures tsd-kind-function"><li class="tsd-signature tsd-kind-icon">create<wbr/>Signature<span class="tsd-signature-symbol">(</span>unsignedUrl<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">URL</span>, secret<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/googlemaps/js-url-signature/blob/3140db5/src/index.ts#L55">index.ts:55</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<!DOCTYPE html><html class="default no-js"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>@googlemaps/url-signature</title><meta name="description" content="Documentation for @googlemaps/url-signature"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script async src="assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base="."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">@googlemaps/url-signature</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><h1>@googlemaps/url-signature</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Functions</h3><ul class="tsd-index-list"><li class="tsd-kind-function"><a href="modules.html#createSignature" class="tsd-kind-icon">create<wbr/>Signature</a></li><li class="tsd-kind-function"><a href="modules.html#createSignatureForPathAndQuery" class="tsd-kind-icon">create<wbr/>Signature<wbr/>For<wbr/>Path<wbr/>And<wbr/>Query</a></li><li class="tsd-kind-function"><a href="modules.html#signUrl" class="tsd-kind-icon">sign<wbr/>Url</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Functions</h2><section class="tsd-panel tsd-member tsd-kind-function"><a id="createSignature" class="tsd-anchor"></a><h3>create<wbr/>Signature</h3><ul class="tsd-signatures tsd-kind-function"><li class="tsd-signature tsd-kind-icon">create<wbr/>Signature<span class="tsd-signature-symbol">(</span>unsignedUrl<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">URL</span>, secret<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/googlemaps/js-url-signature/blob/b332dcd/src/index.ts#L56">index.ts:56</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Create a signature for a Google Maps request <a href="https://developer.mozilla.org/en-US/docs/Web/API/URL">URL</a> or url string.</p>
</div><div><pre><code class="language-ts"><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">signature</span><span class="hl-1"> = </span><span class="hl-3">createSignature</span><span class="hl-1">(</span><span class="hl-4">&quot;https://example.com/some-path?foo=bar&quot;</span><span class="hl-1">, </span><span class="hl-4">&quot;secret&quot;</span><span class="hl-1">);</span>
</code></pre>
Expand All @@ -7,14 +7,14 @@
</div></div></li><li><h5>secret: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The secret to use for signing.</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><div><p>The signature of the signed url.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function"><a id="createSignatureForPathAndQuery" class="tsd-anchor"></a><h3>create<wbr/>Signature<wbr/>For<wbr/>Path<wbr/>And<wbr/>Query</h3><ul class="tsd-signatures tsd-kind-function"><li class="tsd-signature tsd-kind-icon">create<wbr/>Signature<wbr/>For<wbr/>Path<wbr/>And<wbr/>Query<span class="tsd-signature-symbol">(</span>pathAndQuery<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, secret<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/googlemaps/js-url-signature/blob/3140db5/src/index.ts#L31">index.ts:31</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function"><a id="createSignatureForPathAndQuery" class="tsd-anchor"></a><h3>create<wbr/>Signature<wbr/>For<wbr/>Path<wbr/>And<wbr/>Query</h3><ul class="tsd-signatures tsd-kind-function"><li class="tsd-signature tsd-kind-icon">create<wbr/>Signature<wbr/>For<wbr/>Path<wbr/>And<wbr/>Query<span class="tsd-signature-symbol">(</span>pathAndQuery<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, secret<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/googlemaps/js-url-signature/blob/b332dcd/src/index.ts#L32">index.ts:32</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Create a signature for a path and query string using HmacSHA1.</p>
</div><div><pre><code class="language-ts"><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">signature</span><span class="hl-1"> = </span><span class="hl-3">createSignatureForPathAndQuery</span><span class="hl-1">(</span><span class="hl-4">&quot;/some-path?foo=bar&quot;</span><span class="hl-1">, </span><span class="hl-4">&quot;secret&quot;</span><span class="hl-1">);</span>
</code></pre>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>pathAndQuery: <span class="tsd-signature-type">string</span></h5></li><li><h5>secret: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The secret to use for signing.</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><div><p>The signature of the signed url.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function"><a id="signUrl" class="tsd-anchor"></a><h3>sign<wbr/>Url</h3><ul class="tsd-signatures tsd-kind-function"><li class="tsd-signature tsd-kind-icon">sign<wbr/>Url<span class="tsd-signature-symbol">(</span>unsignedUrl<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">URL</span>, secret<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">URL</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/googlemaps/js-url-signature/blob/3140db5/src/index.ts#L79">index.ts:79</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function"><a id="signUrl" class="tsd-anchor"></a><h3>sign<wbr/>Url</h3><ul class="tsd-signatures tsd-kind-function"><li class="tsd-signature tsd-kind-icon">sign<wbr/>Url<span class="tsd-signature-symbol">(</span>unsignedUrl<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">URL</span>, secret<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">URL</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/googlemaps/js-url-signature/blob/b332dcd/src/index.ts#L81">index.ts:81</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Returns a new <a href="https://developer.mozilla.org/en-US/docs/Web/API/URL">URL</a> having a signature parameter.</p>
</div><div><pre><code class="language-ts"><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">signedUrl</span><span class="hl-1"> = </span><span class="hl-3">signUrl</span><span class="hl-1">(</span><span class="hl-4">&quot;https://example.com/some-path?foo=bar&quot;</span><span class="hl-1">, </span><span class="hl-4">&quot;secret&quot;</span><span class="hl-1">);</span><br/><span class="hl-5">signedUrl</span><span class="hl-1">.</span><span class="hl-5">href</span><span class="hl-1">; </span><span class="hl-6">// &quot;https://example.com/some-path?foo=bar&amp;signature=...&quot;</span>
</code></pre>
Expand Down

0 comments on commit 78904cf

Please sign in to comment.