# azure-sign

> Azure Shared Access Signature generation.

Latest version **0.1.2** (published 2014-05-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install azure-sign
pnpm add azure-sign
yarn add azure-sign
bun add azure-sign
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2014-05-12 |
| First published | 2014-05-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | James Lal [:lightsofapollo] |
| Maintainers | lights-of-apollo |
| Keywords | azure, sign, azure table, table, shared access signature |

## Links

- npm: https://www.npmjs.com/package/azure-sign
- npm.io page: https://npm.io/package/azure-sign

## Alternatives

- [@lexical/table](https://npm.io/package/@lexical/table.md) — 3.0M weekly downloads
- [mantine-datatable](https://npm.io/package/mantine-datatable.md) — 98.2K weekly downloads
- [react-native-collapsible-tab-view](https://npm.io/package/react-native-collapsible-tab-view.md) — 70.6K weekly downloads
- [@handsontable/vue3](https://npm.io/package/@handsontable/vue3.md) — 16.1K weekly downloads
- [vuewordcloud](https://npm.io/package/vuewordcloud.md) — 7.2K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2014-05-12
- 0.1.1 — 2014-05-09
- 0.1.0 — 2014-05-09

## README

# azure-sign

Azure signing utilities for node (just table service right now)

The goal is to provide a way to grant access keys to your azure resources
(like querying a table from the browser) with a very small footprint.

## Configuration

Like the node azure client(s) the credentials are taken from environment variables by default:

  - `AZURE_STORAGE_ACCOUNT` : used in the "resource" parameter
  - `AZURE_STORAGE_ACCESS_KEY` : used to generate `sig` query parameter and sign the other params

See the [azure docs](http://msdn.microsoft.com/en-us/library/windowsazure/ee395415.aspx) for more details

## Usage

The [tests](/*_test.js) are written in an end-to-end style see them
for actual usage (making calls to azure)

### sas

```js
var signTable = require('azure-sign/table');

var expires = new Date();
// good for an hour
expires.setHours(expires.getHours() + 1);

// sign a table resource
var queryParams = table.sas({
  // this must be lowercase even if your table is uppercase, etc...
  resource: 'tablename',

  // allow reads
  signedpermissions: 'r',

  signedexpiry: expires
});

// query params is suitable for use in any table query that is supported
// via reads

// a quick example using superagent

var superagent = require('superagent');

superagent.get('https://mytable.table.core.windows.net/mytable()').
  query('$filter', '(PartitionKey eq "mypartition")').
  // turn on json mode
  set('Accept', 'application/json');
  end(function(err, result) {
    var json = result.res.body;
  });
```

### sharedKey

```js
var superagent = requrie('superagent');

var now = new Date().toUTCString();
var url = 'https://' + tableService.host + '/' + tableName + '()';
var req = superagent('GET', url);

// These are all required headers
req.set('Content-Type', 'application/json');
req.set('Date', now)
req.set('x-ms-date', now)
req.set('x-ms-version', '2013-08-15');

var headers = {
  'Content-Type': req.get('Content-Type'),
  'Date': req.get('Date')
};

var signed = subject.sharedKey({
  method: req.method,
  headers: headers,
  resource: tableName + '()'
});

req.set('Authorization', signed);

// now your request is authenticated go for it!
// ... yay

```

## TODO

  - add SAS signing for blobs
  - add SAS signing for queue

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