snapshot of https://github.com/mountain-loop/yaak.git (main, 2026-09-23; blobs > 131072B omitted)
Some checks failed
Lint and Test / Lint/Test (push) Has been cancelled
Generate Sponsors README / deploy (push) Has been skipped

This commit is contained in:
upstream-mirror
2026-09-23 17:39:41 +05:00
commit 906fb231cc
1544 changed files with 164131 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
{
"name": "@yaak/auth-apikey",
"displayName": "API Key Authentication",
"version": "0.1.0",
"private": true,
"description": "Authenticate requests using an API key",
"repository": {
"type": "git",
"url": "https://github.com/mountain-loop/yaak.git",
"directory": "plugins/auth-apikey"
},
"scripts": {
"build": "yaakcli build",
"dev": "yaakcli dev"
}
}

View File

@@ -0,0 +1,54 @@
import type { PluginDefinition } from "@yaakapp/api";
export const plugin: PluginDefinition = {
authentication: {
name: "apikey",
label: "API Key",
shortLabel: "API Key",
args: [
{
type: "select",
name: "location",
label: "Behavior",
defaultValue: "header",
options: [
{ label: "Insert Header", value: "header" },
{ label: "Append Query Parameter", value: "query" },
],
},
{
type: "text",
name: "key",
label: "Key",
dynamic: (_ctx, { values }) => {
return values.location === "query"
? {
label: "Parameter Name",
description: "The name of the query parameter to add to the request",
}
: {
label: "Header Name",
description: "The name of the header to add to the request",
};
},
},
{
type: "text",
name: "value",
label: "API Key",
optional: true,
password: true,
},
],
async onApply(_ctx, { values }) {
const key = String(values.key ?? "");
const value = String(values.value ?? "");
const location = String(values.location);
if (location === "query") {
return { setQueryParameters: [{ name: key, value }] };
}
return { setHeaders: [{ name: key, value }] };
},
},
};

View File

@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.json"
}