SSH server entry point - take 2 #99
@ -43,14 +43,14 @@ func(s *SshKeyStore) AddFromFile(ctx context.Context, fp string, sessionId strin
|
|||||||
return fmt.Errorf("Failed to parse public key: %v", err)
|
return fmt.Errorf("Failed to parse public key: %v", err)
|
||||||
}
|
}
|
||||||
k := append([]byte{0x01}, pubKey.Marshal()...)
|
k := append([]byte{0x01}, pubKey.Marshal()...)
|
||||||
s.store.SetPrefix(storage.DATATYPE_CUSTOM)
|
s.store.SetPrefix(storage.DATATYPE_EXTEND)
|
||||||
logg.Infof("Added key", "sessionId", sessionId, "public key", string(publicBytes))
|
logg.Infof("Added key", "sessionId", sessionId, "public key", string(publicBytes))
|
||||||
return s.store.Put(ctx, k, []byte(sessionId))
|
return s.store.Put(ctx, k, []byte(sessionId))
|
||||||
}
|
}
|
||||||
|
|
||||||
func(s *SshKeyStore) Get(ctx context.Context, pubKey ssh.PublicKey) (string, error) {
|
func(s *SshKeyStore) Get(ctx context.Context, pubKey ssh.PublicKey) (string, error) {
|
||||||
s.store.SetLanguage(nil)
|
s.store.SetLanguage(nil)
|
||||||
s.store.SetPrefix(storage.DATATYPE_CUSTOM)
|
s.store.SetPrefix(storage.DATATYPE_EXTEND)
|
||||||
k := append([]byte{0x01}, pubKey.Marshal()...)
|
k := append([]byte{0x01}, pubKey.Marshal()...)
|
||||||
v, err := s.store.Get(ctx, k)
|
v, err := s.store.Get(ctx, k)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -5,6 +5,10 @@ import (
|
|||||||
"git.defalsify.org/vise.git/persist"
|
"git.defalsify.org/vise.git/persist"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
DATATYPE_EXTEND = 128
|
||||||
|
)
|
||||||
|
|
||||||
type Storage struct {
|
type Storage struct {
|
||||||
Persister *persist.Persister
|
Persister *persist.Persister
|
||||||
UserdataDb db.Db
|
UserdataDb db.Db
|
||||||
|
Loading…
Reference in New Issue
Block a user