commit 801554dbaf413cc9a5ba81279536a54c6d908c08
parent 4b87b0385e1edc786757f8bd27ab01f18d788973
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Sun, 29 Jan 2023 05:53:34 -0800
utils fn to generate a certificate for a link
Diffstat:
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/pkg/database/tableLinks.go b/pkg/database/tableLinks.go
@@ -2,6 +2,7 @@ package database
import (
"dkforest/pkg/utils"
+ "fmt"
"github.com/google/uuid"
"github.com/sirupsen/logrus"
"html"
@@ -22,6 +23,18 @@ type Link struct {
Mirrors []LinksMirror
}
+func (l Link) GenOwnershipCert() string {
+ return fmt.Sprintf(""+
+ "DarkForest ownership certificate\n"+
+ "\n"+
+ "For the following onion address:\n"+
+ "%s\n"+
+ "\n"+
+ "Signed on: %s",
+ l.GetOnionAddr(),
+ time.Now().UTC().Format("January 02, 2006"))
+}
+
func (l Link) GetOnionAddr() string {
var onionV3Rgx = regexp.MustCompile(`[a-z2-7]{56}\.onion`)
return onionV3Rgx.FindString(l.URL)