forked from hyperledger-cacti/cacti
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core-api): 🎸 add IKeychainPlugin#getKeychainId()
New method on the generic interface for keychain plugins that enables the handling of multiple different keychain backends on the same API server. This is useful if you want to have different instances of keychain plugins deployed because for example your consortium member operates multiple keychain backends such as one provided by the cloud provider of their choice and another one that could be a self-hosted, open source software deployment. Cactus aims not to limit the deployment architecture where possible and this feature is aimed at maintaining that design principle. The idea is that API requests can specify which keychain they want to use when looking up the signing key for a transaction. The implementation that serves the request then reaches to the PluginRegistry and retrieves a list of keychain plugins, then proceeds to filter that list down to just the one instance based on the keychain ID that has to match up to what was specified in the API request being served. Signed-off-by: Peter Somogyvari <[email protected]>
- Loading branch information
Showing
4 changed files
with
71 additions
and
25 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
packages/cactus-core-api/src/main/typescript/plugin/keychain/i-plugin-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 |
---|---|---|
@@ -1,6 +1,20 @@ | ||
import { IPluginKVStorage } from "../storage/key-value/i-plugin-kv-storage"; | ||
|
||
/** | ||
* Common interface to be implemented by classes that act as plugins behind | ||
* keychains. | ||
*/ | ||
export interface IPluginKeychain extends IPluginKVStorage { | ||
rotateEncryptionKeys(): Promise<void>; | ||
getEncryptionAlgorithm(): string; | ||
/** | ||
* Returns the unique identifier of the keychain pointed to (or backed) by | ||
* this `IPluginKeychain` instance. | ||
* This therefore does not uniqely identify the plugin instance itself, but | ||
* its backend instead. | ||
* Useful for being able to reference keychains by their IDs in deployment | ||
* scenarios when there are multiple keychain backends for different sets of | ||
* secrets. | ||
*/ | ||
getKeychainId(): string; | ||
} |
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
5 changes: 4 additions & 1 deletion
5
packages/cactus-plugin-keychain-memory/src/main/typescript/public-api.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