{"id":19288561,"url":"https://github.com/mark2b/awscloudfrontsigner.swift","last_synced_at":"2025-10-30T00:09:29.924Z","repository":{"id":56901310,"uuid":"335964434","full_name":"mark2b/AWSCloudFrontSigner.swift","owner":"mark2b","description":"SignedCookies creator for AWS CloudFront","archived":false,"fork":false,"pushed_at":"2021-02-05T06:22:33.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-03-14T19:04:37.513Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","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/mark2b.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}},"created_at":"2021-02-04T13:36:10.000Z","updated_at":"2022-11-06T09:07:24.000Z","dependencies_parsed_at":"2022-08-21T02:50:50.811Z","dependency_job_id":null,"html_url":"https://github.com/mark2b/AWSCloudFrontSigner.swift","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mark2b%2FAWSCloudFrontSigner.swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mark2b%2FAWSCloudFrontSigner.swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mark2b%2FAWSCloudFrontSigner.swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mark2b%2FAWSCloudFrontSigner.swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mark2b","download_url":"https://codeload.github.com/mark2b/AWSCloudFrontSigner.swift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240393021,"owners_count":19794197,"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","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-11-09T22:09:30.320Z","updated_at":"2025-10-30T00:09:24.903Z","avatar_url":"https://github.com/mark2b.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AWSCloudFrontSigner\n\nThis package provides easy way to access to the AWS CloudFront protected content.\n\nThere are two ways to access to the AWS CloudFront protected content: by Signed URL or by Signed Cookies. \n  \nCurrently this package provides only Signed Cookies access method.\n\n\n## Prerequisites\n\nIf you already have CloudFront distribition you need protected it by private key. \n\nhttps://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-signed-cookies.html\n\n1. Create private key and store it in application\n\n\t**openssl genrsa -out private.pem 2048**\n\n\tThis key will be used to initialize CookiesSigner\n\n2. Create public key and upload it into CloudFront console.\n\n\t**openssl rsa -in private.pem -outform PEM -pubout -out public.pem**\n\t\n    As result of upload, you will get Public Key ID.\n    This ID will be used to initialize CookiesSigner (**keyPairId** parameter)\n\n\n\n\n## Usage\n\nFirst create instance of *CookiesSigner* as shown in example below.\n\n`\nlet signer = CookiesSigner(resourceUrl: resourceUrl, keyPairId: \"K1234567890120\", privateKey: \"PRIVATE KEY\")\n`\n\nAnd then use one of signer's methods to get signed object:\n\n1. Create signed cookies for HTTP request\n\n\t`let cookies = try signer.makeCookies()`\n\n2. Create HTTP request with signed cookies \n\n\t`let request = try signer.makeURLRequest()`\n\n3. Create AVURLAsset with signed cookies.\n\n\t`let asset = try signer.AVURLAsset()`\n\n\n### CookiesSigner Parameters:\n- resourceUrl: Primary resource you need access to.\n- policyResource: Resource name will be set to policy. Optional. In case of missing resourceUrl will be used.\n- dateLessThan: DateLessThan parameter of custom policy. Optional. In case of missing current date + one minute will be used.\n- dateGreaterThan: DateGreaterThan parameter of custom policy. Optional\n- ipAddress: IpAddress parameter of custom policy. Optional\n- domain: Domain parameter of cookie. Optional. In case of missing resourceUrl.host will be used.\n- path: Path parameter of cookie. Optional. In case of missing \"/\" will be used.\n- policy: User provided policy as string. Optional. This parameter overrides automatically build policy based on parameters: policyResource, dateLessThan, dateGreaterThan, ipAddress.\n- keyPairId: Public key ID registered in the CloudFront console\n- privateKey: Private key in format base64 without header and footer. Optional. In case of missing, parameters privateKeyFile or secKey will be used\n- privateKeyFile: Path to the file containing Private key in format base64 with header and footer. Optional. In case of missing, parameters privateKey or secKey will be used\n- secKey: Instance of SecKey object. This parameter overrides parameters privateKey and privateKeyFile\n\n\n## Installation\n\nAWSCloudFrontSigner is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod \"AWSCloudFrontSigner\"\n```\n\n## Author\n\nMark Berner, mark@berner.dev\n\n## License\n\nAWSCloudFrontSigner is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmark2b%2Fawscloudfrontsigner.swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmark2b%2Fawscloudfrontsigner.swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmark2b%2Fawscloudfrontsigner.swift/lists"}