mleku on Nostr: if err = okenvelope.NewFrom(env.Id, false, normalize.AuthRequired.F("auth required ...
if err = okenvelope.NewFrom(env.Id, false,
normalize.AuthRequired.F("auth required for storing events")).Write(ws); chk.T(err) {
}
and that normalize function:
func (r Reason) F(format string, params ...any) []byte { return Msg(r, format, params...) }
you see, Msg:
// Msg constructs a properly formatted message with a machine-readable prefix for OK and CLOSED
// envelopes.
func Msg(prefix Reason, format string, params ...any) []byte {
if len(prefix) < 1 {
prefix = Error
}
return []byte(fmt.Sprintf(prefix.S()+": "+format, params...))
}
Published at
2025-03-31 15:53:38Event JSON
{
"id": "afe7a95cd0bf1a78a01a72ceaf40ab22c649379244a9a78bbb1deb4353ac1f2a",
"pubkey": "4c800257a588a82849d049817c2bdaad984b25a45ad9f6dad66e47d3b47e3b2f",
"created_at": 1743436418,
"kind": 1,
"tags": [
[
"e",
"3f24bf957917bca199b8815f10cf7cea11a9bdb60ef1f5d8a8ba072693cfb8c7",
"wss://./",
"root",
"4c800257a588a82849d049817c2bdaad984b25a45ad9f6dad66e47d3b47e3b2f"
],
[
"e",
"af786bc2de17c21912251b3cd5aa0bda25723c6989e8299cbf36420c4fb0741d",
"wss://mleku.realy.lol/",
"reply",
"4c800257a588a82849d049817c2bdaad984b25a45ad9f6dad66e47d3b47e3b2f"
],
[
"p",
"8125b911ed0e94dbe3008a0be48cfe5cd0c0b05923cfff917ae7e87da8400883"
],
[
"client",
"jumble"
]
],
"content": "\t\t\t\t\tif err = okenvelope.NewFrom(env.Id, false,\n\t\t\t\t\t\tnormalize.AuthRequired.F(\"auth required for storing events\")).Write(ws); chk.T(err) {\n\t\t\t\t\t}\n\n\nand that normalize function:\n\n\nfunc (r Reason) F(format string, params ...any) []byte { return Msg(r, format, params...) }\n\nyou see, Msg:\n\n// Msg constructs a properly formatted message with a machine-readable prefix for OK and CLOSED\n// envelopes.\nfunc Msg(prefix Reason, format string, params ...any) []byte {\n\tif len(prefix) \u003c 1 {\n\t\tprefix = Error\n\t}\n\treturn []byte(fmt.Sprintf(prefix.S()+\": \"+format, params...))\n}\n\n",
"sig": "1fba7fae2d7bb2f5eb45c286a1d7e2fc86358bedcc7adb7ed10221fedc89c8e59110e02692fa76984f758add516b90e0277585538834e1a9314b9d975d631ce0"
}