forked from hyperledger-cacti/cacti
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(aws-sm): added keychain plugin for aws secret manager
Primary Change --- 1. Added new package cactus-plugin-keychain-aws-sm under packages/ 2. Added Localstack under cactus-test-tooling/src/main/typescript for local aws secret manager deployment and testing Refactorings that were also necessary to incorporate 1) and 2) --- 3. Updated public-api.ts under packages/cactus-test-tooling/src/main/typescript for exporting LocalStack class, its interfaces and constants Resolves hyperledger-cacti#912 Signed-off-by: jagpreetsinghsaan <jagpreet.singh.sasan@accenture.com>
- Loading branch information
1 parent
119a23a
commit 909968f
Showing
21 changed files
with
1,041 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# `@hyperledger/cactus-plugin-keychain-aws-sm` | ||
|
||
## TO-DO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", | ||
"spaces": 2, | ||
"generator-cli": { | ||
"version": "5.2.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
{ | ||
"name": "@hyperledger/cactus-plugin-keychain-aws-sm", | ||
"version": "0.6.0", | ||
"description": "A keychain implementation storing its entries in AWS Secret Manger.", | ||
"main": "dist/lib/main/typescript/index.js", | ||
"mainMinified": "dist/cactus-plugin-keychain-aws-sm.node.umd.min.js", | ||
"browser": "dist/cactus-plugin-keychain-aws-sm.web.umd.js", | ||
"browserMinified": "dist/cactus-plugin-keychain-aws-sm.web.umd.min.js", | ||
"module": "dist/lib/main/typescript/index.js", | ||
"types": "dist/types/main/typescript/index.d.ts", | ||
"files": [ | ||
"dist/*" | ||
], | ||
"scripts": { | ||
"generate-sdk": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/", | ||
"tsc": "tsc --project ./tsconfig.json", | ||
"watch": "npm-watch", | ||
"pretsc": "npm run generate-sdk", | ||
"webpack": "npm-run-all webpack:dev webpack:prod", | ||
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web", | ||
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js", | ||
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js", | ||
"webpack:prod": "npm-run-all webpack:prod:node webpack:prod:web", | ||
"webpack:prod:web": "webpack --env=prod --target=web --config ../../webpack.config.js", | ||
"webpack:prod:node": "webpack --env=prod --target=node --config ../../webpack.config.js" | ||
}, | ||
"watch": { | ||
"tsc": { | ||
"patterns": [ | ||
"src/", | ||
"src/*/json/**/openapi*" | ||
], | ||
"ignore": [ | ||
"src/**/generated/*" | ||
], | ||
"extensions": [ | ||
"ts", | ||
"json" | ||
], | ||
"quiet": true, | ||
"verbose": false, | ||
"runOnChangeOnly": true | ||
} | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"engines": { | ||
"node": ">=10", | ||
"npm": ">=6" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/hyperledger/cactus.git" | ||
}, | ||
"keywords": [ | ||
"Hyperledger", | ||
"Cactus", | ||
"Integration", | ||
"Blockchain", | ||
"Distributed Ledger Technology" | ||
], | ||
"author": { | ||
"name": "Hyperledger Cactus Contributors", | ||
"email": "cactus@lists.hyperledger.org", | ||
"url": "https://www.hyperledger.org/use/cactus" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Please add yourself to the list of contributors", | ||
"email": "your.name@example.com", | ||
"url": "https://example.com" | ||
}, | ||
{ | ||
"name": "Jagpreet Singh Sasan", | ||
"email": "jagpreet.singh.sasan@accenture.com", | ||
"url": "https://accenture.com" | ||
} | ||
], | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/hyperledger/cactus/issues" | ||
}, | ||
"homepage": "https://github.com/hyperledger/cactus#readme", | ||
"dependencies": { | ||
"@hyperledger/cactus-common": "0.6.0", | ||
"@hyperledger/cactus-core": "0.6.0", | ||
"@hyperledger/cactus-core-api": "0.6.0", | ||
"aws-sdk": "2.903.0", | ||
"axios": "0.21.1", | ||
"http-status-codes": "2.1.4", | ||
"typescript-optional": "2.0.1" | ||
}, | ||
"devDependencies": { | ||
"@hyperledger/cactus-test-tooling": "0.6.0", | ||
"@types/express-serve-static-core": "4.17.17", | ||
"@types/request": "2.48.5", | ||
"@types/express": "4.17.8", | ||
"internal-ip": "6.2.0", | ||
"openapi-types": "7.2.2" | ||
} | ||
} |
89 changes: 89 additions & 0 deletions
89
packages/cactus-plugin-keychain-aws-sm/src/main/json/openapi.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{ | ||
"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-aws-sm/get-keychain-entry": { | ||
"post": { | ||
"x-hyperledger-cactus": { | ||
"http": { | ||
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/get-keychain-entry", | ||
"verbLowerCase": "post" | ||
} | ||
}, | ||
"operationId": "getKeychainEntry", | ||
"summary": "Retrieves the contents of a keychain entry from the backend.", | ||
"parameters": [], | ||
"requestBody": { | ||
"$ref": "../../../../cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_get_entry_request_body" | ||
}, | ||
"responses": { | ||
"200": { | ||
"$ref": "../../../../cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_200" | ||
}, | ||
"400": { | ||
"$ref": "../../../../cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_400" | ||
}, | ||
"401": { | ||
"$ref": "../../../../cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_401" | ||
}, | ||
"404": { | ||
"$ref": "../../../../cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_404" | ||
}, | ||
"500": { | ||
"$ref": "../../../../cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_500" | ||
} | ||
} | ||
} | ||
}, | ||
"/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/set-keychain-entry": { | ||
"post": { | ||
"x-hyperledger-cactus": { | ||
"http": { | ||
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/set-keychain-entry", | ||
"verbLowerCase": "post" | ||
} | ||
}, | ||
"operationId": "setKeychainEntry", | ||
"summary": "Sets a value under a key on the keychain backend.", | ||
"parameters": [], | ||
"requestBody": { | ||
"$ref": "../../../../cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_set_entry_request_body" | ||
}, | ||
"responses": { | ||
"200": { | ||
"$ref": "../../../../cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_200" | ||
}, | ||
"400": { | ||
"$ref": "../../../../cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_400" | ||
}, | ||
"401": { | ||
"$ref": "../../../../cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_401" | ||
}, | ||
"500": { | ||
"$ref": "../../../../cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_500" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...n-aws-sm/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator-ignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# OpenAPI Generator Ignore | ||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator | ||
|
||
# Use this file to prevent files from being overwritten by the generator. | ||
# The patterns follow closely to .gitignore or .dockerignore. | ||
|
||
# As an example, the C# client generator defines ApiClient.cs. | ||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: | ||
#ApiClient.cs | ||
|
||
# You can match any string of characters against a directory, file or extension with a single asterisk (*): | ||
#foo/*/qux | ||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux | ||
|
||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**): | ||
#foo/**/qux | ||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux | ||
|
||
# You can also negate patterns with an exclamation (!). | ||
# For example, you can ignore all files in a docs folder with the file extension .md: | ||
#docs/*.md | ||
# Then explicitly reverse the ignore rule for a single file: | ||
#!docs/README.md | ||
|
||
.npmignore | ||
.gitignore | ||
git_push.sh |
5 changes: 5 additions & 0 deletions
5
...in-aws-sm/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/FILES
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
api.ts | ||
base.ts | ||
common.ts | ||
configuration.ts | ||
index.ts |
1 change: 1 addition & 0 deletions
1
...-aws-sm/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
5.2.0 |
1 change: 1 addition & 0 deletions
1
packages/cactus-plugin-keychain-aws-sm/src/main/typescript/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./public-api"; |
1 change: 1 addition & 0 deletions
1
packages/cactus-plugin-keychain-aws-sm/src/main/typescript/index.web.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./generated/openapi/typescript-axios/index"; |
31 changes: 31 additions & 0 deletions
31
packages/cactus-plugin-keychain-aws-sm/src/main/typescript/plugin-factory-keychain.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { v4 as uuidv4 } from "uuid"; | ||
import { | ||
IPluginFactoryOptions, | ||
PluginFactory, | ||
} from "@hyperledger/cactus-core-api"; | ||
|
||
import { | ||
AwsCredentialType, | ||
IPluginKeychainAwsSmOptions, | ||
PluginKeychainAwsSm, | ||
} from "./plugin-keychain-aws-sm"; | ||
|
||
export class PluginFactoryKeychain extends PluginFactory< | ||
PluginKeychainAwsSm, | ||
IPluginKeychainAwsSmOptions, | ||
IPluginFactoryOptions | ||
> { | ||
async create( | ||
pluginOptions: IPluginKeychainAwsSmOptions = { | ||
instanceId: uuidv4(), | ||
keychainId: uuidv4(), | ||
logLevel: "TRACE", | ||
awsProfile: "", | ||
awsRegion: "", | ||
awsEndpoint: "", | ||
awsCredentialType: AwsCredentialType.InMemory, | ||
}, | ||
): Promise<PluginKeychainAwsSm> { | ||
return new PluginKeychainAwsSm(pluginOptions); | ||
} | ||
} |
Oops, something went wrong.