diff --git a/package-lock.json b/package-lock.json index 910150bb..e01ed848 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "plugins/*" ], "dependencies": { - "@yaakapp/api": "^0.2.29" + "@yaakapp/api": "^0.3.0" }, "devDependencies": { "@types/node": "^22.7.4", @@ -1013,9 +1013,9 @@ } }, "node_modules/@yaakapp/api": { - "version": "0.2.29", - "resolved": "https://registry.npmjs.org/@yaakapp/api/-/api-0.2.29.tgz", - "integrity": "sha512-RuyWRUGhYIQjFmaZTYuAekSkidl0b9rWcTV1l+Hs5Pw+LUv8+euedAvNodEJgxAgy42btUns7QUmdM5YNvgoug==", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@yaakapp/api/-/api-0.3.0.tgz", + "integrity": "sha512-A2msKEiqVIOdqn2q9oVXT69aJ7EwrbwNZ6gdrvqTqeTERLddRtO0OKj6wYUUpiqbGr1QY8Byu4BzHclp/aYHWw==", "dependencies": { "@types/node": "^22.5.4" } diff --git a/package.json b/package.json index 9e4eced1..f73d48a6 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,6 @@ "workspaces-run": "^1.0.2" }, "dependencies": { - "@yaakapp/api": "^0.2.29" + "@yaakapp/api": "^0.3.0" } } diff --git a/plugins/auth-jwt/src/index.ts b/plugins/auth-jwt/src/index.ts index b5e2309a..309c6809 100644 --- a/plugins/auth-jwt/src/index.ts +++ b/plugins/auth-jwt/src/index.ts @@ -29,32 +29,34 @@ export const plugin: PluginDefinition = { type: 'select', name: 'algorithm', label: 'Algorithm', + hideLabel: true, defaultValue: defaultAlgorithm, options: algorithms.map(value => ({ name: value === 'none' ? 'None' : value, value })), }, { type: 'text', name: 'secret', - label: 'Secret', + label: 'Secret or Private Key', optional: true, }, { type: 'checkbox', name: 'secretBase64', - label: 'Secret Base64 Encoded', + label: 'Secret is base64 encoded', }, { type: 'editor', name: 'payload', label: 'Payload', language: 'json', - optional: true, + defaultValue: '{\n "foo": "bar"\n}', + placeholder: '{ }', }, ], async onApply(_ctx, args) { const { algorithm, secret: _secret, secretBase64, payload } = args.config; const secret = secretBase64 ? Buffer.from(`${_secret}`, 'base64') : `${_secret}`; - const token = secret ? jwt.sign(`${payload}`, secret, { algorithm: algorithm as any }) : jwt.sign(`${payload}`, null); + const token = jwt.sign(`${payload}`, secret, { algorithm: algorithm as any }); const value = `Bearer ${token}`; return { setHeaders: [{ name: 'Authorization', value }] }; }