working on key store

This commit is contained in:
mykola2312 2024-12-29 09:13:20 +02:00
parent 9884c07eeb
commit abfa7260b1
4 changed files with 40 additions and 1 deletions

26
crypto/lux_key.go Normal file
View file

@ -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
}
}

5
go.mod
View file

@ -2,4 +2,7 @@ module lux
go 1.23.4 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
)

2
go.sum
View file

@ -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 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=

8
types/lux_type.go Normal file
View file

@ -0,0 +1,8 @@
package types
type LuxType uint
const (
LuxTypeHost = 0
LuxTypeNode
)