generateheaders -> generateHeaders

This commit is contained in:
Steve Faulkner 2018-11-17 15:05:56 -05:00
Родитель 5f1024a85a
Коммит 443d032bc9
5 изменённых файлов: 19 добавлений и 21 удалений

Просмотреть файл

@ -10,41 +10,39 @@ Utility library for signing Azure Cosmos tokens and generating headers. Works in
## Generate a signed header value using your master key
``` js
```js
import { generateSignature } from "cosmos-sign"
const masterKey = "< your master key here >";
const method = "GET";
const resourceId = "";
const resourceType = "";
const masterKey = "< your master key here >"
const method = "GET"
const resourceId = ""
const resourceType = ""
const result = generateSignature(masterKey, method, resourceType, resourceId);
const result = generateSignature(masterKey, method, resourceType, resourceId)
```
## Generate a headers object instead
``` js
```js
import { generateHeaders } from "cosmos-sign"
const masterKey = "< your master key here >";
const method = "GET";
const resourceId = "";
const resourceType = "";
const masterKey = "< your master key here >"
const method = "GET"
const resourceId = ""
const resourceType = ""
const headers = generateHeaders(masterKey, method, resourceType, resourceId);
const headers = generateHeaders(masterKey, method, resourceType, resourceId)
console.log(headers)
fetch("https://your-db.cosmos.azure.com/", {
headers
})
```
## Optionally pass a date in
``` js
```js
import { generateSignature } from "cosmos-sign"
const masterKey = "< your master key here >";

Просмотреть файл

@ -1,5 +1,5 @@
import assert from "assert"
import { generateSignature, generateheaders } from "./browser"
import { generateSignature, generateHeaders } from "./browser"
const date = new Date("Sat, 17 Nov 2018 01:06:05 GMT")
const masterKey =
@ -25,7 +25,7 @@ const signature = generateSignature(
date
)
const headers = generateheaders(
const headers = generateHeaders(
masterKey,
method,
resourceType,

Просмотреть файл

@ -10,4 +10,4 @@ const hmac = (key: string, message: string) => {
const signer = Signer(hmac)
export const generateSignature = signer.signature
export const generateheaders = signer.headers
export const generateHeaders = signer.headers

Просмотреть файл

@ -1,5 +1,5 @@
import assert from "assert"
import { generateSignature, generateheaders } from "./node"
import { generateSignature, generateHeaders } from "./node"
const date = new Date("Sat, 17 Nov 2018 01:06:05 GMT")
const masterKey =
@ -25,7 +25,7 @@ const signature = generateSignature(
date
)
const headers = generateheaders(
const headers = generateHeaders(
masterKey,
method,
resourceType,

Просмотреть файл

@ -11,4 +11,4 @@ const signer = Signer(hmac)
export const generateSignature = signer.signature
export const generateheaders = signer.headers
export const generateHeaders = signer.headers