Skip to content

Commit

Permalink
NOISSUE - Fix linting errors in MD files (#213)
Browse files Browse the repository at this point in the history
* fix linting errors in md files

Signed-off-by: Musilah <[email protected]>

* fix lint errors

Signed-off-by: Musilah <[email protected]>

---------

Signed-off-by: Musilah <[email protected]>
  • Loading branch information
Musilah authored Dec 16, 2024
1 parent 21a5f40 commit 38719be
Show file tree
Hide file tree
Showing 25 changed files with 181 additions and 211 deletions.
6 changes: 2 additions & 4 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: API
---

# API

## Reference

API reference in the Swagger UI can be found at: [https://api.magistrala.abstractmachines.fr][api]
Expand Down Expand Up @@ -2588,7 +2586,7 @@ Access-Control-Expose-Headers: Location
### Add policies
Only actions defined on [Predefined Policies section][predefined-policies] are allowed.
Only actions defined on Predefined Policies section are allowed.
```bash
curl -sSiX POST http://localhost/users/policies -H "Content-Type: application/json" -H "Authorization: Bearer <user_token>" -d @- << EOF
Expand Down Expand Up @@ -2643,7 +2641,7 @@ Access-Control-Expose-Headers: Location
### Update policies
Only actions defined on [Predefined Policies section][predefined-policies] are allowed.
Only actions defined on Predefined Policies section are allowed.
```bash
curl -sSiX PUT http://localhost/users/policies -H "Content-Type: application/json" -H "Authorization: Bearer <user_token>" -d @- << EOF
Expand Down
2 changes: 0 additions & 2 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: Architecture
---

# Architecture

## Components

SuperMQ IoT platform is comprised of the following services:
Expand Down
1 change: 0 additions & 1 deletion docs/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
title: Authentication
---

# Authentication

## User authentication

Expand Down
6 changes: 2 additions & 4 deletions docs/authorization.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: Authorization
---

# Authorization

SuperMQ allows for fine-grained control over user permissions, taking into account hierarchical relationships between entities domains, groups, channels, and things. The structure and functionality of an authorization system implemented using [SpiceDB](https://github.com/authzed/spicedb) and its associated [schema language](https://authzed.com/docs/reference/schema-lang). `auth` service backed by SpiceDB manages permissions for users, domains, groups, channels, and things.

## Domains
Expand Down Expand Up @@ -623,7 +621,7 @@ Like domains, groups also have four types of relations

Group administrator users have access to update, delete, assign, and unassign to the group and also have access to update, delete, assign, and unassign all of its child entities

From the [previous viewer example](#domain-viewer), let's take **user_3** who has **viewer relation** with **domain_1**, which means **user_3 will be able to view all the entities created by others but cannot make any edits or updates on them.** ***<span style={{ color:'blue' }}>user_3 will have access to create entities in domain_1 </span>***
From the [previous viewer example](#domain-viewer), let's take **user_3** who has **viewer relation** with **domain_1**, which means **user_3 will be able to view all the entities created by others but cannot make any edits or updates on them.** **<span style={{ color:'blue' }}>user_3 will have access to create entities in domain_1 </span>**

**user_3 creates new thing_101, channel_101, and group_101**.

Expand Down Expand Up @@ -693,7 +691,7 @@ EOF

![group_users_administrator_2](diagrams/group_users_administrator_2.svg)

***Members of domain 1 will not have access by default to any of the entities in domain 1, access shall be granted for specific entities by domain administrator or individual entity administrator.***
**Members of domain 1 will not have access by default to any of the entities in domain 1, access shall be granted for specific entities by domain administrator or individual entity administrator.**

**Administrator of group_101 (user_3), assigns user_4 with administrator relation.**
**When domain member user_4 becomes an administrator of group_101, user_4 can able to update, delete, assign, and unassign to group_101. Since group_101 has channel_101 and thing_101 as children. The user_5 has administrator access on group_101 child entities channel_101 and thing_101.**
Expand Down
6 changes: 2 additions & 4 deletions docs/benchmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: Test Spec
---

# Test spec

## Tools

- [MZBench][mzbench]
Expand Down Expand Up @@ -121,15 +119,15 @@ Testing environment to be determined.

In this scenario, large number of requests are sent to HTTP adapter service every second. This test checks how much time HTTP adapter needs to respond to each request.

#### Results
#### Message Publishing Results

TBD

### Create and get client

In this scenario, large number of requests are sent to things service to create things and than to retrieve their data. This test checks how much time things service needs to respond to each request.

#### Results
#### Create and Get Client Results

TBD

Expand Down
125 changes: 61 additions & 64 deletions docs/bootstrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: Bootstrap
---

# Bootstrap

`Bootstrapping` refers to a self-starting process that is supposed to proceed without external input. SuperMQ platform supports bootstrapping process, but some of the preconditions need to be fulfilled in advance. The device can trigger a bootstrap when:s

- device contains only bootstrap credentials and no SuperMQ credentials
Expand Down Expand Up @@ -124,61 +122,60 @@ In order to disconnect, the same request should be sent with the value of `state

### Using curl request for secure bootstrap configuration

- *Encrypt the external key.*
- _Encrypt the external key._

First, encrypt the external key of your thing using AES encryption. The encryption key is specified by the `SMQ_BOOTSTRAP_ENCRYPT_KEY` environment variable. Use a library or utility that supports AES encryption to do this. Here's an example of how to encrypt using Go:

```go
package main

import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"fmt"
"io"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"fmt"
"io"
)

type reader struct {
encKey []byte
encKey []byte
}

func (r reader) encrypt(in []byte) ([]byte, error) {
block, err := aes.NewCipher(r.encKey)
if err != nil {
return nil, err
}
ciphertext := make([]byte, aes.BlockSize+len(in))
iv := ciphertext[:aes.BlockSize]
if _, err := io.ReadFull(rand.Reader, iv); err != nil {
return nil, err
}
stream := cipher.NewCFBEncrypter(block, iv)
stream.XORKeyStream(ciphertext[aes.BlockSize:], in)
return ciphertext, nil
block, err := aes.NewCipher(r.encKey)
if err != nil {
return nil, err
}
ciphertext := make([]byte, aes.BlockSize+len(in))
iv := ciphertext[:aes.BlockSize]
if _, err := io.ReadFull(rand.Reader, iv); err != nil {
return nil, err
}
stream := cipher.NewCFBEncrypter(block, iv)
stream.XORKeyStream(ciphertext[aes.BlockSize:], in)
return ciphertext, nil
}

func main() {
data := []byte("<external_key>")
data := []byte("<external_key>")

r := reader{
encKey: []byte("<crypto_key>"),
}
r := reader{
encKey: []byte("<crypto_key>"),
}

encryptedData, err := r.encrypt(data)
if err != nil {
fmt.Println("Error encrypting data:", err)
return
}
encryptedData, err := r.encrypt(data)
if err != nil {
fmt.Println("Error encrypting data:", err)
return
}

fmt.Printf("%x\n", encryptedData)
fmt.Printf("%x\n", encryptedData)
}
```

Replace `<external_key>` and `<crypto_key>` with the thing's external key and `SMQ_BOOTSTRAP_ENCRYPT_KEY` respectively.

- *Make a request to the bootstrap service.*

- _Make a request to the bootstrap service._

Once the key is encrypted, make a request to the Bootstrap service. Here's how to do this using `curl`:

Expand All @@ -196,46 +193,46 @@ curl --location 'http://localhost:9013/things/bootstrap/secure/<external_id>' \
--header 'authorization: Thing <encyrpted_external_key>' --output ~/<desired\>/<path\>/<file_name.txt>
```

- *Decrypt the response*
- _Decrypt the response_

Finally, decrypt the response using a function. Here's an example of how to do this using Go:

```go
package main

import (
"crypto/aes"
"crypto/cipher"
"log"
"os"
"crypto/aes"
"crypto/cipher"
"log"
"os"
)

func main() {
encodedData, err := os.ReadFile("~/<desired\>/<path\>/<enc_file_name.txt>")
if err != nil {
log.Fatal(err)
}

key := []byte("<crypto_key>")

block, err := aes.NewCipher(key)
if err != nil {
log.Fatal(err)
}

if len(encodedData) < aes.BlockSize {
log.Fatal("ciphertext too short")
}

iv := encodedData[:aes.BlockSize]
encodedData = encodedData[aes.BlockSize:]
stream := cipher.NewCFBDecrypter(block, iv)
stream.XORKeyStream(encodedData, encodedData)

err = os.WriteFile("~/<desired\>/<path\>/<decry_file_name.txt>", encodedData, 0644)
if err != nil {
log.Fatal(err)
}
encodedData, err := os.ReadFile("~/<desired\>/<path\>/<enc_file_name.txt>")
if err != nil {
log.Fatal(err)
}

key := []byte("<crypto_key>")

block, err := aes.NewCipher(key)
if err != nil {
log.Fatal(err)
}

if len(encodedData) < aes.BlockSize {
log.Fatal("ciphertext too short")
}

iv := encodedData[:aes.BlockSize]
encodedData = encodedData[aes.BlockSize:]
stream := cipher.NewCFBDecrypter(block, iv)
stream.XORKeyStream(encodedData, encodedData)

err = os.WriteFile("~/<desired\>/<path\>/<decry_file_name.txt>", encodedData, 0644)
if err != nil {
log.Fatal(err)
}
}
```

Expand All @@ -246,13 +243,13 @@ To use SuperMQ CLI for the secure bootstrap configuration, use the following com
```bash
supermq-cli bootstrap secure <external_id> <external_key> <crypto_key>
```

for example

```bash
supermq-cli bootstrap bootstrap secure '09:6:0:sb:sa' 'key' 'v7aT0HGxJxt2gULzr3RHwf4WIf6DusPp'
```


For more information about the Bootstrap service API, please check out the [API documentation][api-docs].

[api-docs]: https://github.com/absmach/supermq/blob/main/api/openapi/bootstrap.yml
2 changes: 0 additions & 2 deletions docs/certs.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ title: Certs
---


# Certs

Provisioning is a process of configuration of an IoT platform in which system operator creates and sets-up different entities used in the platform - users, groups, channels and things.

## Certs Service
Expand Down
3 changes: 1 addition & 2 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
title: CLI
---

# CLI

SuperMQ CLI makes it easy to manage users, things, channels and messages.

Expand Down Expand Up @@ -911,7 +910,7 @@ Response should look like this:

This command is used to set the flags to be used by CLI in a local TOML file. The default location of the TOML file is in the same directory as the CLI binary. To change the location of the TOML file you can run the command:

```
```bash
supermq-cli config <parameter> <value> -c "cli/file_name.toml"
```

Expand Down
6 changes: 2 additions & 4 deletions docs/dev-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
title: Developer's Guide
---

# Developer's guide

## Getting SuperMQ

Expand All @@ -17,7 +16,7 @@ cd $SOMEPATH/supermq

## Building

### Prerequisites
### Building Prerequisites

Make sure that you have [Protocol Buffers][protocol-buffers] (version 21.12) compiler (`protoc`) installed.

Expand Down Expand Up @@ -214,7 +213,7 @@ which will do this copying of the binaries.
## Deployment

### Prerequisites
### Deployment Prerequisites

SuperMQ depends on several infrastructural services, notably the default message broker, [NATS][nats] and [PostgreSQL][postgresql] database.

Expand Down Expand Up @@ -288,7 +287,6 @@ Please assure that MQTT microservice has `node_modules` installed, as explained
[cleanup-docker]: #cleaning-up-your-dockerized-supermq-setup
[docker-compose-ref]: https://docs.docker.com/compose/reference/overview/
[docker-compose-extend]: https://docs.docker.com/compose/extends/
[increase-nodes-memory]: https://medium.com/tomincode/increasing-nodes-memory-337dfb1a60dd
[go-cross-compile]: https://dave.cheney.net/2015/08/22/cross-compilation-with-go-1-5
[go-arm]: https://www.alexruf.net/golang/arm/raspberrypi/2016/01/16/cross-compile-with-go-1-5-for-raspberry-pi.html
[wiki-go-arm]: https://go.dev/wiki/GoArm
Expand Down
2 changes: 0 additions & 2 deletions docs/edge.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ title: Edge
---


# Edge

SuperMQ IoT platform provides services for supporting management of devices on the edge. Typically, IoT solution includes devices (sensors/actuators) deployed in far edge and connected through some proxy gateway. Although most devices could be connected to the SuperMQ directly, using gateways decentralizes system, decreases load on the cloud and makes setup less difficult. Also, gateways can provide additional data processing, filtering and storage.

Services that can be used on gateway to enable data and control plane for edge:
Expand Down
2 changes: 0 additions & 2 deletions docs/entities.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ title: Entities
---


# Entities

Client is a component that will replace and unify the SuperMQ Things and Users services. The purpose is to represent generic client accounts. Each client is identified using its identity and secret. The client will differ from Things service to Users service but we aim to achieve 1:1 implementation between the clients whilst changing how client secret works. This includes client secret generation, usage, modification and storage

## Generic Client Entity
Expand Down
Loading

0 comments on commit 38719be

Please sign in to comment.