Skip to content

Commit

Permalink
feat(keychain-azure-kv): complete request handler and endpoints
Browse files Browse the repository at this point in the history
Fixes hyperledger-cacti#1010
Depends on hyperledger-cacti#1349

Signed-off-by: Youngone Lee <[email protected]>
Signed-off-by: Jeffery Ushry <[email protected]>
Signed-off-by: Peter Somogyvari <[email protected]>
  • Loading branch information
Leeyoungone committed Oct 1, 2021
1 parent 6deed6d commit 0e571c6
Show file tree
Hide file tree
Showing 12 changed files with 931 additions and 114 deletions.
100 changes: 51 additions & 49 deletions packages/cactus-core-api/src/main/json/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -585,37 +585,60 @@
}
}
},
"SetKeychainEntryResponseV1": {
"DeleteKeychainEntryRequest": {
"type": "object",
"required": [
"key"
],
"properties": {
"key": {
"type": "string",
"description": "The key that was used to set the value on the keychain.",
"description": "The key for the entry to delete from the keychain.",
"minLength": 1,
"maxLength": 1024,
"nullable": false
}
}
},
"DeleteKeychainEntryRequestV1": {
"HasKeychainEntryRequest": {
"type": "object",
"required": [
"key"
],
"properties": {
"key": {
"type": "string",
"description": "The key for the entry to check the presence of on the keychain.",
"description": "The key for the entry to check on the keychain.",
"minLength": 1,
"maxLength": 1024,
"nullable": false
}
}
},
"DeleteKeychainEntryResponseV1": {
"HasKeychainEntryResponseV1": {
"type": "object",
"required": ["key", "isPresent", "checkedAt"],
"properties": {
"key": {
"type": "string",
"description": "The key that was used to check the presence of the value in the entry store.",
"minLength": 1,
"maxLength": 1024,
"nullable": false
},
"checkedAt": {
"type": "string",
"description": "Date and time encoded as JSON when the presence check was performed by the plugin backend.",
"nullable": false
},
"isPresent": {
"type": "boolean",
"description": "The boolean true or false indicating the presence or absence of an entry under 'key'.",
"nullable": false
}
}
},
"SetKeychainEntryResponseV1": {
"type": "object",
"required": [
"key"
Expand All @@ -624,14 +647,14 @@
"properties": {
"key": {
"type": "string",
"description": "The key that was deleted from the keychain.",
"description": "The key that was used to set the value on the keychain.",
"minLength": 1,
"maxLength": 1024,
"nullable": false
}
}
},
"HasKeychainEntryRequestV1": {
"DeleteKeychainEntryResponse": {
"type": "object",
"required": [
"key"
Expand All @@ -640,35 +663,12 @@
"properties": {
"key": {
"type": "string",
"description": "The key to check for presence in the keychain.",
"description": "The key that was used to delete the value on the keychain.",
"minLength": 1,
"maxLength": 1024,
"nullable": false
}
}
},
"HasKeychainEntryResponseV1": {
"type": "object",
"required": ["key", "isPresent", "checkedAt"],
"properties": {
"key": {
"type": "string",
"description": "The key that was used to check the presence of the value in the entry store.",
"minLength": 1,
"maxLength": 1024,
"nullable": false
},
"checkedAt": {
"type": "string",
"description": "Date and time encoded as JSON when the presence check was performed by the plugin backend.",
"nullable": false
},
"isPresent": {
"type": "boolean",
"description": "The boolean true or false indicating the presence or absence of an entry under 'key'.",
"nullable": false
}
}
}
},
"requestBodies": {
Expand Down Expand Up @@ -727,24 +727,24 @@
}
}
},
"keychain_has_entry_request_body": {
"description": "Request body for checking a keychain entry via its key",
"keychain_delete_entry_request_body": {
"description": "Request body to delete a keychain entry via its key",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HasKeychainEntryRequestV1"
"$ref": "#/components/schemas/DeleteKeychainEntryRequest"
}
}
}
},
"keychain_delete_entry_request_body": {
"description": "Request body to delete a keychain entry via its key",
},
"keychain_has_entry_request_body": {
"description": "Request body for checking a keychain entry via its key",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DeleteKeychainEntryRequestV1"
"$ref": "#/components/schemas/HasKeychainEntryRequest"
}
}
}
Expand Down Expand Up @@ -822,45 +822,47 @@
"keychain_set_entry_500": {
"description": "Unexpected error."
},
"keychain_has_entry_200": {
"keychain_delete_entry_200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HasKeychainEntryResponseV1"
"$ref": "#/components/schemas/DeleteKeychainEntryResponse"
}
}
}
},
"keychain_has_entry_400": {
"keychain_delete_entry_400": {
"description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters."
},
"keychain_has_entry_401": {
"keychain_delete_entry_401": {
"description": "Authorization information is missing or invalid."
},
"keychain_has_entry_500": {
"keychain_delete_entry_500": {
"description": "Unexpected error."
},
"keychain_delete_entry_200": {
"keychain_has_entry_200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DeleteKeychainEntryResponseV1"
"$ref": "#/components/schemas/HasKeychainEntryResponseV1"
}
}
}
},
"keychain_delete_entry_400": {
"keychain_has_entry_400": {
"description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters."
},
"keychain_delete_entry_401": {
"keychain_has_entry_401": {
"description": "Authorization information is missing or invalid."
},
"keychain_delete_entry_500": {
"keychain_has_entry_500": {
"description": "Unexpected error."
}
}
},
"paths": {}
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -265,26 +265,26 @@ export enum Constants {
/**
*
* @export
* @interface DeleteKeychainEntryRequestV1
* @interface DeleteKeychainEntryRequest
*/
export interface DeleteKeychainEntryRequestV1 {
export interface DeleteKeychainEntryRequest {
/**
* The key for the entry to check the presence of on the keychain.
* The key for the entry to delete from the keychain.
* @type {string}
* @memberof DeleteKeychainEntryRequestV1
* @memberof DeleteKeychainEntryRequest
*/
key: string;
}
/**
*
* @export
* @interface DeleteKeychainEntryResponseV1
* @interface DeleteKeychainEntryResponse
*/
export interface DeleteKeychainEntryResponseV1 {
export interface DeleteKeychainEntryResponse {
/**
* The key that was deleted from the keychain.
* The key that was used to delete the value on the keychain.
* @type {string}
* @memberof DeleteKeychainEntryResponseV1
* @memberof DeleteKeychainEntryResponse
*/
key: string;
}
Expand Down Expand Up @@ -355,13 +355,13 @@ export interface GetObjectResponseV1 {
/**
*
* @export
* @interface HasKeychainEntryRequestV1
* @interface HasKeychainEntryRequest
*/
export interface HasKeychainEntryRequestV1 {
export interface HasKeychainEntryRequest {
/**
* The key to check for presence in the keychain.
* The key for the entry to check on the keychain.
* @type {string}
* @memberof HasKeychainEntryRequestV1
* @memberof HasKeychainEntryRequest
*/
key: string;
}
Expand Down
5 changes: 5 additions & 0 deletions packages/cactus-plugin-keychain-azure-kv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@
"name": "Peter Somogyvari",
"email": "[email protected]",
"url": "https://accenture.com"
},
{
"name": "Jeffrey Ushry II",
"email": "[email protected]",
"url": "https://www.linkedin.com/in/jeffrey-ushry-ii-aa7ab8183"
}
],
"license": "Apache-2.0",
Expand Down
99 changes: 84 additions & 15 deletions packages/cactus-plugin-keychain-azure-kv/src/main/json/openapi.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
{
"openapi": "3.0.3",
"info": {
"title": "Hyperledger Cactus - Keychain API",
"description": "Contains/describes the Keychain API types/paths for Hyperledger Cactus.",
"version": "0.3.0",
"license": {
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
}
},
"components": {
"schemas": {
}
},
"openapi": "3.0.3",
"info": {
"title": "Hyperledger Cactus - Keychain API",
"description": "Contains/describes the Keychain API types/paths for Hyperledger Cactus.",
"version": "0.3.0",
"license": {
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
}
},
"components": {
"schemas": {
"GetSecretRequest": {
"type": "string",
"nullable": false
},
"GetSecretResponse": {
"type": "string",
"nullable": false
}
}
},
"paths": {
"/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/get-keychain-entry": {
"post": {
Expand Down Expand Up @@ -76,6 +84,67 @@
}
}
}
},
"/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/delete-keychain-entry": {
"post": {
"x-hyperledger-cactus": {
"http": {
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/delete-keychain-entry",
"verbLowerCase": "post"
}
},
"operationId": "deleteKeychainEntryV1",
"summary": "Deletes a value under a key on the keychain backend.",
"parameters": [],
"requestBody": {
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v0.9.0/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_delete_entry_request_body"
},
"responses": {
"200": {
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v0.9.0/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_200"
},
"400": {
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v0.9.0/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_400"
},
"401": {
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v0.9.0/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_401"
},
"500": {
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v0.9.0/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_500"
}
}
}
},
"/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/has-keychain-entry": {
"post": {
"x-hyperledger-cactus": {
"http": {
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/has-keychain-entry",
"verbLowerCase": "post"
}
},
"operationId": "hasKeychainEntryV1",
"summary": "Checks that an entry exists under a key on the keychain backend",
"parameters": [],
"requestBody": {
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v0.9.0/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_has_entry_request_body"
},
"responses": {
"200": {
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v0.9.0/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_200"
},
"400": {
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v0.9.0/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_400"
},
"401": {
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v0.9.0/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_401"
},
"500": {
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v0.9.0/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_500"
}
}
}
}
}
}
}

Loading

0 comments on commit 0e571c6

Please sign in to comment.