M accounts/confirm.go => accounts/confirm.go +4 -4
@@ 6,7 6,7 @@ import (
"fmt"
"time"
- "github.com/google/uuid"
+ "github.com/segmentio/ksuid"
"hg.code.netlandish.com/~netlandish/gobwebs"
"hg.code.netlandish.com/~netlandish/gobwebs/database"
)
@@ 40,7 40,7 @@ func NewConfirmation(ctype int, user gobwebs.User, expires time.Time) *Confirmat
c := &Confirmation{
Type: ctype,
UserID: user.GetID(),
- Key: uuid.New().String(),
+ Key: ksuid.New().String(),
ExpireTime: expires.In(time.UTC),
}
return c
@@ 101,7 101,7 @@ func (c *Confirmation) Store(db *sql.DB) error {
return fmt.Errorf("Can not store confirmation with either Type or UserID missing")
}
if c.Key == "" {
- c.Key = uuid.New().String()
+ c.Key = ksuid.New().String()
}
ctx := database.Context(context.Background(), db)
if err := database.WithTx(ctx, nil, func(tx *sql.Tx) error {
@@ 115,7 115,7 @@ func (c *Confirmation) Store(db *sql.DB) error {
return err // Other error, return
}
// Key exists, try a new one
- c.Key = uuid.New().String()
+ c.Key = ksuid.New().String()
}
row := tx.QueryRowContext(ctx, `
M go.mod => go.mod +3 -8
@@ 4,14 4,15 @@ go 1.18
require (
git.sr.ht/~sircmpwn/dowork v0.0.0-20220826210403-887bcd8841d8
+ github.com/Masterminds/squirrel v1.5.3
github.com/alexedwards/argon2id v0.0.0-20211130144151-3585854a6387
github.com/alexedwards/scs/postgresstore v0.0.0-20211203064041-370cc303b69f
github.com/alexedwards/scs/v2 v2.5.0
github.com/go-playground/validator/v10 v10.10.0
- github.com/google/uuid v1.1.1
github.com/labstack/echo/v4 v4.7.2
github.com/lib/pq v1.10.4
github.com/minio/minio-go/v7 v7.0.22
+ github.com/segmentio/ksuid v1.0.4
github.com/spazzymoto/echo-scs-session v1.0.0
github.com/vaughan0/go-ini v0.0.0-20130923145212-a98ad7ee00ec
golang.org/x/text v0.3.7
@@ 19,24 20,20 @@ require (
)
require (
- github.com/Masterminds/squirrel v1.5.3 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20220113124808-70ae35bab23f // indirect
- github.com/aws/aws-sdk-go v1.42.38 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/emersion/go-message v0.15.0 // indirect
github.com/emersion/go-pgpmail v0.2.0 // indirect
- github.com/emersion/go-sasl v0.0.0-20211008083017-0b9dcfb154ac // indirect
- github.com/emersion/go-smtp v0.15.1-0.20220119145048-f9aa4f40ae74 // indirect
github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang/protobuf v1.4.2 // indirect
github.com/google/go-cmp v0.5.6 // indirect
+ github.com/google/uuid v1.1.1 // indirect
github.com/gopherjs/gopherjs v0.0.0-20220221023154-0b2280d3ff96 // indirect
- github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.10 // indirect
github.com/jtolds/gls v4.20.0+incompatible // indirect
github.com/klauspost/compress v1.13.5 // indirect
@@ 69,6 66,4 @@ require (
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/protobuf v1.23.0 // indirect
gopkg.in/ini.v1 v1.57.0 // indirect
- petersanchez.com/carrier/ses v0.0.0-20220907011636-809d400a8dfd // indirect
- petersanchez.com/carrier/smtp v0.0.0-20220907011636-809d400a8dfd // indirect
)
M go.sum => go.sum +2 -20
@@ 1,5 1,3 @@
-git.sr.ht/~sircmpwn/dowork v0.0.0-20210820133136-d3970e97def3 h1:9WCv5cK67s2SiY/R4DWT/OchEsFnfYDz3lbevKxZ4QI=
-git.sr.ht/~sircmpwn/dowork v0.0.0-20210820133136-d3970e97def3/go.mod h1:8neHEO3503w/rNtttnR0JFpQgM/GFhaafVwvkPsFIDw=
git.sr.ht/~sircmpwn/dowork v0.0.0-20220826210403-887bcd8841d8 h1:L9G3YfLV2yTYDDudFEe9YhbHRbxBfESBpcPzZ8juwPg=
git.sr.ht/~sircmpwn/dowork v0.0.0-20220826210403-887bcd8841d8/go.mod h1:8neHEO3503w/rNtttnR0JFpQgM/GFhaafVwvkPsFIDw=
github.com/Masterminds/squirrel v1.5.3 h1:YPpoceAcxuzIljlr5iWpNKaql7hLeG1KLSrhvdHpkZc=
@@ 18,8 16,6 @@ github.com/alexedwards/scs/postgresstore v0.0.0-20211203064041-370cc303b69f/go.m
github.com/alexedwards/scs/v2 v2.4.0/go.mod h1:ToaROZxyKukJKT/xLcVQAChi5k6+Pn1Gvmdl7h3RRj8=
github.com/alexedwards/scs/v2 v2.5.0 h1:zgxOfNFmiJyXG7UPIuw1g2b9LWBeRLh3PjfB9BDmfL4=
github.com/alexedwards/scs/v2 v2.5.0/go.mod h1:ToaROZxyKukJKT/xLcVQAChi5k6+Pn1Gvmdl7h3RRj8=
-github.com/aws/aws-sdk-go v1.42.38 h1:/fNQTB4ZUQOa8+cfX7C7F0zyXRdiN1jGKKXt3+5nmzM=
-github.com/aws/aws-sdk-go v1.42.38/go.mod h1:OGr6lGMAKGlG9CVrYnWYDKIyb829c6EVBRjxqjmPepc=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
@@ 37,11 33,6 @@ github.com/emersion/go-message v0.15.0 h1:urgKGqt2JAc9NFJcgncQcohHdiYb803YTH9OQw
github.com/emersion/go-message v0.15.0/go.mod h1:wQUEfE+38+7EW8p8aZ96ptg6bAb1iwdgej19uXASlE4=
github.com/emersion/go-pgpmail v0.2.0 h1:BU9kEGQcDVXi6n0v3JBsWAikyo63xsUGZ1lnVaWa6ks=
github.com/emersion/go-pgpmail v0.2.0/go.mod h1:8mQ8Rpn+w28DDaiP8HvJuZjSAymaWr87K3zA/bwwkU0=
-github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21/go.mod h1:iL2twTeMvZnrg54ZoPDNfJaJaqy0xIQFuBdrLsmspwQ=
-github.com/emersion/go-sasl v0.0.0-20211008083017-0b9dcfb154ac h1:tn/OQ2PmwQ0XFVgAHfjlLyqMewry25Rz7jWnVoh4Ggs=
-github.com/emersion/go-sasl v0.0.0-20211008083017-0b9dcfb154ac/go.mod h1:iL2twTeMvZnrg54ZoPDNfJaJaqy0xIQFuBdrLsmspwQ=
-github.com/emersion/go-smtp v0.15.1-0.20220119145048-f9aa4f40ae74 h1:acM1NVVy6a1V1XCZBP20gY/8YBsmAyGJ5Wcd6m2ma34=
-github.com/emersion/go-smtp v0.15.1-0.20220119145048-f9aa4f40ae74/go.mod h1:qm27SGYgoIPRot6ubfQ/GpiPy/g3PaZAVRxiO/sDUgQ=
github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594 h1:IbFBtwoTQyw0fIM5xv1HF+Y+3ZijDR839WMulgxCcUY=
github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594/go.mod h1:aqO8z8wPrjkscevZJFVE1wXJrLpC5LtJG7fqLOsPb2U=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
@@ 80,9 71,6 @@ github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gopherjs/gopherjs v0.0.0-20220221023154-0b2280d3ff96 h1:QJq7UBOuoynsywLk+aC75rC2Cbi2+lQRDaLaizhA+fA=
github.com/gopherjs/gopherjs v0.0.0-20220221023154-0b2280d3ff96/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k=
-github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
-github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
-github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
@@ 146,7 134,6 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
-github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
@@ 168,6 155,8 @@ github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTE
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc=
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
+github.com/segmentio/ksuid v1.0.4 h1:sBo2BdShXjmcugAMwjugoGUdUV0pcxY5mW4xKRn3v4c=
+github.com/segmentio/ksuid v1.0.4/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
@@ 262,15 251,8 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
-petersanchez.com/carrier v0.1.0 h1:8hzO/7keWU9EBDLPqqlD8TwzjNnvj4N+xLDVM+kvPbQ=
-petersanchez.com/carrier v0.1.0/go.mod h1:S98n9YxPLfj0B3iCjMIVssjlKI6Bvc8PbGVmVFkggfw=
petersanchez.com/carrier v0.1.1 h1:yZWQVPb0FRhgFAblyE5wFn4vNE5BhFAbt9G+QB/ov+Q=
petersanchez.com/carrier v0.1.1/go.mod h1:EUf2gWVEWQO75kBxDfJ5qOvGyIqd7G5IgkOrfr2QuuQ=
-petersanchez.com/carrier/ses v0.0.0-20220907011636-809d400a8dfd h1:Pbte8SLPMco6YVYLCPV7NOFB+S1fxFYMTaC+AWNPEsU=
-petersanchez.com/carrier/ses v0.0.0-20220907011636-809d400a8dfd/go.mod h1:g+C98l3rPPSWAI42dlUSsGQHrhRPEzQhVskKeWDEIyY=
-petersanchez.com/carrier/smtp v0.0.0-20220907011636-809d400a8dfd h1:sA8bwvpQ3M31FQ9TjrhUrwe5aPUBZvmU93qf3OmUwTY=
-petersanchez.com/carrier/smtp v0.0.0-20220907011636-809d400a8dfd/go.mod h1:PR7KQGA+5z5sq7IV/1zH+XLY2BCrgJfl9+mviiE+cxY=