dodo: Support Sketch agent

Change-Id: I4dcd6aab7d7a2c2e86aaf1ad8d36d30a649ab31d
diff --git a/core/installer/derived.go b/core/installer/derived.go
index 4030623..eebb8ad 100644
--- a/core/installer/derived.go
+++ b/core/installer/derived.go
@@ -3,8 +3,10 @@
 import (
 	"fmt"
 	"html/template"
+	"math/rand/v2"
 	"strings"
 
+	"github.com/richardlehane/crock32"
 	"github.com/sethvargo/go-password/password"
 )
 
@@ -101,6 +103,9 @@
 				}
 				ret[k] = psswd
 			}
+			if def.Kind() == KindSketchSessionId {
+				ret[k] = GenerateSketchSessionId()
+			}
 			if def.Kind() == KindVPNAuthKey {
 				enabled := true
 				if v, ok := def.Meta()["enabledField"]; ok {
@@ -146,6 +151,8 @@
 			ret[k] = v
 		case KindPassword:
 			ret[k] = v
+		case KindSketchSessionId:
+			ret[k] = v
 		case KindArrayString:
 			a, ok := v.([]string)
 			if !ok {
@@ -352,3 +359,12 @@
 func GeneratePassword() (string, error) {
 	return password.Generate(20, 5, 0, false, true)
 }
+
+func GenerateSketchSessionId() string {
+	u1, u2 := rand.Uint64(), rand.Uint64N(1<<16)
+	s := crock32.Encode(u1) + crock32.Encode(uint64(u2))
+	if len(s) < 16 {
+		s += strings.Repeat("0", 16-len(s))
+	}
+	return s[0:4] + "-" + s[4:8] + "-" + s[8:12] + "-" + s[12:16]
+}