all repos — honk @ 0a861d18457411f32a33a897e0494e4dc35a582e

my fork of honk

add support for ed25519 httpsig keys
Ted Unangst tedu@tedunangst.com
Sun, 19 Jan 2020 03:44:38 -0500
commit

0a861d18457411f32a33a897e0494e4dc35a582e

parent

2d2594339703492189d3a2b90b7b0f039d44f09a

5 files changed, 20 insertions(+), 18 deletions(-)

jump to
M activity.goactivity.go

@@ -17,7 +17,6 @@ package main

import ( "bytes" - "crypto/rsa" "database/sql" "errors" "fmt"

@@ -58,11 +57,11 @@ }

return false } -func PostJunk(keyname string, key *rsa.PrivateKey, url string, j junk.Junk) error { +func PostJunk(keyname string, key httpsig.PrivateKey, url string, j junk.Junk) error { return PostMsg(keyname, key, url, j.ToBytes()) } -func PostMsg(keyname string, key *rsa.PrivateKey, url string, msg []byte) error { +func PostMsg(keyname string, key httpsig.PrivateKey, url string, msg []byte) error { client := http.DefaultClient req, err := http.NewRequest("POST", url, bytes.NewReader(msg)) if err != nil {
M fun.gofun.go

@@ -17,7 +17,6 @@ package main

import ( "crypto/rand" - "crypto/rsa" "crypto/sha512" "fmt" "html/template"

@@ -594,10 +593,11 @@ ziggies.Get(userid, &ki)

return ki } -var zaggies = cache.New(cache.Options{Filler: func(keyname string) (*rsa.PublicKey, bool) { +var zaggies = cache.New(cache.Options{Filler: func(keyname string) (httpsig.PublicKey, bool) { var data string row := stmtGetXonker.QueryRow(keyname, "pubkey") err := row.Scan(&data) + var key httpsig.PublicKey if err != nil { log.Printf("hitting the webs for missing pubkey: %s", keyname) j, err := GetJunk(keyname)

@@ -605,7 +605,7 @@ if err != nil {

log.Printf("error getting %s pubkey: %s", keyname, err) when := time.Now().UTC().Format(dbtimeformat) stmtSaveXonker.Exec(keyname, "failed", "pubkey", when) - return nil, true + return key, true } allinjest(originate(keyname), j) row = stmtGetXonker.QueryRow(keyname, "pubkey")

@@ -614,19 +614,19 @@ if err != nil {

log.Printf("key not found after ingesting") when := time.Now().UTC().Format(dbtimeformat) stmtSaveXonker.Exec(keyname, "failed", "pubkey", when) - return nil, true + return key, true } } - _, key, err := httpsig.DecodeKey(data) + _, key, err = httpsig.DecodeKey(data) if err != nil { log.Printf("error decoding %s pubkey: %s", keyname, err) - return nil, true + return key, true } return key, true }, Limit: 512}) -func zaggy(keyname string) *rsa.PublicKey { - var key *rsa.PublicKey +func zaggy(keyname string) httpsig.PublicKey { + var key httpsig.PublicKey zaggies.Get(keyname, &key) return key }
M go.modgo.mod

@@ -7,7 +7,7 @@ github.com/mattn/go-runewidth v0.0.6

golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4 golang.org/x/net v0.0.0-20190620200207-3b0461eec859 humungus.tedunangst.com/r/go-sqlite3 v1.1.3 - humungus.tedunangst.com/r/webs v0.6.31 + humungus.tedunangst.com/r/webs v0.6.34 ) go 1.11
M go.sumgo.sum

@@ -25,3 +25,5 @@ humungus.tedunangst.com/r/go-sqlite3 v1.1.3 h1:G2N4wzDS0NbuvrZtQJhh4F+3X+s7BF8b9ga8k38geUI=

humungus.tedunangst.com/r/go-sqlite3 v1.1.3/go.mod h1:FtEEmQM7U2Ey1TuEEOyY1BmphTZnmiEjPsNLEAkpf/M= humungus.tedunangst.com/r/webs v0.6.31 h1:xDgtESuVljephZA4GfcycwiOwJeeJYUIQbStFHceN1Y= humungus.tedunangst.com/r/webs v0.6.31/go.mod h1:S9sXpVSbgAIa24yYhnMN0C94LKHG+2rioS+NsiDimps= +humungus.tedunangst.com/r/webs v0.6.34 h1:C9S5L310Z1H4H681f/e4zwqGJLR53XoCTwDoHAq7UVo= +humungus.tedunangst.com/r/webs v0.6.34/go.mod h1:S9sXpVSbgAIa24yYhnMN0C94LKHG+2rioS+NsiDimps=
M honk.gohonk.go

@@ -16,7 +16,6 @@

package main import ( - "crypto/rsa" "flag" "fmt" "html/template"

@@ -26,6 +25,8 @@ "os"

"strconv" "strings" "time" + + "humungus.tedunangst.com/r/webs/httpsig" ) var softwareVersion = "develop"

@@ -42,19 +43,19 @@ About string

Key string URL string Options UserOptions - SecKey *rsa.PrivateKey + SecKey httpsig.PrivateKey } type UserOptions struct { - SkinnyCSS bool `json:",omitempty"` + SkinnyCSS bool `json:",omitempty"` OmitImages bool `json:",omitempty"` - Avatar string `json:",omitempty"` - MapLink string `json:",omitempty"` + Avatar string `json:",omitempty"` + MapLink string `json:",omitempty"` } type KeyInfo struct { keyname string - seckey *rsa.PrivateKey + seckey httpsig.PrivateKey } const serverUID int64 = -2