Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

📱 iOS DeviceCheck SDK for Go - query and modify the per-device bits

License

Notifications You must be signed in to change notification settings

ridedott/device-check-go

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

device-check-go

📱 iOS DeviceCheck SDK for Go - query and modify the per-device bits

Installation

go get github.com/rinchsan/device-check-go

Getting started

Initialize SDK

import "github.com/rinchsan/device-check-go"

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

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

if err := client.UpdateTwoBits("DEVICE_TOKEN", true, true); err != nil {
	// handle errors
}

Validate device token

if err := client.ValidateDeviceToken("DEVICE_TOKEN"); err != nil {
	// handle errors
}

Apple documentation

About

📱 iOS DeviceCheck SDK for Go - query and modify the per-device bits

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.2%
  • Lua 0.8%