notes on basic structure
This commit is contained in:
parent
49dd33dc2f
commit
3915036ebd
18 changed files with 166 additions and 7 deletions
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright © 2024 NAME HERE <EMAIL ADDRESS>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
11
README.md
11
README.md
|
@ -2,4 +2,13 @@
|
|||
|
||||
> dumb horizontal scaling (e.g. sharing app keys, failures)
|
||||
|
||||
for when nodes are infrequently made, and if data isn't shared it's not too bad
|
||||
for when nodes are infrequently made, and if data isn't shared it's not too bad
|
||||
|
||||
|
||||
- [ ] read trusted registry key (called from cli)
|
||||
- [ ] boot server self key (on server, readable by cli)
|
||||
- [ ] read server key (encrypted to self)
|
||||
- [ ] activate server (called from cli, sent to each server)
|
||||
- [ ] send value (server to server)
|
||||
- [ ] store keys/addrs
|
||||
- [ ] read value (server to server)
|
3
box.go
3
box.go
|
@ -1,3 +0,0 @@
|
|||
package trade
|
||||
|
||||
// age encryption
|
11
file.go
Normal file
11
file.go
Normal file
|
@ -0,0 +1,11 @@
|
|||
package trade
|
||||
|
||||
// Load the server's private key
|
||||
func Load(password string, path string) PrivServer {
|
||||
return res
|
||||
}
|
||||
|
||||
// Save the server's private key
|
||||
func Save(password string, path string, s PrivServer) error {
|
||||
return err
|
||||
}
|
13
get.go
Normal file
13
get.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
package trade
|
||||
|
||||
// Get retrieves and stores a value from peers
|
||||
func (t *KV) Get(k string) (any, error) {
|
||||
// debate over expiry of values or using a common KV interface...
|
||||
// like using kvcache...
|
||||
// try getting locally:
|
||||
res, ok := t.local[k]
|
||||
if !ok {
|
||||
// for peer in peers, grab value:
|
||||
}
|
||||
return res, nil
|
||||
}
|
10
go.mod
10
go.mod
|
@ -1,3 +1,13 @@
|
|||
module git.bivouac.wiki/use/trade
|
||||
|
||||
go 1.22.5
|
||||
|
||||
require (
|
||||
aead.dev/minisign v0.3.0
|
||||
filippo.io/age v1.2.1
|
||||
)
|
||||
|
||||
require (
|
||||
golang.org/x/crypto v0.24.0 // indirect
|
||||
golang.org/x/sys v0.21.0 // indirect
|
||||
)
|
||||
|
|
8
go.sum
Normal file
8
go.sum
Normal file
|
@ -0,0 +1,8 @@
|
|||
aead.dev/minisign v0.3.0 h1:8Xafzy5PEVZqYDNP60yJHARlW1eOQtsKNp/Ph2c0vRA=
|
||||
aead.dev/minisign v0.3.0/go.mod h1:NLvG3Uoq3skkRMDuc3YHpWUTMTrSExqm+Ij73W13F6Y=
|
||||
filippo.io/age v1.2.1 h1:X0TZjehAZylOIj4DubWYU1vWQxv9bJpo+Uu2/LGhi1o=
|
||||
filippo.io/age v1.2.1/go.mod h1:JL9ew2lTN+Pyft4RiNGguFfOpewKwSHm5ayKD/A4004=
|
||||
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
|
||||
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
|
||||
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
|
||||
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
5
kv.go
Normal file
5
kv.go
Normal file
|
@ -0,0 +1,5 @@
|
|||
package trade
|
||||
|
||||
type KV struct {
|
||||
local map[string]any
|
||||
}
|
5
newreg.go
Normal file
5
newreg.go
Normal file
|
@ -0,0 +1,5 @@
|
|||
package trade
|
||||
|
||||
func NewRegistry() Registry {
|
||||
|
||||
}
|
11
objreg.go
Normal file
11
objreg.go
Normal file
|
@ -0,0 +1,11 @@
|
|||
package trade
|
||||
|
||||
import (
|
||||
"aead.dev/minisign"
|
||||
"filippo.io/age"
|
||||
)
|
||||
|
||||
type Registry struct {
|
||||
PublicAge age.Recipient
|
||||
PublicMinisign minisign.PublicKey
|
||||
}
|
12
objserver.go
Normal file
12
objserver.go
Normal file
|
@ -0,0 +1,12 @@
|
|||
package trade
|
||||
|
||||
import (
|
||||
"aead.dev/minisign"
|
||||
"filippo.io/age"
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
Addr string
|
||||
PublicAge age.Recipient
|
||||
PublicMinisign minisign.PublicKey
|
||||
}
|
11
peerstore.go
Normal file
11
peerstore.go
Normal file
|
@ -0,0 +1,11 @@
|
|||
package trade
|
||||
|
||||
// SavePeers writes peers to file
|
||||
func SavePeers(s []Server) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// LoadPeers from file
|
||||
func LoadPeers() ([]Server, error) {
|
||||
return res, err
|
||||
}
|
11
privreg.go
Normal file
11
privreg.go
Normal file
|
@ -0,0 +1,11 @@
|
|||
package trade
|
||||
|
||||
import (
|
||||
"aead.dev/minisign"
|
||||
"filippo.io/age"
|
||||
)
|
||||
|
||||
type PrivRegistry struct {
|
||||
AgePriv age.X25519Identity
|
||||
MinisignPriv minisign.PrivateKey
|
||||
}
|
11
privserver.go
Normal file
11
privserver.go
Normal file
|
@ -0,0 +1,11 @@
|
|||
package trade
|
||||
|
||||
import (
|
||||
"aead.dev/minisign"
|
||||
"filippo.io/age"
|
||||
)
|
||||
|
||||
type PrivServer struct {
|
||||
AgePriv age.X25519Identity
|
||||
MinisignPriv minisign.PrivateKey
|
||||
}
|
3
proof.go
3
proof.go
|
@ -1,3 +0,0 @@
|
|||
package trade
|
||||
|
||||
// minisign proof of commands
|
12
regaddserver.go
Normal file
12
regaddserver.go
Normal file
|
@ -0,0 +1,12 @@
|
|||
package trade
|
||||
|
||||
// add a server at an address
|
||||
func RegAddServer(a Addr) error {
|
||||
// read the server's key
|
||||
// check signature
|
||||
// sign servers key
|
||||
// send signature to server
|
||||
// send to all other servers
|
||||
// send list of peers to server
|
||||
return nil
|
||||
}
|
5
servergenkey.go
Normal file
5
servergenkey.go
Normal file
|
@ -0,0 +1,5 @@
|
|||
package trade
|
||||
|
||||
func ServerGenKey() {
|
||||
|
||||
}
|
10
set.go
Normal file
10
set.go
Normal file
|
@ -0,0 +1,10 @@
|
|||
package trade
|
||||
|
||||
// Set stores & sends a value to all verified peers
|
||||
func (t *KV) Set(k string, v any) error {
|
||||
// store in local cache
|
||||
t.local[k] = v
|
||||
// for server in servers
|
||||
|
||||
return err
|
||||
}
|
Loading…
Add table
Reference in a new issue