Lamassu IoT
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