{"id":4460,"url":"https://github.com/leimd/react-native-aws-signature","last_synced_at":"2025-08-04T01:32:27.414Z","repository":{"id":57335609,"uuid":"51637489","full_name":"leimd/react-native-aws-signature","owner":"leimd","description":"library to generate AWS signaure V4 for React Native application","archived":true,"fork":false,"pushed_at":"2016-02-20T07:10:41.000Z","size":334,"stargazers_count":45,"open_issues_count":5,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-01T10:06:05.545Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leimd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-13T07:57:10.000Z","updated_at":"2023-03-07T20:53:29.000Z","dependencies_parsed_at":"2022-09-07T17:34:12.807Z","dependency_job_id":null,"html_url":"https://github.com/leimd/react-native-aws-signature","commit_stats":null,"previous_names":["leimd/awssignature"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leimd/react-native-aws-signature","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leimd%2Freact-native-aws-signature","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leimd%2Freact-native-aws-signature/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leimd%2Freact-native-aws-signature/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leimd%2Freact-native-aws-signature/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leimd","download_url":"https://codeload.github.com/leimd/react-native-aws-signature/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leimd%2Freact-native-aws-signature/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268636374,"owners_count":24282080,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:17:13.273Z","updated_at":"2025-08-04T01:32:27.155Z","avatar_url":"https://github.com/leimd.png","language":"JavaScript","funding_links":[],"categories":["Components"],"sub_categories":["Utils \u0026 Infra"],"readme":"# react-native-aws-signature\n### helps you generate signature for aws request for React-Native applications (or other js applications )\n[![NPM](https://nodei.co/npm/react-native-aws-signature.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/react-native-aws-signature/)\n\n[![Code Climate](https://codeclimate.com/github/leimd/react-native-aws-signature/badges/gpa.svg)](https://codeclimate.com/github/leimd/react-native-aws-signature)\n[![Test Coverage](https://codeclimate.com/github/leimd/react-native-aws-signature/badges/coverage.svg)](https://codeclimate.com/github/leimd/react-native-aws-signature/coverage)\n![CI Status](https://travis-ci.org/leimd/react-native-aws-signature.svg?branch=master)\n\nlibrary to generate AWS signaure V4 for React Native application because react-native's javascript runtime doesn't support running aws-sdk-js.\nThis is the first part if you want to make any signed calls to AWS.\n\n## Installation\n`npm install react-native-aws-signature --save`\n\n\n## Usage\n``` javascript\nvar AWSSignature = require('react-native-aws-signature');\nvar awsSignature = new AWSSignature();\nlet credentials = {\n\tSecretKey: 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY',\n\tAccessKeyId: 'sdfsdfsdfsdfsdfsdf'\n};\nvar options = {\n\tpath: '/?Param2=value2\u0026Param1=value1',\n    method: 'get',\n    service: 'service',\n    headers: {\n        'X-Amz-Date': '20150209T123600Z',\n        'host': 'example.amazonaws.com'\n    },\n\tregion: 'us-east-1',\n\tbody: '',\n\tcredentials\n};\nawsSignature.setParams(options);\nvar signature = awsSignature.getSignature();\nvar authorization = awsSignature.getAuthorizationHeader();\n```\n\n##Workflow\n1.Instantiate AWSSignature object by calling `var awsSignature = new AWSSignature();`\n\n2.Set signature parameter by calling 'AWSSignature#setParams' with option object as the only parameter.\n\n\tthe option given in the example comprises of the minimal requirement needed to generate AWS signature\n\n|option| |\n|---|---|\n|path|the path you're calling|\n|method| HTTP method |\n|service| AWS Service you're using ex. s3|\n|headers| HTTP headers|\n|region| AWS regions|\n|body| HTTP request body|\n|credentials| credentails object returned by coginto##GetCredentialsForIdentity, more on this later|\n\nfor headers, `host` and (`date` or `X-Amz-Date`) is required, other wise an exception will raise.\n\nThe datetime string passed with date header or X-Amz-Date has to be Amazon styled ISO 8601 strings like the one provided above, you can get one by calling \n`AWSSignature#_formatDateTime` and pass in an ISO 8601 string as the parameter.\n\nFor example `awsSignature._formatDateTime('2015-02-09T10:00:00Z')` will return `20150209T100000Z` which is accecptable as `X-Amz-Date`.\n* this method might be moved to a util class once this project expands its scope so don't really count on using it*\n\n##getSignature vs getAuthorizationHeader\nonce you did `setParams`, you could either use `getSignature` or `getAuthorizationHeader` to get the signature, the difference is that getAuthorizationHeader will return something like the following so that you can use it in the following steps.\n``` javascript\n{\nAuthorization: 'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/iam/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=5d672d79c15b13162d9279b0855cfba6789a8edb4c82c400e06b5924a6f2b5d7'\n}\n```\n\nThis corresponds to [Step4](http://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html) of the documentation online.\n\n\n## Credentials\nThe minials requried credentail object looks like this:\n```javascript\n{\n\tSecretKey: 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY',\n\tAccessKeyId: 'sdfsdfsdfsdfsdfsdf'\n};\n```\n\nThe required keys are `SecretKey` and `AccessKeyId`that you get from coginto##GetCredentialsForIdentity or somewhere else.\n\n## running test\nonce you cloned the git repo, do `npn install` first to install all the dependencies,\n\ntests are written in jasmine, so just use `jasmine` to run the unit tests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleimd%2Freact-native-aws-signature","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleimd%2Freact-native-aws-signature","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleimd%2Freact-native-aws-signature/lists"}