{"id":19948371,"url":"https://github.com/lukasmalkmus/icloud-go","last_synced_at":"2025-05-03T18:31:25.334Z","repository":{"id":49963748,"uuid":"370693615","full_name":"lukasmalkmus/icloud-go","owner":"lukasmalkmus","description":"Go client library for the CloudKit Web Services API.","archived":false,"fork":false,"pushed_at":"2021-06-07T18:00:45.000Z","size":67,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T19:06:28.383Z","etag":null,"topics":["apple","apple-cloudkit","cloudkit","cloudkit-js","icloud"],"latest_commit_sha":null,"homepage":"","language":"Go","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/lukasmalkmus.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-05-25T12:58:57.000Z","updated_at":"2024-09-04T01:29:13.000Z","dependencies_parsed_at":"2022-09-20T22:55:13.738Z","dependency_job_id":null,"html_url":"https://github.com/lukasmalkmus/icloud-go","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasmalkmus%2Ficloud-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasmalkmus%2Ficloud-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasmalkmus%2Ficloud-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasmalkmus%2Ficloud-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukasmalkmus","download_url":"https://codeload.github.com/lukasmalkmus/icloud-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252235370,"owners_count":21716209,"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":["apple","apple-cloudkit","cloudkit","cloudkit-js","icloud"],"created_at":"2024-11-13T00:40:29.963Z","updated_at":"2025-05-03T18:31:24.876Z","avatar_url":"https://github.com/lukasmalkmus.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iCloud Go\n\n[![Go Reference][gopkg_badge]][gopkg]\n[![Go Workflow][go_workflow_badge]][go_workflow]\n[![Coverage Status][coverage_badge]][coverage]\n[![Go Report][report_badge]][report]\n[![Latest Release][release_badge]][release]\n[![License][license_badge]][license]\n\n---\n\n## Table of Contents\n\n1. [Introduction](#introduction)\n1. [Installation](#Installation)\n1. [Authentication](#authentication)\n1. [Usage](#usage)\n1. [Contributing](#contributing)\n1. [License](#license)\n\n## Introduction\n\n_iCloud Go_ is a Go client library for using the [CloudKit Web Services][1] API.\nWhile the foundation of this package is powerfull enough to support the whole\nAPI, its main purpose is to provide enough features to create records in\nCloudKit. This serves my personal purpose of using this package for building\nvarious kinds of importers.\n\n  [1]: https://developer.apple.com/library/archive/documentation/DataManagement/Conceptual/CloudKitWebServicesReference/index.html\n\n## Installation\n\n### Install using `go get`\n\n```shell\n$ go get github.com/lukasmalkmus/icloud-go/icloud\n```\n\n### Install from source\n\n```shell\n$ git clone https://github.com/lukasmalkmus/icloud-go.git\n$ cd icloud-go\n$ make\n```\n\n## Authentication\n\nThis package only supports Server-to-Server authentication.\n\nYou can create a keypair using `openssl`:\n\n```shell\n$ openssl ecparam -name prime256v1 -genkey -noout -out eckey.pem\n```\n\nTo get the public key (to enter it on iCloud Dashboard):\n\n```shell\n$ openssl ec -in eckey.pem -pubout\n```\n\nTo get the private key (used by the client to sign requests):\n\n```shell\n$ openssl ec -in eckey.pem\n```\n\n## Usage\n\n```go\nimport \"github.com/lukasmalkmus/icloud-go/icloud\"\n\nvar (\n\tkeyID         = os.Getenv(\"ICLOUD_KEY_ID\")\n\tcontainer     = os.Getenv(\"ICLOUD_CONTAINER\")\n\trawPrivateKey = os.Getenv(\"ICLOUD_PRIVATE_KEY\")\n)\n\n// 1. Parse the private key.\nprivateKey, err := x509.ParseECPrivateKey([]byte(rawPrivateKey))\nif err != nil {\n\tlog.Fatal(err)\n}\n\n// 2. Create the iCloud client.\nclient, err := icloud.NewClient(container, keyID, privateKey, icloud.Development)\nif err != nil {\n\tlog.Fatal(err)\n}\n\n// 3. Create a record.\nif _, err = client.Records.Modify(context.Background(), icloud.Public, icloud.RecordsRequest{\n\tOperations: []icloud.RecordOperation{\n\t\t{\n\t\t\tType: icloud.Create,\n\t\t\tRecord: icloud.Record{\n\t\t\t\tType: \"MyRecord\",\n\t\t\t\tFields: icloud.Fields{\n\t\t\t\t\t{\n\t\t\t\t\t\tName:  \"MyField\",\n\t\t\t\t\t\tValue: \"Hello, World!\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tName:  \"MyOtherField\",\n\t\t\t\t\t\tValue: 1000,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n}); err != nil {\n\tlog.Fatal(err)\n}\n```\n\n## Contributing\n\nFeel free to submit PRs or to fill issues. Every kind of help is appreciated.\n\nBefore committing, `make` should run without any issues.\n\n## License\n\n\u0026copy; Lukas Malkmus, 2021\n\nDistributed under MIT License (`The MIT License`).\n\nSee [LICENSE](LICENSE) for more information.\n\n[![License Status][license_status_badge]][license_status]\n\n\u003c!-- Badges --\u003e\n\n[gopkg]: https://pkg.go.dev/github.com/lukasmalkmus/icloud-go\n[gopkg_badge]: https://img.shields.io/badge/doc-reference-007d9c?logo=go\u0026logoColor=white\u0026style=flat-square\n[go_workflow]: https://github.com/lukasmalkmus/icloud-go/actions?query=workflow%3Ago\n[go_workflow_badge]: https://img.shields.io/github/workflow/status/lukasmalkmus/icloud-go/go?style=flat-square\u0026ghcache=unused\n[coverage]: https://codecov.io/gh/lukasmalkmus/icloud-go\n[coverage_badge]: https://img.shields.io/codecov/c/github/lukasmalkmus/icloud-go.svg?style=flat-square\u0026ghcache=unused\n[report]: https://goreportcard.com/report/github.com/lukasmalkmus/icloud-go\n[report_badge]: https://goreportcard.com/badge/github.com/lukasmalkmus/icloud-go?style=flat-square\u0026ghcache=unused\n[release]: https://github.com/lukasmalkmus/icloud-go/releases/latest\n[release_badge]: https://img.shields.io/github/release/lukasmalkmus/icloud-go.svg?style=flat-square\u0026ghcache=unused\n[license]: https://opensource.org/licenses/MIT\n[license_badge]: https://img.shields.io/github/license/lukasmalkmus/icloud-go.svg?color=blue\u0026style=flat-square\u0026ghcache=unused\n[license_status]: https://app.fossa.com/projects/git%2Bgithub.com%2Flukasmalkmus%2Ficloud-go\n[license_status_badge]: https://app.fossa.com/api/projects/git%2Bgithub.com%2Flukasmalkmus%2Ficloud-go.svg?type=large\u0026ghcache=unused\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukasmalkmus%2Ficloud-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukasmalkmus%2Ficloud-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukasmalkmus%2Ficloud-go/lists"}