Feat/tt 907 encrypt decrypt oa functions#18
Conversation
ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Free ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds Husky pre-commit hook and prepare script, two new OpenAttestation CLI commands (oa-encrypt, oa-decrypt), CLI error and file I/O utilities, tests and fixture, README updates, and related dependency/devDependency changes. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant CLI as "CLI"
participant FS as "FileSystem"
participant KD as "KeyDerivation"
participant ENC as "EncryptLib"
User->>CLI: run oa-encrypt
CLI->>User: prompt document path, output path, passphrase
User->>CLI: provide inputs
CLI->>FS: read input document
FS-->>CLI: document content
CLI->>KD: derive 64-char key (SHA-256)
KD-->>CLI: derived key
CLI->>ENC: encrypt document with key
ENC-->>CLI: cipherText, iv, tag
CLI->>FS: write encrypted payload (cipherText, iv, tag, type)
FS-->>CLI: file written
CLI->>User: log success + key retention warning
sequenceDiagram
actor User
participant CLI as "CLI"
participant FS as "FileSystem"
participant Validator as "PayloadValidator"
participant KD as "KeyDerivation"
participant DEC as "DecryptLib"
User->>CLI: run oa-decrypt
CLI->>User: prompt encrypted path, output path, passphrase
User->>CLI: provide inputs
CLI->>FS: read encrypted file
FS-->>CLI: encrypted payload JSON
CLI->>Validator: validate payload (cipherText, iv, tag, type)
Validator-->>CLI: validation result
CLI->>KD: derive 64-char key (SHA-256)
KD-->>CLI: derived key
CLI->>DEC: decrypt cipherText with key
DEC-->>CLI: plaintext document
CLI->>FS: write plaintext to output file
FS-->>CLI: file written
CLI->>User: log success with output path
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
…of github.com:TrustVC/trustvc-cli into feat/TT-907-encrypt-decrypt-oa-functions
| | **Token Registry** | [`token-registry deploy`](#token-registry-deploy) | Deploy token registry contracts | | ||
| | | [`oa-encrypt`](#oa-encrypt) | Encrypt an OA document for safe sharing and storage | | ||
| | | [`oa-decrypt`](#oa-decrypt) | Decrypt an OA document encrypted with oa-encrypt | | ||
| | **Token Registry** | [`mint`](#mint) | Mint tokens to blockchain registries | |
There was a problem hiding this comment.
@RishabhS7 please review the readme once
|
🎉 This PR is included in version 1.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary by CodeRabbit
New Features
Documentation
Tests
Chores