-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from Sphereon-Opensource/feature/OIDF-69
feat: implement azure keyvault rest client
- Loading branch information
Showing
69 changed files
with
3,964 additions
and
1,294 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
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
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,10 @@ | ||
# Change Log | ||
|
||
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
# [0.26.0](https://github.com/Sphereon-OpenSource/SSI-SDK-crypto-extensions/compare/v0.25.0...v0.26.0) (2024-11-26) | ||
|
||
### Features | ||
|
||
- create kms-azure plugin structure ([61e1a61](https://github.com/Sphereon-OpenSource/SSI-SDK-crypto-extensions/commit/61e1a61f7442acf376d5cc6e39cdacdc336b8aa3)) |
Empty file.
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,123 @@ | ||
<!--suppress HtmlDeprecatedAttribute --> | ||
<h1 align="center"> | ||
<br> | ||
<a href="https://www.sphereon.com"><img src="https://sphereon.com/content/themes/sphereon/assets/img/logo.svg" alt="Sphereon" width="400"></a> | ||
<br>Sphereon's Azure KeyVault Key Management System REST Client Plugin | ||
<br> | ||
</h1> | ||
|
||
## Overview | ||
|
||
This module provides a Key Management System (KMS) wrapper that enables the use of Azure Key Vault REST client functionalities within your application. It extends the capabilities of the `AbstractKeyManagementSystem` by integrating with Azure's robust key management features. This ensures that key generation, signing, and verification operations are handled securely and efficiently, aligning with Veramo's key management functions. | ||
|
||
## Available Functions | ||
|
||
- `createKey` | ||
- `sign` | ||
- `verify` | ||
|
||
## Installation | ||
|
||
To install the module, use the following command: | ||
|
||
```bash | ||
yarn add @sphereon/ssi-sdk-ext.kms-azure-rest-client | ||
``` | ||
|
||
## Usage | ||
|
||
### Creating a Key | ||
|
||
To create a key, you need to specify the key type and optionally provide metadata, such as a key alias. Below is an example of how to create a key using the `AzureKeyVaultKeyManagementSystemRestClient`: | ||
|
||
```typescript | ||
import { AzureKeyVaultKeyManagementSystemRestClient } from '@sphereon/kms-azure-rest-client' | ||
|
||
const options = { | ||
applicationId: 'azure-keyvault-test', | ||
vaultUrl: 'https://example.vault.azure.net/', | ||
apiKey: 'your-api-key-here', | ||
} | ||
|
||
const keyManagementSystem = new AzureKeyVaultKeyManagementSystemRestClient(options) | ||
|
||
async function createKeyExample() { | ||
try { | ||
const key = await keyManagementSystem.createKey({ | ||
type: 'Secp256r1', | ||
meta: { keyAlias: 'my-secure-key' }, | ||
}) | ||
|
||
console.log('Key created:', key) | ||
} catch (error) { | ||
console.error('Error creating key:', error) | ||
} | ||
} | ||
|
||
createKeyExample() | ||
``` | ||
|
||
### Signing Data | ||
|
||
To sign data, provide the key reference (`kid`) and the data to be signed: | ||
|
||
```typescript | ||
async function signExample() { | ||
try { | ||
const signature = await keyManagementSystem.sign({ | ||
keyRef: { kid: 'your-key-id' }, | ||
data: new TextEncoder().encode('data-to-sign'), | ||
}) | ||
|
||
console.log('Signature:', signature) | ||
} catch (error) { | ||
console.error('Error signing data:', error) | ||
} | ||
} | ||
|
||
signExample() | ||
``` | ||
|
||
### Verifying Data | ||
|
||
To verify data, provide the key reference (`kid`), the data, and the signature: | ||
|
||
```typescript | ||
async function verifyExample() { | ||
try { | ||
const isValid = await keyManagementSystem.verify({ | ||
keyRef: { kid: 'your-key-id' }, | ||
data: new TextEncoder().encode('data-to-verify'), | ||
signature: 'signature-to-verify', | ||
}) | ||
|
||
console.log('Is signature valid?', isValid) | ||
} catch (error) { | ||
console.error('Error verifying signature:', error) | ||
} | ||
} | ||
|
||
verifyExample() | ||
``` | ||
|
||
## Configuration | ||
|
||
The `AzureKeyVaultKeyManagementSystemRestClient` requires the following configuration options: | ||
|
||
- `applicationId`: A unique identifier for your application. | ||
- `vaultUrl`: The base URL of your Azure Key Vault. | ||
- `apiKey`: The API key for authenticating requests. | ||
|
||
## Limitations | ||
|
||
This implementation currently supports the following key operations: | ||
|
||
- `createKey` | ||
- `sign` | ||
- `verify` | ||
|
||
Additional functionalities like `sharedSecret`, `importKey`, `deleteKey`, and `listKeys` are not implemented in this version and will throw an error if called. | ||
|
||
## License | ||
|
||
This project is licensed under the [MIT License](LICENSE). |
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,43 @@ | ||
{ | ||
"name": "@sphereon/ssi-sdk-ext.kms-azure-rest-client", | ||
"description": "Sphereon SSI-SDK plugin for Azure KeyVault Key Management System.", | ||
"version": "0.26.0", | ||
"source": "src/index.ts", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"build": "tsc --build", | ||
"build:clean": "tsc --build --clean && tsc --build" | ||
}, | ||
"dependencies": { | ||
"@sphereon/ssi-sdk-ext.did-utils": "workspace:*", | ||
"@sphereon/ssi-sdk-ext.key-utils": "workspace:*", | ||
"@sphereon/ssi-types": "0.30.2-feature.SDK.41.oidf.support.286", | ||
"@veramo/core": "4.2.0", | ||
"@veramo/key-manager": "4.2.0", | ||
"uint8arrays": "^3.1.1" | ||
}, | ||
"devDependencies": { | ||
"@types/text-encoding": "0.0.39" | ||
}, | ||
"files": [ | ||
"dist/**/*", | ||
"src/**/*", | ||
"README.md", | ||
"LICENSE" | ||
], | ||
"private": false, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": "[email protected]:Sphereon-OpenSource/SSI-SDK-crypto-extensions.git", | ||
"author": "Sphereon <[email protected]>", | ||
"license": "Apache-2.0", | ||
"keywords": [ | ||
"azure", | ||
"keyvault", | ||
"key-management", | ||
"react-native", | ||
"Veramo" | ||
] | ||
} |
Oops, something went wrong.