Skip to content

Commit 30fafb0

Browse files
committed
remove pointless dependency on github.com/dchest/uniuri
1 parent f2e2ee4 commit 30fafb0

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

example/service.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"crypto/rsa"
88
"crypto/tls"
99
"crypto/x509"
10+
"encoding/base64"
1011
"encoding/xml"
1112
"flag"
1213
"fmt"
@@ -15,7 +16,6 @@ import (
1516
"strings"
1617

1718
"github.com/crewjam/saml/samlsp"
18-
"github.com/dchest/uniuri"
1919
"github.com/kr/pretty"
2020
)
2121

@@ -31,8 +31,14 @@ type Link struct {
3131
// CreateLink handles requests to create links
3232
func CreateLink(w http.ResponseWriter, r *http.Request) {
3333
account := r.Header.Get("X-Remote-User")
34+
35+
randomness := make([]byte, 8)
36+
if _, err := r.Body.Read(randomness); err != nil {
37+
http.Error(w, err.Error(), http.StatusInternalServerError)
38+
return
39+
}
3440
l := Link{
35-
ShortLink: uniuri.New(),
41+
ShortLink: base64.RawURLEncoding.EncodeToString(randomness),
3642
Target: r.FormValue("t"),
3743
Owner: account,
3844
}

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ toolchain go1.24.2
66

77
require (
88
github.com/beevik/etree v1.5.0
9-
github.com/dchest/uniuri v1.2.0
109
github.com/golang-jwt/jwt/v4 v4.5.2
1110
github.com/google/go-cmp v0.6.0
1211
github.com/kr/pretty v0.3.1

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
55
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
66
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
77
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
8-
github.com/dchest/uniuri v1.2.0 h1:koIcOUdrTIivZgSLhHQvKgqdWZq5d7KdMEWF1Ud6+5g=
9-
github.com/dchest/uniuri v1.2.0/go.mod h1:fSzm4SLHzNZvWLvWJew423PhAzkpNQYq+uNLq4kxhkY=
108
github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI=
119
github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
1210
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=

0 commit comments

Comments
 (0)