OpenNHP/opennhp · error
userId is too long, should be not longer than 64
Error message
userId is too long, should be not longer than 64
What it means
Validation in the kgc CLI user command path: the --user-id string passed to keygen exceeds 64 characters. The identifier is embedded in the key-derivation hash, so an over-long id is rejected up front rather than producing keys derived from a truncated or unstable identity.
Solutions
- Shorten the --user-id to at most 64 characters
- Use a compact unique identifier (email or phone) rather than a long free-form string
- If a long identifier is required, hash or map it to a stable short form before keygen
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at endpoints/kgc/main/main.go:40 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of OpenNHP/opennhp@6e04ca5ff0 (2026-09-07).
Data as JSON: /api/errors/128dd83dc4c4de2d.
Report an issue: GitHub.
Appendix: source
Thrown at endpoints/kgc/main/main.go:40
masterCmd := &cli.Command{
Name: "setup",
Usage: "generate the system parameters and the master public and private key pair in kgc",
Action: func(c *cli.Context) error {
return setUp()
},
}
userCmd := &cli.Command{
Name: "keygen",
Usage: "generate the user private key and declared user public key.",
Flags: []cli.Flag{
&cli.StringFlag{Name: "user-id", Usage: "specify the user identifier that can be email address, phone number or other unique identifier", Required: true},
&cli.BoolFlag{Name: "json", Value: false, DisableDefaultText: true, Usage: "output in JSON format"},
},
Before: func(c *cli.Context) error {
if len(c.String("user-id")) > 64 {
return fmt.Errorf("userId is too long, should be not longer than 64")
}
return nil
},
Action: func(c *cli.Context) error {
userId := c.String("user-id")
return GenerateUserFullKey(userId, c.Bool("json"))
},
}
signCmd := &cli.Command{
Name: "sign",
Usage: "sign the message with the user's private key",
Flags: []cli.Flag{
&cli.StringFlag{Name: "private-key", Usage: "specify private key with base64 format", Required: true},
&cli.StringFlag{Name: "message", Usage: "specify the message to be signed", Required: true},
&cli.BoolFlag{Name: "json", Value: false, DisableDefaultText: true, Usage: "output in JSON format"},
},
Action: func(c *cli.Context) error {View on GitHub (pinned to 6e04ca5ff0)