ttjsv2

package
v3.31.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package ttjsv2 provides the claiming client implementation for The Things Join Server 2.0 API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClaimData added in v3.24.1

type ClaimData struct {
	HomeNetID string  `json:"homeNetID"`
	HomeNSID  *string `json:"homeNSID,omitempty"`
	Locked    bool    `json:"locked"`
}

ClaimData contains information about the claim.

type ClaimRequest added in v3.24.1

type ClaimRequest struct {
	OwnerToken           string  `json:"ownerToken"`
	HomeNetID            string  `json:"homeNetID"`
	HomeNSID             *string `json:"homeNSID,omitempty"`
	ASID                 string  `json:"asID"`
	RegenerateOwnerToken *bool   `json:"regenerateOwnerToken,omitempty"`
	Lock                 *bool   `json:"lock,omitempty"`
	KEK                  *KEK    `json:"kek,omitempty"`
}

ClaimRequest is the claim request message.

func (ClaimRequest) Apply added in v3.28.1

func (req ClaimRequest) Apply(ctx context.Context, c Component) (ClaimRequest, error)

Apply applies the context to the request.

type Component

type Component interface {
	httpclient.Provider
	KeyService() crypto.KeyService
}

Component abstracts the component.

type Config

type Config struct {
	NetID           types.NetID
	NSID            *types.EUI64
	ASID            string
	JoinEUIPrefixes []types.EUI64Prefix
	ConfigFile
}

Config is the configuration for The Things Join Server claiming client.

type ConfigFile added in v3.24.1

type ConfigFile struct {
	URL string    `yaml:"url"`
	TLS TLSConfig `yaml:"tls"`

	// BasicAuth is no longer used and is only kept for backwards compatibility.
	// TODO: Remove (https://github.com/TheThingsNetwork/lorawan-stack/issues/6049)
	BasicAuth struct {
		Username string `yaml:"username"`
		Password string `yaml:"password"`
	} `yaml:"basic-auth"`
}

ConfigFile defines the configuration file for The Things Join Server claiming client.

type EndDevicesErrors added in v3.27.1

type EndDevicesErrors map[string]ErrorResponse

EndDevicesErrors is a map of end device identifiers to error responses.

type ErrorResponse added in v3.24.1

type ErrorResponse struct {
	Message string `json:"message"`
}

ErrorResponse is a message that may be returned by The Things Join Server in case of an error.

type KEK added in v3.24.1

type KEK struct {
	Label string `json:"label"`
	Key   string `json:"key"`
}

KEK contains the key encryption key.

type TLSConfig added in v3.24.1

type TLSConfig struct {
	RootCA      string `yaml:"root-ca"`
	Source      string `yaml:"source"`
	Certificate string `yaml:"certificate"`
	Key         string `yaml:"key"`
}

TLSConfig contains the TLS configuration.

func (TLSConfig) IsZero added in v3.24.1

func (conf TLSConfig) IsZero() bool

IsZero returns true if the TLSConfig is empty.

func (TLSConfig) TLSConfig added in v3.24.1

func (conf TLSConfig) TLSConfig(fetcher fetch.Interface, ks crypto.KeyService) (*tls.Config, error)

TLSConfig returns the *tls.Config.

type TTJS

type TTJS struct {
	Component
	// contains filtered or unexported fields
}

TTJS is a client that claims end devices on a The Things Join Server.

func NewClient added in v3.24.1

func NewClient(c Component, fetcher fetch.Interface, conf Config) *TTJS

NewClient applies the config and returns a new TTJS client.

func (*TTJS) BatchUnclaim added in v3.27.1

func (c *TTJS) BatchUnclaim(
	ctx context.Context,
	ids []*ttnpb.EndDeviceIdentifiers,
) error

BatchUnclaim implements EndDeviceClaimer.

func (*TTJS) Claim

func (c *TTJS) Claim(ctx context.Context, joinEUI, devEUI types.EUI64, claimAuthenticationCode string) error

Claim implements EndDeviceClaimer.

func (*TTJS) GetClaimStatus

func (c *TTJS) GetClaimStatus(
	ctx context.Context, ids *ttnpb.EndDeviceIdentifiers,
) (*ttnpb.GetClaimStatusResponse, error)

GetClaimStatus implements EndDeviceClaimer.

func (*TTJS) SupportsJoinEUI

func (c *TTJS) SupportsJoinEUI(eui types.EUI64) bool

SupportsJoinEUI implements EndDeviceClaimer.

func (*TTJS) Unclaim

func (c *TTJS) Unclaim(ctx context.Context, ids *ttnpb.EndDeviceIdentifiers) error

Unclaim implements EndDeviceClaimer.

Jump to

Keyboard shortcuts

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