Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 175ebac

Browse files
author
Peter Somogyvari
committed
feat(plugin-keychain-memory): add REST API endpoint implementations
BREAKING CHANGE: Some of the schema elements that were redundant got removed from the openapi.json spec of the memory plugin. The same schemas are now being pulled from the core-api package. In this sense there is no breaking change because these two schemas were already equivalent anyway, but the fact is the openapi.json had schema elements removed from it anyway so this is something that people need to be aware of as they upgrade to v2.0.0 in the near future. 1. Added the REST API endpoints to the plugin so that it is accessible over HTTP for testing/demo purposes as necessary. 2. Also refactored the openapi.json spec file so that it pulls the schema definitions from the core-api package the same way as the keychain-memory-wasm plugin is doing already. Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com> (cherry picked from commit 8d0b9ac)
1 parent a1e99e3 commit 175ebac

25 files changed

Lines changed: 1723 additions & 171 deletions

packages/cactus-plugin-keychain-memory/src/main/json/openapi.json

Lines changed: 113 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"openapi": "3.0.3",
33
"info": {
44
"title": "Hyperledger Cactus Plugin - Keychain Memory ",
5-
"description": "Contains/describes the Hyperledger Cactus Keychain Memory plugin.",
5+
"description": "Contains/describes the Hyperledger Cacti Keychain Memory plugin.",
66
"version": "v2.0.0-alpha.2",
77
"license": {
88
"name": "Apache-2.0",
@@ -11,148 +11,136 @@
1111
},
1212
"components": {
1313
"schemas": {
14-
"GetKeychainEntryRequest": {
15-
"type": "object",
16-
"required": ["key"],
17-
"additionalProperties": false,
18-
"properties": {
19-
"key": {
20-
"type": "string",
21-
"description": "The key for the entry to get from the keychain.",
22-
"minLength": 1,
23-
"maxLength": 1024,
24-
"nullable": false
14+
"PrometheusExporterMetricsResponse": {
15+
"type": "string",
16+
"nullable": false
17+
}
18+
}
19+
},
20+
"paths": {
21+
"/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/get-keychain-entry": {
22+
"post": {
23+
"x-hyperledger-cacti": {
24+
"http": {
25+
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/get-keychain-entry",
26+
"verbLowerCase": "post"
2527
}
26-
}
27-
},
28-
"GetKeychainEntryResponse": {
29-
"type": "object",
30-
"required": ["key", "value"],
31-
"properties": {
32-
"key": {
33-
"type": "string",
34-
"description": "The key that was used to retrieve the value from the keychain.",
35-
"minLength": 1,
36-
"maxLength": 1024,
37-
"nullable": false
28+
},
29+
"operationId": "getKeychainEntryV1",
30+
"summary": "Retrieves the contents of a keychain entry from the backend.",
31+
"parameters": [],
32+
"requestBody": {
33+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_get_entry_request_body"
34+
},
35+
"responses": {
36+
"200": {
37+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_200"
3838
},
39-
"value": {
40-
"type": "string",
41-
"description": "The value associated with the requested key on the keychain.",
42-
"minLength": 0,
43-
"maxLength": 10485760,
44-
"nullable": false
45-
}
46-
}
47-
},
48-
"SetKeychainEntryRequest": {
49-
"type": "object",
50-
"required": ["key", "value"],
51-
"additionalProperties": false,
52-
"properties": {
53-
"key": {
54-
"type": "string",
55-
"description": "The key for the entry to set on the keychain.",
56-
"minLength": 1,
57-
"maxLength": 1024,
58-
"nullable": false
39+
"400": {
40+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_400"
5941
},
60-
"value": {
61-
"type": "string",
62-
"description": "The value that will be associated with the key on the keychain.",
63-
"minLength": 0,
64-
"maxLength": 10485760,
65-
"nullable": false
42+
"401": {
43+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_401"
44+
},
45+
"404": {
46+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_404"
47+
},
48+
"500": {
49+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_500"
6650
}
6751
}
68-
},
69-
"SetKeychainEntryResponse": {
70-
"type": "object",
71-
"required": ["key"],
72-
"properties": {
73-
"key": {
74-
"type": "string",
75-
"description": "The key that was used to set the value on the keychain.",
76-
"minLength": 1,
77-
"maxLength": 1024,
78-
"nullable": false
52+
}
53+
},
54+
"/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/set-keychain-entry": {
55+
"post": {
56+
"x-hyperledger-cacti": {
57+
"http": {
58+
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/set-keychain-entry",
59+
"verbLowerCase": "post"
60+
}
61+
},
62+
"operationId": "setKeychainEntryV1",
63+
"summary": "Sets a value under a key on the keychain backend.",
64+
"parameters": [],
65+
"requestBody": {
66+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_set_entry_request_body"
67+
},
68+
"responses": {
69+
"200": {
70+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_200"
71+
},
72+
"400": {
73+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_400"
74+
},
75+
"401": {
76+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_401"
77+
},
78+
"500": {
79+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_500"
7980
}
8081
}
81-
},
82-
"PrometheusExporterMetricsResponse": {
83-
"type": "string",
84-
"nullable": false
8582
}
8683
},
87-
"requestBodies": {
88-
"keychain_get_entry_request_body": {
89-
"description": "Request body to obtain a keychain entry via its key",
90-
"required": true,
91-
"content": {
92-
"application/json": {
93-
"schema": {
94-
"$ref": "#/components/schemas/GetKeychainEntryRequest"
95-
}
84+
"/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/delete-keychain-entry": {
85+
"post": {
86+
"x-hyperledger-cacti": {
87+
"http": {
88+
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/delete-keychain-entry",
89+
"verbLowerCase": "post"
9690
}
97-
}
98-
},
99-
"keychain_set_entry_request_body": {
100-
"description": "Request body to write/update a keychain entry via its key",
101-
"required": true,
102-
"content": {
103-
"application/json": {
104-
"schema": {
105-
"$ref": "#/components/schemas/SetKeychainEntryRequest"
106-
}
91+
},
92+
"operationId": "deleteKeychainEntryV1",
93+
"summary": "Deletes an entry under a key on the keychain backend.",
94+
"parameters": [],
95+
"requestBody": {
96+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_delete_entry_request_body"
97+
},
98+
"responses": {
99+
"200": {
100+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_200"
101+
},
102+
"400": {
103+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_400"
104+
},
105+
"401": {
106+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_401"
107+
},
108+
"500": {
109+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_500"
107110
}
108111
}
109112
}
110113
},
111-
"responses": {
112-
"keychain_get_entry_200": {
113-
"description": "OK",
114-
"content": {
115-
"application/json": {
116-
"schema": {
117-
"$ref": "#/components/schemas/GetKeychainEntryResponse"
118-
}
114+
"/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/has-keychain-entry": {
115+
"post": {
116+
"x-hyperledger-cacti": {
117+
"http": {
118+
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/has-keychain-entry",
119+
"verbLowerCase": "post"
119120
}
120-
}
121-
},
122-
"keychain_get_entry_400": {
123-
"description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters."
124-
},
125-
"keychain_get_entry_401": {
126-
"description": "Authorization information is missing or invalid."
127-
},
128-
"keychain_get_entry_404": {
129-
"description": "A keychain item with the specified key was not found."
130-
},
131-
"keychain_get_entry_500": {
132-
"description": "Unexpected error."
133-
},
134-
"keychain_set_entry_200": {
135-
"description": "OK",
136-
"content": {
137-
"application/json": {
138-
"schema": {
139-
"$ref": "#/components/schemas/SetKeychainEntryResponse"
140-
}
121+
},
122+
"operationId": "hasKeychainEntryV1",
123+
"summary": "Checks that an entry exists under a key on the keychain backend",
124+
"parameters": [],
125+
"requestBody": {
126+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_has_entry_request_body"
127+
},
128+
"responses": {
129+
"200": {
130+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_200"
131+
},
132+
"400": {
133+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_400"
134+
},
135+
"401": {
136+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_401"
137+
},
138+
"500": {
139+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_500"
141140
}
142141
}
143-
},
144-
"keychain_set_entry_400": {
145-
"description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters."
146-
},
147-
"keychain_set_entry_401": {
148-
"description": "Authorization information is missing or invalid."
149-
},
150-
"keychain_set_entry_500": {
151-
"description": "Unexpected error."
152142
}
153-
}
154-
},
155-
"paths": {
143+
},
156144
"/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/get-prometheus-exporter-metrics": {
157145
"get": {
158146
"x-hyperledger-cacti": {

packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt
2121
src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt
2222
src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt
2323
src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt
24-
src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequest.kt
25-
src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponse.kt
26-
src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequest.kt
27-
src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponse.kt
24+
src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt
25+
src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt
26+
src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequestV1.kt
27+
src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponseV1.kt
28+
src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt
29+
src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt
30+
src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequestV1.kt
31+
src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponseV1.kt

packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# org.openapitools.client - Kotlin client library for Hyperledger Cactus Plugin - Keychain Memory
22

3-
Contains/describes the Hyperledger Cactus Keychain Memory plugin.
3+
Contains/describes the Hyperledger Cacti Keychain Memory plugin.
44

55
## Overview
66
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client.
@@ -44,16 +44,24 @@ All URIs are relative to *http://localhost*
4444

4545
Class | Method | HTTP request | Description
4646
------------ | ------------- | ------------- | -------------
47+
*DefaultApi* | [**deleteKeychainEntryV1**](docs/DefaultApi.md#deletekeychainentryv1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/delete-keychain-entry | Deletes an entry under a key on the keychain backend.
48+
*DefaultApi* | [**getKeychainEntryV1**](docs/DefaultApi.md#getkeychainentryv1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/get-keychain-entry | Retrieves the contents of a keychain entry from the backend.
4749
*DefaultApi* | [**getPrometheusMetricsV1**](docs/DefaultApi.md#getprometheusmetricsv1) | **GET** /api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/get-prometheus-exporter-metrics | Get the Prometheus Metrics
50+
*DefaultApi* | [**hasKeychainEntryV1**](docs/DefaultApi.md#haskeychainentryv1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/has-keychain-entry | Checks that an entry exists under a key on the keychain backend
51+
*DefaultApi* | [**setKeychainEntryV1**](docs/DefaultApi.md#setkeychainentryv1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/set-keychain-entry | Sets a value under a key on the keychain backend.
4852

4953

5054
<a id="documentation-for-models"></a>
5155
## Documentation for Models
5256

53-
- [org.openapitools.client.models.GetKeychainEntryRequest](docs/GetKeychainEntryRequest.md)
54-
- [org.openapitools.client.models.GetKeychainEntryResponse](docs/GetKeychainEntryResponse.md)
55-
- [org.openapitools.client.models.SetKeychainEntryRequest](docs/SetKeychainEntryRequest.md)
56-
- [org.openapitools.client.models.SetKeychainEntryResponse](docs/SetKeychainEntryResponse.md)
57+
- [org.openapitools.client.models.DeleteKeychainEntryRequestV1](docs/DeleteKeychainEntryRequestV1.md)
58+
- [org.openapitools.client.models.DeleteKeychainEntryResponseV1](docs/DeleteKeychainEntryResponseV1.md)
59+
- [org.openapitools.client.models.GetKeychainEntryRequestV1](docs/GetKeychainEntryRequestV1.md)
60+
- [org.openapitools.client.models.GetKeychainEntryResponseV1](docs/GetKeychainEntryResponseV1.md)
61+
- [org.openapitools.client.models.HasKeychainEntryRequestV1](docs/HasKeychainEntryRequestV1.md)
62+
- [org.openapitools.client.models.HasKeychainEntryResponseV1](docs/HasKeychainEntryResponseV1.md)
63+
- [org.openapitools.client.models.SetKeychainEntryRequestV1](docs/SetKeychainEntryRequestV1.md)
64+
- [org.openapitools.client.models.SetKeychainEntryResponseV1](docs/SetKeychainEntryResponseV1.md)
5765

5866

5967
<a id="documentation-for-authorization"></a>

0 commit comments

Comments
 (0)