Simplify codebase per audit of 8b89f14

This commit is contained in:
Ian Gulliver
2026-10-23 15:35:42 -07:00
parent 382d27d356
commit 461aac75e9
134 changed files with 1038 additions and 2907 deletions
-15
View File
@@ -2,9 +2,6 @@ package ids
import (
"crypto/rand"
"crypto/sha256"
"encoding/binary"
"strings"
)
const (
@@ -25,7 +22,6 @@ const (
Blob Prefix = "blb"
LeadNote Prefix = "not"
WorkflowDefinition Prefix = "wfd"
WorkflowRun Prefix = "run"
Send Prefix = "snd"
Client Prefix = "cli"
ClientRequest Prefix = "req"
@@ -48,14 +44,3 @@ func New(prefix Prefix) string {
}
return string(prefix) + string(out)
}
func Derive(prefix Prefix, parts ...string) string {
sum := sha256.Sum256([]byte(strings.Join(parts, "\x00")))
n := binary.BigEndian.Uint64(sum[:8])
out := make([]byte, randomLength)
for i := range out {
out[i] = alphabet[n%uint64(len(alphabet))]
n /= uint64(len(alphabet))
}
return string(prefix) + string(out)
}