Files
marqdo/plugins/web/abi_w12.go
T
cflmyandCursor 12d2c7be69 feat(web): Go W-G12 rooms, Redis session, and API keys
Add mode=room with room_key hub APIs, optional redis:// session
backend, and web_api_key_check (sha256 pepper:key) for anlian primitives.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 20:10:43 +08:00

31 lines
757 B
Go

package main
/*
#cgo CFLAGS: -I${SRCDIR}/abi
#include "marqdo_abi_cgo.h"
extern int web_api_key_check(char *args_json, char **out_json, char **err_msg);
*/
import "C"
import (
"github.com/marqdo/marqdo/plugins/web/internal/apikey"
)
//export web_api_key_check
func web_api_key_check(argsJSON *C.char, outJSON **C.char, errMsg **C.char) C.int {
args, err := parseArgs(argsJSON)
if err != nil {
return replyJSON(outJSON, errMsg, nil, err)
}
key, _ := argStr(args, "key", "密钥")
auth, _ := argStr(args, "authorization", "auth", "授权")
pepper, _ := argStr(args, "pepper", "椒盐")
keys := args["keys"]
if keys == nil {
keys = args["hashes"]
}
out := apikey.Check(key, auth, pepper, keys)
return replyJSON(outJSON, errMsg, out, nil)
}