{"record":{"id":"128dd83dc4c4de2d","repo":"OpenNHP/opennhp","slug":"userid-is-too-long-should-be-not-longer-than-64","errorCode":null,"errorMessage":"userId is too long, should be not longer than 64","messagePattern":"userId is too long, should be not longer than 64","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"endpoints/kgc/main/main.go","lineNumber":40,"sourceCode":"\n\tmasterCmd := &cli.Command{\n\t\tName:  \"setup\",\n\t\tUsage: \"generate the system parameters and the master public and private key pair in kgc\",\n\t\tAction: func(c *cli.Context) error {\n\t\t\treturn setUp()\n\t\t},\n\t}\n\n\tuserCmd := &cli.Command{\n\t\tName:  \"keygen\",\n\t\tUsage: \"generate the user private key and declared user public key.\",\n\t\tFlags: []cli.Flag{\n\t\t\t&cli.StringFlag{Name: \"user-id\", Usage: \"specify the user identifier that can be email address, phone number or other unique identifier\", Required: true},\n\t\t\t&cli.BoolFlag{Name: \"json\", Value: false, DisableDefaultText: true, Usage: \"output in JSON format\"},\n\t\t},\n\t\tBefore: func(c *cli.Context) error {\n\t\t\tif len(c.String(\"user-id\")) > 64 {\n\t\t\t\treturn fmt.Errorf(\"userId is too long, should be not longer than 64\")\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t\tAction: func(c *cli.Context) error {\n\t\t\tuserId := c.String(\"user-id\")\n\t\t\treturn GenerateUserFullKey(userId, c.Bool(\"json\"))\n\t\t},\n\t}\n\n\tsignCmd := &cli.Command{\n\t\tName:  \"sign\",\n\t\tUsage: \"sign the message with the user's private key\",\n\t\tFlags: []cli.Flag{\n\t\t\t&cli.StringFlag{Name: \"private-key\", Usage: \"specify private key with base64 format\", Required: true},\n\t\t\t&cli.StringFlag{Name: \"message\", Usage: \"specify the message to be signed\", Required: true},\n\t\t\t&cli.BoolFlag{Name: \"json\", Value: false, DisableDefaultText: true, Usage: \"output in JSON format\"},\n\t\t},\n\t\tAction: func(c *cli.Context) error {","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/OpenNHP/opennhp/blob/6e04ca5ff03222a699c24205cd4bf8fee9af7ffe/endpoints/kgc/main/main.go#L22-L58","documentation":"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.","triggerScenarios":"Thrown at endpoints/kgc/main/main.go:40 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6e04ca5ff03222a699c24205cd4bf8fee9af7ffe","analyzedAt":"2026-09-07T15:44:59.941Z","contentChangedAt":"2026-09-07T15:44:59.941Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}