@luisotaviopilotto/cryptmp 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,42 +11,37 @@ Requer **Node 16+** (OpenSSL 1.1.1+, para `sha3-256` e `shake256`).
|
|
|
11
11
|
## Instalação
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npm install cryptmp
|
|
14
|
+
npm install @luisotaviopilotto/cryptmp
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
> O comando acima só funciona depois que o pacote estiver **publicado no npm
|
|
18
|
-
>
|
|
19
|
-
>
|
|
17
|
+
> O comando acima só funciona depois que o pacote estiver **publicado no npm**.
|
|
18
|
+
> Enquanto não publicar, dá para instalar do jeito local — mesmo nome, mesmo
|
|
19
|
+
> `require('@luisotaviopilotto/cryptmp')`:
|
|
20
20
|
>
|
|
21
21
|
> ```bash
|
|
22
22
|
> # a) direto da pasta do projeto
|
|
23
23
|
> npm install /caminho/para/cryptmp-js
|
|
24
24
|
>
|
|
25
|
-
> # b) via tarball (gera cryptmp-1.0.0.tgz)
|
|
25
|
+
> # b) via tarball (gera luisotaviopilotto-cryptmp-1.0.0.tgz)
|
|
26
26
|
> cd cryptmp-js && npm pack
|
|
27
|
-
> npm install /caminho/para/cryptmp-1.0.0.tgz
|
|
27
|
+
> npm install /caminho/para/luisotaviopilotto-cryptmp-1.0.0.tgz
|
|
28
28
|
>
|
|
29
29
|
> # c) direto do GitHub
|
|
30
30
|
> npm install git+https://github.com/luisotaviopilotto/cryptmp-js.git
|
|
31
31
|
> ```
|
|
32
32
|
|
|
33
|
-
### Publicar no npm
|
|
33
|
+
### Publicar no npm
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
36
|
cd cryptmp-js
|
|
37
37
|
npm login
|
|
38
|
-
npm publish
|
|
38
|
+
npm publish --access public # pacotes com escopo são privados por padrão
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
Se o nome `cryptmp` já estiver ocupado, use um nome com escopo — troque
|
|
42
|
-
`"name"` no `package.json` para `"@luisotaviopilotto/cryptmp"` e rode
|
|
43
|
-
`npm publish --access public`; a instalação vira
|
|
44
|
-
`npm install @luisotaviopilotto/cryptmp`.
|
|
45
|
-
|
|
46
41
|
## Uso
|
|
47
42
|
|
|
48
43
|
```js
|
|
49
|
-
const th = require('cryptmp'); //
|
|
44
|
+
const th = require('@luisotaviopilotto/cryptmp'); // ou require('./cryptmp') local
|
|
50
45
|
|
|
51
46
|
// 1. Chave global de 32 bytes — de um segredo, nunca do banco.
|
|
52
47
|
const key = th.Key.fromHex(1, '…64 hex chars…'); // ou th.Key.generate(1)
|
|
@@ -83,6 +78,12 @@ printf 'minha_senha' | node bin/cryptmp.js hash --cost 12
|
|
|
83
78
|
node bin/cryptmp.js verify '$th$1$12$1$...' 'minha_senha'
|
|
84
79
|
```
|
|
85
80
|
|
|
81
|
+
Com o pacote instalado, o binário `cryptmp` fica disponível via `npx`:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npx cryptmp gen-key
|
|
85
|
+
```
|
|
86
|
+
|
|
86
87
|
## Testes
|
|
87
88
|
|
|
88
89
|
```bash
|
package/package.json
CHANGED