{"id":16971543,"url":"https://github.com/thomastjdev/nim_awssigv4","last_synced_at":"2026-02-17T13:01:45.145Z","repository":{"id":219539171,"uuid":"748960371","full_name":"ThomasTJdev/nim_awsSigV4","owner":"ThomasTJdev","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-14T07:14:40.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-07T13:43:15.247Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Nim","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ThomasTJdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2024-01-27T06:48:10.000Z","updated_at":"2025-02-14T07:14:40.000Z","dependencies_parsed_at":"2024-01-28T07:26:28.926Z","dependency_job_id":"298d11f0-3357-4585-8b1d-baa27e3f228f","html_url":"https://github.com/ThomasTJdev/nim_awsSigV4","commit_stats":null,"previous_names":["thomastjdev/nim_awssigv4"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ThomasTJdev/nim_awsSigV4","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThomasTJdev%2Fnim_awsSigV4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThomasTJdev%2Fnim_awsSigV4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThomasTJdev%2Fnim_awsSigV4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThomasTJdev%2Fnim_awsSigV4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ThomasTJdev","download_url":"https://codeload.github.com/ThomasTJdev/nim_awsSigV4/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThomasTJdev%2Fnim_awsSigV4/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29545295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T13:00:00.370Z","status":"ssl_error","status_checked_at":"2026-02-17T12:57:14.072Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-10-14T00:52:24.188Z","updated_at":"2026-02-17T13:01:45.127Z","avatar_url":"https://github.com/ThomasTJdev.png","language":"Nim","readme":"# awsSigV4\n\nThis package implements the AWS Signature Version 4 signing process. It provides\nthe core procedures for generating the canonical request, signed\nheaders, and for computing the signature itself. The presigned URL's can be\nused to call AWS services directly - e.g. accessing S3 objects, invoking Lambda\nfunctions, etc.\n\nWith the three main procedures, it's possible to implement the signing process:\n1. `canonicalRequest()` - generates the canonical request\n2. `stringToSign()` - generates the string to sign\n3. `calculateSignature()` - generates the signature\n\nBesides the three main procedures, there are also two helper procedures:\n1. `makeDateTime()` - generates the date and time in the format required by AWS\n2. `credentialScope()` - generates the credential scope\n\n\n## Example\n\nPlease see the `tests/` for a full replicatable example.\n\n```nim\nlet\n  accessKey = \"credsAccessKey\"\n  secretKey = \"credsSecretKey\"\n  tokenKey  = \"accessToken\"\n\n  bucketHost = \"my-book-bucket.s3.amazonaws.com\"\n  key        = \"files/test.txt\"\n\n  url       = \"https://\" \u0026 bucketHost \u0026 \"/\" \u0026 key\n  region    = \"us-east-1\"\n  service   = \"s3\"\n\n  httpMethod = HttpGet\n\n  payload   = \"\"\n  digest    = SHA256\n  expireSec = \"65\"\n  datetime  = makeDateTime()\n\nlet\n  scope     = credentialScope(region=region, service=service, date=datetime)\n  headers   = newHttpHeaders(@[(\"Host\", bucketHost)])\n\nvar\n  query = %*{\n            \"X-Amz-Algorithm\": $SHA256,\n            \"X-Amz-Credential\": accessKey \u0026 \"/\" \u0026 scope,\n            \"X-Amz-Date\": datetime,\n            \"X-Amz-Expires\": expireSec,\n          }\n\n# Using STS? Remember the token:\nif tokenKey != \"\":\n  query[\"X-Amz-Security-Token\"] = newJString(tokenKey)\n\nquery[\"X-Amz-SignedHeaders\"] = newJString(\"host\")\n\n\nlet\n  request = canonicalRequest(httpMethod, url, query, headers, payload,\n                            digest = UnsignedPayload)\n\n  sts = stringToSign(request, scope, date = datetime, digest = SHA256)\n\n  signature = calculateSignature(secret=secretKey, date = datetime, region = region,\n                                service = service, tosign = sts, digest = SHA256)\n\nlet\n  presigned = url \u0026 \"?\" \u0026 request.split(\"\\n\")[2] \u0026 \"\u0026X-Amz-Signature=\" \u0026 signature\n```\n\n\n## Original Sources\n\nThis project is a rewrite of original code from the following sources:\n- [sigv4](https://github.com/disruptek/sigv4)\n- [depot](https://github.com/guzba/depot)\n\nThe motivation for this rewrite was to eliminate the dependency on the `balls` package that was present in the `sigv4` package.\n\nNow, this code only has a dependency on the `crunchy` package by @guzba.\n\n\n## Use Cases\n\nThis package is used by the following packages:\n- [awsS3](https://github.com/ThomasTJdev/nim_awsS3)\n- [awsSTS](https://github.com/ThomasTJdev/nim_awsSTS)\n\n\n## Debugging\n\nIf your signature is not working, run the same command with `aws cli` using\nthe `--debug` flag. This will print out the signature that `aws cli` is\ngenerating. Compare this to the signature that this package is generating.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomastjdev%2Fnim_awssigv4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomastjdev%2Fnim_awssigv4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomastjdev%2Fnim_awssigv4/lists"}