Skip to content

Commit

Permalink
feat(keychain): implement OpenAPI endpoints
Browse files Browse the repository at this point in the history
Specifically for the in-memory and the vault
plugin implementations.

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
  • Loading branch information
petermetz committed Jan 14, 2021
1 parent f4d51da commit 3a0acf4
Show file tree
Hide file tree
Showing 24 changed files with 1,731 additions and 0 deletions.
143 changes: 143 additions & 0 deletions packages/cactus-core-api/src/main/json/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,149 @@
}
}
}
},
"GetKeychainEntryRequest": {
"type": "object",
"required": [
"key"
],
"properties": {
"key": {
"type": "string",
"description": "The key for the entry to get from the keychain.",
"minLength": 1,
"maxLength": 1024,
"nullable": false
}
}
},
"GetKeychainEntryResponse": {
"type": "object",
"required": [
"key",
"value"
],
"properties": {
"key": {
"type": "string",
"description": "The key that was used to retrieve the value from the keychain.",
"minLength": 1,
"maxLength": 1024,
"nullable": false
},
"value": {
"type": "string",
"description": "The value associated with the requested key on the keychain.",
"minLength": 0,
"maxLength": 10485760,
"nullable": false
}
}
},
"SetKeychainEntryRequest": {
"type": "object",
"required": [
"key",
"value"
],
"properties": {
"key": {
"type": "string",
"description": "The key for the entry to set on the keychain.",
"minLength": 1,
"maxLength": 1024,
"nullable": false
},
"value": {
"type": "string",
"description": "The value that will be associated with the key on the keychain.",
"minLength": 0,
"maxLength": 10485760,
"nullable": false
}
}
},
"SetKeychainEntryResponse": {
"type": "object",
"required": [
"key"
],
"properties": {
"key": {
"type": "string",
"description": "The key that was used to set the value on the keychain.",
"minLength": 1,
"maxLength": 1024,
"nullable": false
}
}
}
},
"requestBodies": {
"keychain_get_entry_request_body": {
"description": "Requst body to obtain a keychain entry via its key",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetKeychainEntryRequest"
}
}
}
},
"keychain_set_entry_request_body": {
"description": "Requst body to write/update a keychain entry via its key",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SetKeychainEntryRequest"
}
}
}
}
},
"responses": {
"keychain_get_entry_200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetKeychainEntryResponse"
}
}
}
},
"keychain_get_entry_400": {
"description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters."
},
"keychain_get_entry_401": {
"description": "Authorization information is missing or invalid."
},
"keychain_get_entry_404": {
"description": "A keychain item with the specified key was not found."
},
"keychain_get_entry_500": {
"description": "Unexpected error."
},
"keychain_set_entry_200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SetKeychainEntryResponse"
}
}
}
},
"keychain_set_entry_400": {
"description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters."
},
"keychain_set_entry_401": {
"description": "Authorization information is missing or invalid."
},
"keychain_set_entry_500": {
"description": "Unexpected error."
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,38 @@ export interface ConsortiumMember {
*/
nodeIds: Array<string>;
}
/**
*
* @export
* @interface GetKeychainEntryRequest
*/
export interface GetKeychainEntryRequest {
/**
* The key for the entry to get from the keychain.
* @type {string}
* @memberof GetKeychainEntryRequest
*/
key: string;
}
/**
*
* @export
* @interface GetKeychainEntryResponse
*/
export interface GetKeychainEntryResponse {
/**
* The key that was used to retrieve the value from the keychain.
* @type {string}
* @memberof GetKeychainEntryResponse
*/
key: string;
/**
* The value associated with the requested key on the keychain.
* @type {string}
* @memberof GetKeychainEntryResponse
*/
value: string;
}
/**
*
* @export
Expand Down Expand Up @@ -367,4 +399,36 @@ export interface PluginInstance {
*/
packageName: string;
}
/**
*
* @export
* @interface SetKeychainEntryRequest
*/
export interface SetKeychainEntryRequest {
/**
* The key for the entry to set on the keychain.
* @type {string}
* @memberof SetKeychainEntryRequest
*/
key: string;
/**
* The value that will be associated with the key on the keychain.
* @type {string}
* @memberof SetKeychainEntryRequest
*/
value: string;
}
/**
*
* @export
* @interface SetKeychainEntryResponse
*/
export interface SetKeychainEntryResponse {
/**
* The key that was used to set the value on the keychain.
* @type {string}
* @memberof SetKeychainEntryResponse
*/
key: string;
}

9 changes: 9 additions & 0 deletions packages/cactus-plugin-keychain-vault/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# `@hyperledger/cactus-plugin-keychain-vault`

> TODO: description
## Usage

```
// TODO: DEMONSTRATE API
```

0 comments on commit 3a0acf4

Please sign in to comment.