airic-api-gateway-key-server
Description
airic-api-gateway-key-server module is the ID key/API key server component of airic-api-gateway.
Samples
Hello world
Starting server:
'use strict';const YAML = ;const keyServer = ; const keyServerConfigYaml = YAML;keyServer; keyServer;
Key Server Config YAML
Sample:
port: 3002admin-token: d8745e9d03be41ad817a47176ade4dccpull-api-config-interval-second: 60config-server-base-url: http://localhost:3001id-key-cache-max-second: 15api-key-cache-max-second: 10private-key-path : './system-key-dir/private-key.pem'public-key-path : './system-key-dir/public-key.pem'
REST APIs
Generate Workspace ID key (with admin token)
POST http://localhost:3001/config/workspaces/{{workspaceId}}/id-keys
Content-type: application/json
id-key: {{adminToken}}
Generate Workspace ID key (with workspace ID/secret)
POST http://localhost:3001/config/workspaces/{{workspaceId}}/id-keys
Content-type: application/json
id-key: {{adminToken}}
{
"workspaceId": "{{workspaceId}}",
"secret": "{{workspaceSecret}}"
}
Generate App ID key (with admin token)
POST http://localhost:3001/config/workspaces/{{workspaceId}}/apps/{{appId}}/id-keys
Content-type: application/json
id-key: {{adminToken}}
Generate App ID key (with workspace ID key)
POST http://localhost:3001/config/workspaces/{{workspaceId}}/apps/{{appId}}/id-keys
Content-type: application/json
id-key: {{workspaceIdKey}}
Generate App ID key (with app ID/secret)
POST http://localhost:3001/config/workspaces/{{workspaceId}}/apps/{{appId}}/id-keys
Content-type: application/json
id-key: {{adminToken}}
{
"appId": "{{appId}}",
"secret": "{{appSecret}}"
}
Verify Workspace ID key or App ID key
POST http://localhost:3001/keys/id-keys/verification
Content-type: application/json
{
"key": "{{workspaceIdKey}}"
}
POST http://localhost:3001/keys/id-keys/verification
Content-type: application/json
{
"key": "{{appIdKey}}"
}
Register App API key for Client
POST http://localhost:3001/config/workspaces/{{workspaceId}}/apps/{{appId}}/api-keys
Content-type: application/json
id-key: {{adminToken}}
{
"clientId": "{{clientId}}"
}
Verify API key
POST http://localhost:3001/keys/api-keys/verification
Content-type: application/json
{
"key": "{{apiKey}}"
}