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:
20
packages/auth/README.md
Normal file
20
packages/auth/README.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# @the-order/auth
|
||||
|
||||
Authentication and authorization helpers for The Order.
|
||||
|
||||
## Features
|
||||
|
||||
- OIDC/OAuth2 support
|
||||
- DID (Decentralized Identifier) support
|
||||
- eIDAS integration
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
import { OIDCProvider, DIDResolver, EIDASProvider } from '@the-order/auth';
|
||||
|
||||
const oidc = new OIDCProvider(config);
|
||||
const didResolver = new DIDResolver();
|
||||
const eidas = new EIDASProvider(config);
|
||||
```
|
||||
|
||||
23
packages/auth/package.json
Normal file
23
packages/auth/package.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "@the-order/auth",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"description": "Authentication and authorization helpers for The Order",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"dev": "tsc --watch",
|
||||
"lint": "eslint src --ext .ts",
|
||||
"type-check": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"jsonwebtoken": "^9.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jsonwebtoken": "^9.0.5",
|
||||
"@types/node": "^20.10.6",
|
||||
"typescript": "^5.3.3"
|
||||
}
|
||||
}
|
||||
|
||||
34
packages/auth/src/did.ts
Normal file
34
packages/auth/src/did.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* DID (Decentralized Identifier) helpers
|
||||
*/
|
||||
|
||||
export interface DIDDocument {
|
||||
id: string;
|
||||
'@context': string[];
|
||||
verificationMethod: VerificationMethod[];
|
||||
authentication: string[];
|
||||
}
|
||||
|
||||
export interface VerificationMethod {
|
||||
id: string;
|
||||
type: string;
|
||||
controller: string;
|
||||
publicKeyMultibase?: string;
|
||||
}
|
||||
|
||||
export class DIDResolver {
|
||||
async resolve(did: string): Promise<DIDDocument> {
|
||||
// Implementation for DID resolution
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
async verifySignature(
|
||||
did: string,
|
||||
message: string,
|
||||
signature: string
|
||||
): Promise<boolean> {
|
||||
// Implementation for signature verification
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
}
|
||||
|
||||
29
packages/auth/src/eidas.ts
Normal file
29
packages/auth/src/eidas.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* eIDAS (electronic IDentification, Authentication and trust Services) helpers
|
||||
*/
|
||||
|
||||
export interface EIDASConfig {
|
||||
providerUrl: string;
|
||||
apiKey: string;
|
||||
}
|
||||
|
||||
export interface EIDASSignature {
|
||||
signature: string;
|
||||
certificate: string;
|
||||
timestamp: Date;
|
||||
}
|
||||
|
||||
export class EIDASProvider {
|
||||
constructor(private config: EIDASConfig) {}
|
||||
|
||||
async requestSignature(document: string): Promise<EIDASSignature> {
|
||||
// Implementation for eIDAS signature request
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
async verifySignature(signature: EIDASSignature): Promise<boolean> {
|
||||
// Implementation for eIDAS signature verification
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
}
|
||||
|
||||
8
packages/auth/src/index.ts
Normal file
8
packages/auth/src/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* The Order Auth Package
|
||||
*/
|
||||
|
||||
export * from './oidc';
|
||||
export * from './did';
|
||||
export * from './eidas';
|
||||
|
||||
31
packages/auth/src/oidc.ts
Normal file
31
packages/auth/src/oidc.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* OIDC/OAuth2 helpers
|
||||
*/
|
||||
|
||||
export interface OIDCConfig {
|
||||
issuer: string;
|
||||
clientId: string;
|
||||
clientSecret: string;
|
||||
redirectUri: string;
|
||||
}
|
||||
|
||||
export class OIDCProvider {
|
||||
constructor(private config: OIDCConfig) {}
|
||||
|
||||
async getAuthorizationUrl(state: string): Promise<string> {
|
||||
const params = new URLSearchParams({
|
||||
client_id: this.config.clientId,
|
||||
redirect_uri: this.config.redirectUri,
|
||||
response_type: 'code',
|
||||
scope: 'openid profile email',
|
||||
state,
|
||||
});
|
||||
return `${this.config.issuer}/authorize?${params.toString()}`;
|
||||
}
|
||||
|
||||
async exchangeCodeForToken(code: string): Promise<string> {
|
||||
// Implementation for token exchange
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
}
|
||||
|
||||
10
packages/auth/tsconfig.json
Normal file
10
packages/auth/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