lamassuiot

module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: MPL-2.0

README

Lamassu IoT

Lamassu App

Lamassu is an IoT first PKI designed for industrial scenarios. This is the main code repository for Lamassu IoT where the product logic is being implemented. If you are looking for deployment instructions, please check the docs or the project's Docker Compose repository.

Using the GO clients

Lamassu provides easy to use GO clients for most of its APIs to help speeding up the development of aplications:

package main

import (
  "net/url"
  lamassuCAClient "github.com/lamassuiot/lamassuiot/pkg/ca/client"
  caDTO "github.com/lamassuiot/lamassuiot/pkg/ca/common/dto"
  "github.com/lamassuiot/lamassuiot/pkg/utils/client"
)

function main (){
    lamassuGatewayURL := "dev.lamassu.io"
    apiCAFile := "path/to/apigw.crt"
    
    caClient := lamassuCAClient.NewLamassuCAClient(client.ClientConfiguration{
		URL: &url.URL{
			Scheme: "https",
			Host:   lamassuGatewayURL,
			Path:   "/api/ca/",
		},
		AuthMethod: client.JWT,
		AuthMethodConfig: &client.JWTConfig{
			Username: "enroller",
			Password: "enroller",
			URL: &url.URL{
				Scheme: "https",
				Host:   "auth." + lamassuGatewayURL,
			},
			CACertificate: apiCAFile,
		},
		CACertificate: apiCAFile,
	})
    
    ca, err = caClient.CreateCA(context.Background(), caDTO.Pki, caName, caDTO.PrivateKeyMetadata{KeyType: "rsa", KeyBits: 2048}, caDTO.Subject{CN: caName}, 365*time.Hour, 30*time.Hour)
}


Running Unit tests

#For pretty printing
go install github.com/haveyoudebuggedit/gotestfmt/v2/cmd/gotestfmt@v2.3.1


go test -json -v ./pkg/ca/server/api/service/ | gotestfmt
go test -json -v ./pkg/dms-enroller/server/api/service/ | gotestfmt
go test -json -v ./pkg/device-manager/server/api/service/ | gotestfmt

Directories

Path Synopsis
backend module
cmd
ca
connectors
awsiot Module
core module
engines
crypto/aws Module
crypto/pkcs11 Module
eventbus/amqp Module
eventbus/aws Module
monolithic module
pkg
ocsp/server/crypto/ocsp
Package ocsp parses OCSP responses as specified in RFC 2560.
Package ocsp parses OCSP responses as specified in RFC 2560.
sdk module
shared
aws Module
http Module
subsystems Module
test

Jump to

Keyboard shortcuts

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