Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rinchsan/device-check-go
:iphone: iOS DeviceCheck SDK for Go - query and modify the per-device bits
https://github.com/rinchsan/device-check-go
Last synced: about 2 months ago
JSON representation
:iphone: iOS DeviceCheck SDK for Go - query and modify the per-device bits
- Host: GitHub
- URL: https://github.com/rinchsan/device-check-go
- Owner: rinchsan
- License: mit
- Created: 2019-04-11T13:09:11.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-05-10T14:13:44.000Z (8 months ago)
- Last Synced: 2024-07-31T20:53:14.554Z (5 months ago)
- Language: Go
- Homepage:
- Size: 108 KB
- Stars: 25
- Watchers: 1
- Forks: 7
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - device-check-go - Go client library for interacting with [iOS DeviceCheck API](https://developer.apple.com/documentation/devicecheck) v1. (Third-party APIs / Utility/Miscellaneous)
- awesome-go-extra - device-check-go - query and modify the per-device bits|15|5|3|2019-04-11T13:09:11Z|2022-05-13T15:40:58Z| (Third-party APIs / Fail injection)
README
# device-check-go
![](https://github.com/rinchsan/device-check-go/workflows/CI/badge.svg)
![](https://img.shields.io/github/release/rinchsan/device-check-go.svg?colorB=7E7E7E)
[![](https://pkg.go.dev/badge/github.com/rinchsan/device-check-go.svg)](https://pkg.go.dev/github.com/rinchsan/device-check-go)
[![](https://codecov.io/github/rinchsan/device-check-go/coverage.svg?branch=main)](https://codecov.io/github/rinchsan/device-check-go?branch=main)
[![](https://goreportcard.com/badge/github.com/rinchsan/device-check-go)](https://goreportcard.com/report/github.com/rinchsan/device-check-go)
[![](https://awesome.re/mentioned-badge.svg)](https://awesome-go.com/#third-party-apis)
[![](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE):iphone: iOS DeviceCheck SDK for Go - query and modify the per-device bits
## Installation
```bash
go get github.com/rinchsan/device-check-go/v2
```## Getting started
### Initialize SDK
```go
import "github.com/rinchsan/device-check-go/v2"cred := devicecheck.NewCredentialFile("/path/to/private/key/file") // You can create credential also from raw string/bytes
cfg := devicecheck.NewConfig("ISSUER", "KEY_ID", devicecheck.Development)
client := devicecheck.New(cred, cfg)
````### Use DeviceCheck API
#### Query two bits
```go
var result devicecheck.QueryTwoBitsResult
if err := client.QueryTwoBits("DEVICE_TOKEN", &result); err != nil {
switch {
// Note that QueryTwoBits returns ErrBitStateNotFound error if no bits found
case errors.Is(err, devicecheck.ErrBitStateNotFound):
// handle ErrBitStateNotFound error
default:
// handle other errors
}
}
```#### Update two bits
```go
if err := client.UpdateTwoBits("DEVICE_TOKEN", true, true); err != nil {
// handle errors
}
```#### Validate device token
```go
if err := client.ValidateDeviceToken("DEVICE_TOKEN"); err != nil {
// handle errors
}
```## Apple documentation
- [iOS DeviceCheck API for Swift](https://developer.apple.com/documentation/devicecheck)
- [HTTP commands to query and modify the per-device bits](https://developer.apple.com/documentation/devicecheck/accessing_and_modifying_per-device_data)