Skip to content

Commit e05602b

Browse files
committed
Initial commit
0 parents  commit e05602b

File tree

11 files changed

+7780
-0
lines changed

11 files changed

+7780
-0
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 2
9+
10+
[*.md]
11+
insert_final_newline = false

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.DS_Store
2+
*.code-workspace
3+
/dist
4+
/node_modules
5+
npm-debug.log

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"cSpell.words": ["blockcrypt", "ciphertext"]
3+
}

LICENCE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 - present Sun Knudsen and contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# BlockCrypt (beta)
2+
3+
## Encrypt one or more secrets with plausible deniability by design.
4+
5+
BlockCrypt uses Base58 to render one or more AES-256-CBC-encrypted secrets indistinguishable from each other and padding yielding ciphertext “blocks” of fixed size that one can print as QR codes.
6+
7+
## Installation
8+
9+
```console
10+
$ npm install blockcrypt
11+
```
12+
13+
## Usage (simplified for demonstration purposes)
14+
15+
```typescript
16+
import { encrypt, decrypt, Secret } from "./index.js"
17+
18+
const secrets: Secret[] = [
19+
{
20+
message:
21+
"trust vast puppy supreme public course output august glimpse reunion kite rebel virus tail pass enhance divorce whip edit skill dismiss alpha divert ketchup",
22+
passphrase: "lip gift name net sixth",
23+
},
24+
{
25+
message: "this is a test\nyo",
26+
passphrase: "grunt daisy chow barge pants",
27+
},
28+
{
29+
message: "foo",
30+
passphrase: "decor gooey wish kept pug",
31+
},
32+
]
33+
34+
const block = await encrypt(secrets, kdf)
35+
// {
36+
// salt: 'PZE3jTZh45dkU6Du2H4T1j',
37+
// iv: '35Trmr54uFiqdd7xTs4iM7',
38+
// ciphertext: '5fwe9NVe1omHDCWy5hPAk1Vne2XvwFCHAWBLjwxnFFFGm4tvhQVY55N9o5RnVGA1gd5EfX8xxWYZGxnbeUM9sqK8SzbCi2R5nA4K2zJ4oc4j6HFBiYkVq4JCfuAgoq2KwY1VSqtfBkcEMHqasDv263pbFdMQUiQDGDTCKZPCfDzqTUsFF19jKX51JPin8AxU7ywZ1vsWjLjmo41zVAX1jCLi1gD5tg1XqbaGVcSodx5pjWrgATSF9gT5JHgXMgng2tWRgsW3itpRe3nfb4ZQNCGGv4JCv3HSvzs2kt3SfsjFCkQR8SRK5eBdLKzGVUYhx4cs3dXTW1ujUegag3p8yuGf5uuzydAiFePz7Kq5hcHMfQpBj6YBaF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Cv3HSvzs2kt3SfsjFCkQR8SRK5eBdLKzGVUYhx4cs3dXTW1ujUegag3p8yuGf5uuzydAiFePz7Kq5hcHMfQpBj6YBaFKwe3y5Z8bk2yZ8LoyaF5xWSTkG8qkKQVXY3556JU3xovwxE75BhZnW3cTpDYX7sQ1nEYCjcVF3gQZqkcEfsb29J7k9yNa99VKidyQkjdwHZbXRWwidNrmVuS9Wu7RyYmsQ6SSXX4EhWAUz1UFSMfftuP7VAsUpEETVAKYAnBXLxNEYjbKsgLvEGkFAgGZiobk3byJQeGcwa1eLtRCAuuy6vww5pPpMz6pfdofF3EfEGzP9FxKnZ8FVtBvRiwfLU6wk8VLUPvhyqhqsRQqJzX2nGotJZ5F1nrsBX8aLW1oSpcb2cEw6eVAzF7WFm37PEypDbbjXw4kdUxvhMZs4RqRcBzbs2D4kxjvUu4fhH3zoqCrT5ZZDC9cFTUFaGe6i2mcfWQmaoav5hvY5RrQ4UCs1GPZorcY5fHDbkh86MZu5ZmiNkkMETGBD2ycn63djVdBhdHAT4g1M2gMUgCoQbTVePdoymHgGchcH9gS3oKjH9a5oyuff6ydKynQ6D4qGrjeFaZnVmBaCEgLNNbzGAuiHTwL692K61udXYLi4uw2T16VpUGDrfUiVgD8h6R9UagLFAC5vaz6QHFTfceM3pnvQCE4Vq7rf9EPs51GLEbyLCtXda45yZuJ4yCGeCPrKMNHLw44ppnkY",
47+
kdf,
48+
"cold" // One can optionally supply needle to significantly speed up decryption
49+
)
50+
// this is a test
51+
// yo
52+
```

0 commit comments

Comments
 (0)