forked from tangled.org/core
Monorepo for Tangled — https://tangled.org

appview: use actual secrets

Changed files
+9 -3
appview
+9 -3
appview/db/registration.go
···
package db
import (
+
"crypto/rand"
"database/sql"
+
"encoding/hex"
"fmt"
"log"
"time"
-
-
"github.com/google/uuid"
)
type Registration struct {
···
return &registration, nil
}
+
func genSecret() string {
+
key := make([]byte, 32)
+
rand.Read(key)
+
return hex.EncodeToString(key)
+
}
+
func (d *DB) GenerateRegistrationKey(domain, did string) (string, error) {
// sanity check: does this domain already have a registration?
reg, err := d.RegistrationByDomain(domain)
···
}
}
-
secret := uuid.New().String()
+
secret := genSecret()
_, err = d.db.Exec(`
insert into registrations (domain, did, secret)