n8n/packages/nodes-base/credentials/MispApi.credentials.ts

55 lines
1.1 KiB
TypeScript

import type {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class MispApi implements ICredentialType {
name = 'mispApi';
displayName = 'MISP API';
documentationUrl = 'misp';
properties: INodeProperties[] = [
{
displayName: 'API Key',
name: 'apiKey',
type: 'string',
typeOptions: { password: true },
default: '',
},
{
displayName: 'Base URL',
name: 'baseUrl',
type: 'string',
default: '',
},
{
displayName: 'Allow Unauthorized Certificates',
name: 'allowUnauthorizedCerts',
type: 'boolean',
description: 'Whether to connect even if SSL certificate validation is not possible',
default: false,
},
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
headers: {
Authorization: '={{$credentials.apiKey}}',
},
},
};
test: ICredentialTestRequest = {
request: {
baseURL: '={{$credentials.baseUrl.replace(new RegExp("/$"), "")}}',
url: '/tags',
skipSslCertificateValidation: '={{$credentials.allowUnauthorizedCerts}}',
},
};
}