{"id":25765670,"url":"https://github.com/tab/mobileid","last_synced_at":"2026-06-13T17:31:30.902Z","repository":{"id":279101597,"uuid":"937665253","full_name":"tab/mobileid","owner":"tab","description":"Go client for the Mobile-ID API","archived":false,"fork":false,"pushed_at":"2025-02-23T18:46:36.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-23T19:35:23.241Z","etag":null,"topics":["authentication","go","golang","mobile-id"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"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/tab.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-23T16:08:45.000Z","updated_at":"2025-02-23T18:46:38.000Z","dependencies_parsed_at":"2025-02-23T19:45:45.935Z","dependency_job_id":null,"html_url":"https://github.com/tab/mobileid","commit_stats":null,"previous_names":["tab/mobileid"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tab%2Fmobileid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tab%2Fmobileid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tab%2Fmobileid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tab%2Fmobileid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tab","download_url":"https://codeload.github.com/tab/mobileid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240944063,"owners_count":19882503,"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":["authentication","go","golang","mobile-id"],"created_at":"2025-02-26T22:27:17.503Z","updated_at":"2026-06-13T17:31:30.898Z","avatar_url":"https://github.com/tab.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Mobile-ID client\n\nGolang client for the Mobile-ID API (https://www.mobile-id.lt/en/).\nIt is a simple wrapper around the API, which helps easily integrate Mobile-ID authentication into Golang applications.\n\n## Features\n\n- Flexible client configuration\n- Concurrent processing\n- Optional TLS configuration (certificate pinning)\n\n## Installation\n\nUse `go get` to install the package\n\n```sh\ngo get -u github.com/tab/mobileid\n```\n\n## Usage\n\n### Creating a Client\n\nCreate a new client using `NewClient()` and customize its configuration using chainable methods.\n\n```go\npackage main\n\nimport (\n  \"context\"\n  \"log\"\n  \"time\"\n\n  \"github.com/tab/mobileid\"\n)\n\nfunc main() {\n  client := mobileid.NewClient().\n    WithRelyingPartyName(\"DEMO\").\n    WithRelyingPartyUUID(\"00000000-0000-0000-0000-000000000000\").\n    WithHashType(\"SHA512\").\n    WithText(\"Enter PIN1\").\n    WithTextFormat(\"GSM-7\").\n    WithLanguage(\"ENG\").\n    WithURL(\"https://tsp.demo.sk.ee/mid-api\").\n    WithTimeout(60 * time.Second)\n\n  if err := client.Validate(); err != nil {\n    log.Fatal(\"Invalid configuration:\", err)\n  }\n\n  // Further processing...\n}\n```\n\n### Start Authentication\n\nInitiate a new authentication session with the `Mobile-ID` provider by calling `CreateSession`.\nThis function generates a random hash, constructs the session request, and returns a session that includes an identifier and a verification code.\n\n```go\nfunc main() {\n  // Create a client...\n\n\n  phoneNumber := \"+37268000769\"\n  identity := \"60001017869\"\n\n  session, err := client.CreateSession(context.Background(), phoneNumber, identity)\n  if err != nil {\n    log.Fatal(\"Error creating session:\", err)\n  }\n\n  fmt.Println(\"Session created:\", session)\n}\n```\n\n### Fetch Session\n\n```go\nfunc main() {\n  // Create a client...\n\n  person, err := client.FetchSession(context.Background(), sessionId)\n  if err != nil {\n    log.Fatal(\"Error fetching session:\", err)\n  }\n\n  fmt.Println(\"Session status:\", session.State)\n}\n```\n\n### Async Example\n\nFor applications requiring the processing of multiple authentication sessions simultaneously, `Mobile-ID` provides a worker model.\nCreate a worker using `NewWorker`, configure its concurrency and queue size, and then start processing.\n\n```go\npackage main\n\nimport (\n  \"context\"\n  \"fmt\"\n  \"sync\"\n  \"time\"\n\n  \"github.com/tab/mobileid\"\n)\n\nfunc main() {\n  client := mobileid.NewClient().\n    WithRelyingPartyName(\"DEMO\").\n    WithRelyingPartyUUID(\"00000000-0000-0000-0000-000000000000\").\n    WithHashType(\"SHA512\").\n    WithText(\"Enter PIN1\").\n    WithTextFormat(\"GSM-7\").\n    WithLanguage(\"ENG\").\n    WithURL(\"https://tsp.demo.sk.ee/mid-api\").\n    WithTimeout(60 * time.Second)\n\n  identities := map[string]string{\n    \"51307149560\": \"+37269930366\",\n    \"60001017869\": \"+37268000769\",\n    \"60001018800\": \"+37200000566\",\n    \"60001019939\": \"+37200000266\",\n    \"60001019947\": \"+37207110066\",\n    \"60001019950\": \"+37201100266\",\n    \"60001019961\": \"+37200000666\",\n    \"60001019972\": \"+37201200266\",\n    \"60001019983\": \"+37213100266\",\n    \"50001018908\": \"+37266000266\",\n  }\n\n  worker := mobileid.NewWorker(client).\n    WithConcurrency(50).\n    WithQueueSize(100)\n\n  ctx := context.Background()\n\n  worker.Start(ctx)\n  defer worker.Stop()\n\n  var wg sync.WaitGroup\n\n  for identity, phoneNumber := range identities {\n    wg.Add(1)\n\n    session, err := client.CreateSession(ctx, phoneNumber, identity)\n    if err != nil {\n      fmt.Println(\"Error creating session:\", err)\n      wg.Done()\n    }\n    fmt.Println(\"Session created:\", session)\n\n    resultCh := worker.Process(ctx, session.Id)\n    go func() {\n      defer wg.Done()\n      result := \u003c-resultCh\n      if result.Err != nil {\n        fmt.Println(\"Error fetching session:\", result.Err)\n      } else {\n        fmt.Println(\"Fetched person:\", result.Person)\n      }\n    }()\n  }\n\n  wg.Wait()\n}\n```\n\n## Certificate pinning (optional)\n\n```go\npackage main\n\nimport (\n  \"context\"\n  \"fmt\"\n  \"sync\"\n  \"time\"\n\n  \"github.com/tab/mobileid\"\n)\n\nfunc main() {\n  manager, err := mobileid.NewCertificateManager(\"./certs\")\n  if err != nil {\n    fmt.Println(\"Failed to create certificate manager:\", err)\n  }\n  tlsConfig := manager.TLSConfig()\n\n  client := mobileid.NewClient().\n    WithRelyingPartyName(\"DEMO\").\n    WithRelyingPartyUUID(\"00000000-0000-0000-0000-000000000000\").\n    WithHashType(\"SHA512\").\n    WithText(\"Enter PIN1\").\n    WithTextFormat(\"GSM-7\").\n    WithLanguage(\"ENG\").\n    WithURL(\"https://tsp.demo.sk.ee/mid-api\").\n    WithTimeout(60 * time.Second).\n    WithTLSConfig(tlsConfig)\n\n  // Further processing...\n```\n\n## Documentation\n\n- [Documentation](https://tab.github.io/mobileid)\n- [GoDoc](https://pkg.go.dev/github.com/tab/mobileid)\n- [Mobile-ID Documentation](https://github.com/SK-EID/MID)\n\n## License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n\n## Acknowledgements\n\n- [SK ID Solutions](https://www.skidsolutions.eu)\n- [Mobile-ID](https://www.mobile-id.lt/en)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftab%2Fmobileid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftab%2Fmobileid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftab%2Fmobileid/lists"}