idprovclient

package
v0.0.0-...-147f0cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscoverIdProvServer

func DiscoverIdProvServer() (url string, core string, error error)

DiscoverIdProvServer attempts to discover the provisioning server This returns its URL, the server core used, or an error if not found

func SubmitIdProvRequest

func SubmitIdProvRequest(clientID string, pubKey string, mac string, tlsClient *tlsclient.TLSClient) (
	status idprovapi.ProvisionStatus, token string, err error)

SubmitIdProvRequest send a request to provision this client and obtain an auth token This returns the request status, an encrypted token and an error If the status is approved the token will contain the auth token. The token is only usable by the owner of the private key and has a limited lifespan It should immediately be used to connect to the Hub and refresh for a new token with a longer lifespan. JWT decode allows to determine the expiry.

Types

type IdProvUserClient

type IdProvUserClient struct {
	// contains filtered or unexported fields
}

IdProvUserClient is a marshaller for provisioning client messages over https This uses the default serializer to marshal and unmarshal messages, eg JSON

type ManageIdProvClient

type ManageIdProvClient struct {
	// contains filtered or unexported fields
}

ManageIdProvClient is a hiveot client for communicating with the provisioning service using the message bus. This requires admin permissions.

func NewIdProvManageClient

func NewIdProvManageClient(hc *hubclient.HubClient) *ManageIdProvClient

func (*ManageIdProvClient) ApproveRequest

func (cl *ManageIdProvClient) ApproveRequest(ClientID string, clientType string) error

ApproveRequest approves a pending provisioning request

func (*ManageIdProvClient) GetRequests

func (cl *ManageIdProvClient) GetRequests(
	pending, approved, rejected bool) ([]idprovapi.ProvisionStatus, error)

GetRequests returns requests Expired requests are not included.

func (*ManageIdProvClient) PreApproveDevices

func (cl *ManageIdProvClient) PreApproveDevices(
	approvals []idprovapi.PreApprovedClient) error

PreApproveDevices uploads a list of pre-approved devices ID, MAC and PubKey

func (*ManageIdProvClient) RejectRequest

func (cl *ManageIdProvClient) RejectRequest(clientID string) error

RejectRequest rejects a pending provisioning request

func (*ManageIdProvClient) SubmitRequest

func (cl *ManageIdProvClient) SubmitRequest(
	clientID string, pubKey string, mac string) (
	status *idprovapi.ProvisionStatus, token string, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL