diff --git a/crypto/lux_key.go b/crypto/lux_key.go new file mode 100644 index 0000000..dc24e0a --- /dev/null +++ b/crypto/lux_key.go @@ -0,0 +1,26 @@ +package crypto + +import ( + "crypto/rand" + "lux/types" + + "github.com/google/uuid" +) + +type LuxKey struct { + Type types.LuxType + Id uuid.UUID + Key []byte +} + +func (key *LuxKey) NewLuxKey(keyType types.LuxType) error { + key.Type = keyType + key.Id = uuid.New() + key.Key = make([]byte, 32) + + if _, err := rand.Read(key.Key); err != nil { + return err + } else { + return nil + } +} diff --git a/go.mod b/go.mod index 5721b4f..b2558c6 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,7 @@ module lux go 1.23.4 -require gopkg.in/ini.v1 v1.67.0 // indirect +require ( + github.com/google/uuid v1.6.0 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect +) diff --git a/go.sum b/go.sum index a8937af..c563d2f 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,4 @@ +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= diff --git a/types/lux_type.go b/types/lux_type.go new file mode 100644 index 0000000..95e5e00 --- /dev/null +++ b/types/lux_type.go @@ -0,0 +1,8 @@ +package types + +type LuxType uint + +const ( + LuxTypeHost = 0 + LuxTypeNode +)