Update README.md to provide a comprehensive overview of The Order monorepo, including repository structure, quickstart guide, development workflow, and contribution guidelines.
This commit is contained in:
22
packages/crypto/README.md
Normal file
22
packages/crypto/README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# @the-order/crypto
|
||||
|
||||
KMS/HSM client, key management, and signatures for eIDAS/DID.
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
import { KMSClient, SignatureService } from '@the-order/crypto';
|
||||
|
||||
const kms = new KMSClient(config);
|
||||
const signatureService = new SignatureService(kms);
|
||||
|
||||
const signature = await signatureService.sign(data, options);
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- KMS/HSM integration
|
||||
- Key management
|
||||
- Digital signatures
|
||||
- eIDAS/DID support
|
||||
|
||||
22
packages/crypto/package.json
Normal file
22
packages/crypto/package.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "@the-order/crypto",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"description": "KMS/HSM client, key management, and signatures for eIDAS/DID",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"dev": "tsc --watch",
|
||||
"lint": "eslint src --ext .ts",
|
||||
"type-check": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-kms": "^3.490.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.10.6",
|
||||
"typescript": "^5.3.3"
|
||||
}
|
||||
}
|
||||
|
||||
7
packages/crypto/src/index.ts
Normal file
7
packages/crypto/src/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* The Order Crypto Package
|
||||
*/
|
||||
|
||||
export * from './kms';
|
||||
export * from './signature';
|
||||
|
||||
34
packages/crypto/src/kms.ts
Normal file
34
packages/crypto/src/kms.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* KMS/HSM client for key management
|
||||
*/
|
||||
|
||||
export interface KMSConfig {
|
||||
provider: 'aws' | 'gcp' | 'azure' | 'hsm';
|
||||
keyId: string;
|
||||
region?: string;
|
||||
}
|
||||
|
||||
export class KMSClient {
|
||||
constructor(private config: KMSConfig) {}
|
||||
|
||||
async encrypt(plaintext: Buffer): Promise<Buffer> {
|
||||
// Implementation for encryption
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
async decrypt(ciphertext: Buffer): Promise<Buffer> {
|
||||
// Implementation for decryption
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
async sign(data: Buffer): Promise<Buffer> {
|
||||
// Implementation for signing
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
async verify(data: Buffer, signature: Buffer): Promise<boolean> {
|
||||
// Implementation for signature verification
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
}
|
||||
|
||||
33
packages/crypto/src/signature.ts
Normal file
33
packages/crypto/src/signature.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Signature utilities for eIDAS/DID
|
||||
*/
|
||||
|
||||
import { KMSClient } from './kms';
|
||||
|
||||
export interface SignatureOptions {
|
||||
algorithm: 'RS256' | 'ES256' | 'EdDSA';
|
||||
keyId: string;
|
||||
}
|
||||
|
||||
export class SignatureService {
|
||||
constructor(private kms: KMSClient) {}
|
||||
|
||||
async sign(data: Buffer, options: SignatureOptions): Promise<Buffer> {
|
||||
return this.kms.sign(data);
|
||||
}
|
||||
|
||||
async verify(
|
||||
data: Buffer,
|
||||
signature: Buffer,
|
||||
options: SignatureOptions
|
||||
): Promise<boolean> {
|
||||
return this.kms.verify(data, signature);
|
||||
}
|
||||
|
||||
async signJSON(data: unknown, options: SignatureOptions): Promise<string> {
|
||||
const jsonString = JSON.stringify(data);
|
||||
const signature = await this.sign(Buffer.from(jsonString), options);
|
||||
return signature.toString('base64');
|
||||
}
|
||||
}
|
||||
|
||||
10
packages/crypto/tsconfig.json
Normal file
10
packages/crypto/tsconfig.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user