Skip to content

Instantly share code, notes, and snippets.

@alanshaw
Created April 22, 2026 13:24
Show Gist options
  • Select an option

  • Save alanshaw/111b312a319b36defa406bc9b4741d4e to your computer and use it in GitHub Desktop.

Select an option

Save alanshaw/111b312a319b36defa406bc9b4741d4e to your computer and use it in GitHub Desktop.
Generate a DID with a particular suffix
package main
import (
"fmt"
"strings"
"github.com/alanshaw/ucantone/principal/ed25519"
"github.com/alanshaw/ucantone/principal/signer"
)
func main() {
for {
s, err := ed25519.Generate()
if err != nil {
panic(err)
}
did := s.DID().String()
suffix := strings.ToLower(did[len(did)-3:])
fmt.Println(suffix)
if suffix == "svc" {
fmt.Println(did)
fmt.Println(signer.Format(s))
break
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment