Update README.md
This commit is contained in:
parent
350b266a4b
commit
014022b373
|
@ -3,7 +3,7 @@
|
|||
Generate a signed URL or Request headers for submitting to Amazon Web Services. Supply the library with your URL, HTTP method, headers and body and get back a signed URL or signed headers to use in your HTTP Request.
|
||||
|
||||
## Usage Guide
|
||||
Create an AWSSigner object. Initialise it with security credentials for accessing Amazon Web Services, the signing name of the service you are using and the AWS region you are working in. You can create a credentials object directly and enter your credientials or get them from the environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` using the `EnvironmentCredential` struct. There are other ways of accessing AWS security credentials but that isn't the purpose of this library. The signing name in general is the same as the service name eg `s3`, `sns`, `iam` but this is not always the case.
|
||||
Create an AWSSigner object. Initialise it with security credentials for accessing Amazon Web Services, the signing name of the service you are using and the AWS region you are working in. You can create a credentials object directly and enter your credentials or get them from the environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` using the `EnvironmentCredential` struct. There are other ways of accessing AWS security credentials but that isn't the purpose of this library. The signing name in general is the same as the service name eg `s3`, `sns`, `iam` but this is not always the case.
|
||||
|
||||
The following example code creates a signed URL to access a file in S3.
|
||||
|
||||
|
@ -21,7 +21,7 @@ Alternatively you can store the authentication details in the request headers. T
|
|||
let credentials = Credential(accessKeyId: "MYACCESSKEY", secretAccessKey: "MYSECRETACCESSKEY")
|
||||
let signer = AWSSigner(credentials: credentials, name: "sns", region: "us-east-1")
|
||||
let body = "Action=ListTopics&Version=2010-03-31"
|
||||
let signedHeaders = HTTPClient.signHeaders(
|
||||
let signedHeaders = AWSSigner.signHeaders(
|
||||
url: URL(string:"sns.us-east-1.amazonaws.com/")!,
|
||||
method: .GET,
|
||||
headers: ["Content-Type": "application/x-www-form-urlencoded; charset=utf-8"],
|
||||
|
|
Loading…
Reference in New Issue