From d246cdee51cc537884fd541ca6db6e58a1c1ab6c Mon Sep 17 00:00:00 2001 From: lash Date: Fri, 27 Sep 2024 21:25:21 +0100 Subject: [PATCH] Rename datatype const name for ssh prefix --- internal/ssh/keystore.go | 4 ++-- internal/storage/storage.go | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/ssh/keystore.go b/internal/ssh/keystore.go index fed7233..b80727b 100644 --- a/internal/ssh/keystore.go +++ b/internal/ssh/keystore.go @@ -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) } 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)) return s.store.Put(ctx, k, []byte(sessionId)) } func(s *SshKeyStore) Get(ctx context.Context, pubKey ssh.PublicKey) (string, error) { s.store.SetLanguage(nil) - s.store.SetPrefix(storage.DATATYPE_CUSTOM) + s.store.SetPrefix(storage.DATATYPE_EXTEND) k := append([]byte{0x01}, pubKey.Marshal()...) v, err := s.store.Get(ctx, k) if err != nil { diff --git a/internal/storage/storage.go b/internal/storage/storage.go index 53f4392..231a1db 100644 --- a/internal/storage/storage.go +++ b/internal/storage/storage.go @@ -5,6 +5,10 @@ import ( "git.defalsify.org/vise.git/persist" ) +const ( + DATATYPE_EXTEND = 128 +) + type Storage struct { Persister *persist.Persister UserdataDb db.Db