alpha
Login
or
Join now
alice.pds.demo.boltless.dev
/
core
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
2
Pulls
1
Pipelines
appview: use actual secrets
author
Anirudh Oppiliappan
date
2 years ago
(Feb 10, 2025, 5:21 PM +0200)
commit
f4afc8c4
f4afc8c41905f2ab75c77f0fc1817e0d5edfceae
parent
f0aa8229
f0aa822957895c8484fa9ec5517c500e63bb209f
+9
-3
1 changed file
Expand all
Collapse all
Unified
Split
appview
db
registration.go
+9
-3
appview/db/registration.go
View file
Reviewed
···
1
1
package db
2
2
3
3
import (
4
4
+
"crypto/rand"
4
5
"database/sql"
6
6
+
"encoding/hex"
5
7
"fmt"
6
8
"log"
7
9
"time"
8
8
-
9
9
-
"github.com/google/uuid"
10
10
)
11
11
12
12
type Registration struct {
···
101
101
return ®istration, nil
102
102
}
103
103
104
104
+
func genSecret() string {
105
105
+
key := make([]byte, 32)
106
106
+
rand.Read(key)
107
107
+
return hex.EncodeToString(key)
108
108
+
}
109
109
+
104
110
func (d *DB) GenerateRegistrationKey(domain, did string) (string, error) {
105
111
// sanity check: does this domain already have a registration?
106
112
reg, err := d.RegistrationByDomain(domain)
···
120
126
}
121
127
}
122
128
123
123
-
secret := uuid.New().String()
129
129
+
secret := genSecret()
124
130
125
131
_, err = d.db.Exec(`
126
132
insert into registrations (domain, did, secret)