use UUIDs now

This commit is contained in:
2025-03-07 14:53:35 -05:00
parent 235299b65d
commit 4389660f65
3 changed files with 9 additions and 3 deletions

View File

@@ -12,6 +12,8 @@ import (
"strings" "strings"
"time" "time"
"unicode" "unicode"
"github.com/google/uuid"
) )
const ( const (
@@ -85,7 +87,7 @@ func Authenticate(username string, password string) (int32, string, bool) {
// THE FUNNY THING // THE FUNNY THING
// for range 2500000 { // for range 2500000 {
// secrets = append(secrets, entries.Secret{ // secrets = append(secrets, entries.Secret{
// ID: security.RandBase58String(32), // ID: uuid.New().String()
// Description: "some website", // Description: "some website",
// URL: "https://example.com", // URL: "https://example.com",
// Notes: "test notes something here i like writing notes lalalalala test test", // Notes: "test notes something here i like writing notes lalalalala test test",

View File

@@ -4,6 +4,8 @@ import (
"maxwarden/entries" "maxwarden/entries"
"maxwarden/security" "maxwarden/security"
"os" "os"
"github.com/google/uuid"
) )
func main() { func main() {
@@ -13,7 +15,7 @@ func main() {
testData := []entries.Secret{} testData := []entries.Secret{}
for range 10 { for range 10 {
dummyData := entries.Secret{ID: security.RandBase58String(32), Description: "Twitter / X.com", URL: "https://x.com", Notes: "2fa is enabled for this account.", Username: "@johntwitter", Password: "##CORRECT_HORSE_BATTERY_STAPLE_51"} dummyData := entries.Secret{ID: uuid.New().String(), Description: "Twitter / X.com", URL: "https://x.com", Notes: "2fa is enabled for this account.", Username: "@johntwitter", Password: "##CORRECT_HORSE_BATTERY_STAPLE_51"}
testData = append(testData, dummyData) testData = append(testData, dummyData)
} }

View File

@@ -8,6 +8,8 @@ import (
"sort" "sort"
"strings" "strings"
"time" "time"
"github.com/google/uuid"
) )
type Secret struct { type Secret struct {
@@ -163,7 +165,7 @@ func Add(userId int32, masterKey string, secret Secret) error {
return errors.New("user secrets are null") return errors.New("user secrets are null")
} }
secret.ID = security.RandBase58String(32) secret.ID = uuid.New().String()
secret.Modified = time.Now() secret.Modified = time.Now()
secret.Created = time.Now() secret.Created = time.Now()