How liyunlong1228/api-encrypt-scaffold works
This is a TypeScript client-side API encryption library. Its main workflow is opt-in Axios request encryption: generate a fresh AES key, encrypt the request body with AES, and RSA-encrypt the key for a header; on responses, use the returned encrypted-key header to recover the AES key and decrypt the body. The README also documents direct use of the crypto helpers and configurable RSA keys. Relationships follow the sampled interceptor calls; server-side behavior is shown only as the documented external exchange.
Main entry points: axios.ts Axios interceptors · crypto.ts AES helpers · index.ts Library exports · jsencrypt.ts RSA helpers and config
Components 7
Axios integration
- Axios interceptors
src/interceptors/axios.ts
Cryptography core
- AES helpers
src/core/crypto.ts - RSA helpers and config
src/core/jsencrypt.ts
Public API
- Library exports
src/index.ts - Type definitions
src/types/index.ts
Other components
- Application
- API server
Connections 16
- Application → Library exports: imports
- Library exports → Axios interceptors: exports setup
- Library exports → AES helpers: exports helpers
- Library exports → RSA helpers and config: exports helpers
- Library exports → Type definitions: exports types
- Application → Axios interceptors: configures Axios
- Axios interceptors → RSA helpers and config: initializes keys
- Axios interceptors → AES helpers: generates key
- Axios interceptors → AES helpers: encodes key
- Axios interceptors → RSA helpers and config: encrypts key
- Axios interceptors → AES helpers: encrypts body
- Axios interceptors → API server: sends body and key header
- API server → Axios interceptors: returns response and key header
- Axios interceptors → RSA helpers and config: decrypts response key
- Axios interceptors → AES helpers: decodes key
- Axios interceptors → AES helpers: decrypts response body