Documentation ¶
Overview ¶
Copyright 2018 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2018 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2018 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2018 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2018 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2018 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2018 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2018 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2018 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2018 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
View Source
const ( AuthSetKeyIdData = "id_data" AuthSetKeyPubKey = "pubkey" AuthSetKeyDeviceId = "device_id" AuthSetKeyStatus = "status" AuthSetKeyIdDataSha256 = "id_data_sha256" )
View Source
const ( DevStatusAccepted = "accepted" DevStatusRejected = "rejected" DevStatusPending = "pending" DevStatusPreauth = "preauthorized" DevKeyIdData = "id_data" DevKeyStatus = "status" )
View Source
const (
LimitMaxDeviceCount = "max_devices"
)
Variables ¶
View Source
var (
ValidLimits = []string{LimitMaxDeviceCount}
)
Functions ¶
func IsValidLimit ¶
Types ¶
type AuthReq ¶
type AuthReq struct { IdData string `json:"id_data" bson:"id_data"` TenantToken string `json:"tenant_token" bson:"tenant_token"` PubKey string `json:"pubkey"` //helpers, not serialized PubKeyStruct *rsa.PublicKey `json:"-" bson:"-"` }
note: fields with underscores need the 'bson' decorator otherwise the underscore will be removed upon write to mongo
type AuthSet ¶
type AuthSet struct { Id string `json:"id" bson:"_id,omitempty"` IdData string `json:"id_data" bson:"id_data,omitempty"` IdDataStruct map[string]interface{} `bson:"id_data_struct,omitempty"` IdDataSha256 []byte `bson:"id_data_sha256,omitempty"` PubKey string `json:"pubkey" bson:"pubkey,omitempty"` DeviceId string `json:"-" bson:"device_id,omitempty"` Timestamp *time.Time `json:"ts" bson:"ts,omitempty"` Status string `json:"status" bson:"status,omitempty"` }
type AuthSetUpdate ¶
type AuthSetUpdate struct { IdData string `bson:"id_data,omitempty"` IdDataStruct map[string]interface{} `bson:"id_data_struct,omitempty"` IdDataSha256 []byte `bson:"id_data_sha256,omitempty"` PubKey string `bson:"pubkey,omitempty"` DeviceId string `bson:"device_id,omitempty"` Timestamp *time.Time `bson:"ts,omitempty"` Status string `bson:"status,omitempty"` }
type DevAdmAuthSet ¶
type DevAdmAuthSet struct { Id string `json:"id" bson:"_id,omitempty"` DeviceIdentity string `json:"device_identity" bson:"id_data"` Key string `json:"key" bson:"pubkey"` DeviceId string `json:"device_id" bson:"device_id,omitempty"` RequestTime *time.Time `json:"request_time" bson:"request_time"` Status string `json:"status" bson:"status"` Attributes map[string]interface{} `json:"attributes" bson:"attributes"` }
func NewDevAdmAuthSet ¶
func NewDevAdmAuthSet(a AuthSet) (*DevAdmAuthSet, error)
type DevAdmAuthSetReq ¶
type DevAdmAuthSetReq struct { DeviceId string `json:"device_identity" valid:"required"` Key string `json:"key" valid:"required"` //decoded, human-readable identity attribute set Attributes DeviceAuthAttributes `json:"-"` }
func ParseDevAdmAuthSetReq ¶
func ParseDevAdmAuthSetReq(source io.Reader) (*DevAdmAuthSetReq, error)
func (*DevAdmAuthSetReq) Validate ¶
func (r *DevAdmAuthSetReq) Validate() error
type Device ¶
type Device struct { Id string `json:"id" bson:"_id,omitempty"` PubKey string `json:"-" bson:",omitempty"` IdData string `json:"id_data" bson:"id_data,omitempty"` IdDataStruct map[string]interface{} `bson:"id_data_struct,omitempty"` IdDataSha256 []byte `bson:"id_data_sha256,omitempty"` Status string `json:"-" bson:",omitempty"` Decommissioning bool `json:"decommissioning" bson:",omitempty"` CreatedTs time.Time `json:"created_ts" bson:"created_ts,omitempty"` UpdatedTs time.Time `json:"updated_ts" bson:"updated_ts,omitempty"` AuthSets []AuthSet `json:"auth_sets" bson:"-"` }
note: fields with underscores need the 'bson' decorator otherwise the underscore will be removed upon write to mongo
type DeviceAuthAttributes ¶
type DeviceUpdate ¶
type DeviceUpdate struct { PubKey string `json:"-" bson:",omitempty"` IdData string `json:"id_data" bson:"id_data,omitempty"` IdDataStruct map[string]interface{} `bson:"id_data_struct,omitempty"` IdDataSha256 []byte `bson:"id_data_sha256,omitempty"` Status string `json:"-" bson:",omitempty"` Decommissioning *bool `json:"-" bson:",omitempty"` UpdatedTs *time.Time `json:"updated_ts" bson:"updated_ts,omitempty"` }
type PreAuthReq ¶
type PreAuthReq struct { DeviceId string `json:"device_id" valid:"required" bson:"device_id"` AuthSetId string `json:"auth_set_id" valid:"required" bson:"auth_set_id"` IdData string `json:"id_data" valid:"required" bson:"id_data"` PubKey string `json:"pubkey" valid:"required" bson:"pubkey"` }
func ParsePreAuthReq ¶
func ParsePreAuthReq(source io.Reader) (*PreAuthReq, error)
func (*PreAuthReq) Validate ¶
func (r *PreAuthReq) Validate() error
Click to show internal directories.
Click to hide internal directories.