This commit is contained in:
parent
98191fd098
commit
d272fa90b4
20 changed files with 574 additions and 27 deletions
|
@ -1,8 +1,9 @@
|
|||
package webdebug
|
||||
|
||||
import (
|
||||
"crypto/ed25519"
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"crypto/x509"
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
@ -64,7 +65,10 @@ func createLocalUser(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
publicKey, privateKey, err := ed25519.GenerateKey(nil)
|
||||
// publicKey, privateKey, err := ed25519.GenerateKey(nil)
|
||||
privateKey, err := rsa.GenerateKey(rand.Reader, 2048)
|
||||
privateKeyBytes := x509.MarshalPKCS1PrivateKey(privateKey)
|
||||
publicKeyBytes := x509.MarshalPKCS1PublicKey(&privateKey.PublicKey)
|
||||
pkeyId := make([]byte, 64)
|
||||
_, err = rand.Read(pkeyId)
|
||||
if err != nil {
|
||||
|
@ -96,8 +100,8 @@ func createLocalUser(w http.ResponseWriter, r *http.Request) {
|
|||
Description: data.Description,
|
||||
IsBot: data.IsBot,
|
||||
ServerId: 1, // Hardcoded, Self is always first ID
|
||||
PublicKey: publicKey,
|
||||
PrivateKey: privateKey,
|
||||
PublicKey: publicKeyBytes,
|
||||
PrivateKey: privateKeyBytes,
|
||||
PasskeyId: pkeyId,
|
||||
}
|
||||
if data.Birthday != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue