simple-hpke 0.0.8 → 0.0.9
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 +11 -14
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +2 -2
- package/dist/index.min.cjs.map +2 -2
- package/dist/index.min.js.map +2 -2
- package/dist/meta.json +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Simple HPKE
|
|
2
2
|
[](https://github.com/nichoth/simple-hpke/actions/workflows/nodejs.yml)
|
|
3
|
-
[](README.md)
|
|
4
4
|
[](README.md)
|
|
5
5
|
[](https://semver.org/)
|
|
6
6
|
[](./CHANGELOG.md)
|
|
7
|
-
[](https://packagephobia.com/result?p=simple-hpke)
|
|
8
|
+
[](https://bundlephobia.com/package/simple-hpke)
|
|
9
9
|
[](LICENSE)
|
|
10
10
|
|
|
11
11
|
|
|
@@ -42,7 +42,7 @@ Hybrid Public Key Encryption
|
|
|
42
42
|
## Install
|
|
43
43
|
|
|
44
44
|
```sh
|
|
45
|
-
npm i -S
|
|
45
|
+
npm i -S simple-hpke
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
## Example
|
|
@@ -54,7 +54,7 @@ Wrap an AES key, or encrypt a message.
|
|
|
54
54
|
Encrypt an AES key to yourself, then recover it later.
|
|
55
55
|
|
|
56
56
|
```ts
|
|
57
|
-
import { seal, open } from '
|
|
57
|
+
import { seal, open } from 'simple-hpke'
|
|
58
58
|
|
|
59
59
|
// An X25519 keypair. The private key can be non-extractable.
|
|
60
60
|
// HPKE needs only `deriveBits`.
|
|
@@ -91,7 +91,7 @@ IV. The recipient uses their private key to open the AES key and decrypt
|
|
|
91
91
|
the message.
|
|
92
92
|
|
|
93
93
|
```ts
|
|
94
|
-
import { seal, open } from '
|
|
94
|
+
import { seal, open } from 'simple-hpke'
|
|
95
95
|
|
|
96
96
|
const recipient = await crypto.subtle.generateKey(
|
|
97
97
|
{ name: 'X25519' },
|
|
@@ -155,10 +155,7 @@ cipher text). `decrypt` reverses it, returning the plaintext bytes.
|
|
|
155
155
|
|
|
156
156
|
|
|
157
157
|
```ts
|
|
158
|
-
import {
|
|
159
|
-
encrypt,
|
|
160
|
-
decrypt
|
|
161
|
-
} from '@substrate-system/simple-hpke'
|
|
158
|
+
import { encrypt, decrypt } from 'simple-hpke'
|
|
162
159
|
|
|
163
160
|
// need a public key for the recipient
|
|
164
161
|
const recipient = await crypto.subtle.generateKey(
|
|
@@ -221,7 +218,7 @@ for transports that carry text (JSON, URLs, headers). `opts.encoding` sets the
|
|
|
221
218
|
string encoding. Default encoding is `base64url`.
|
|
222
219
|
|
|
223
220
|
```ts
|
|
224
|
-
import { encrypt, decrypt } from '
|
|
221
|
+
import { encrypt, decrypt } from 'simple-hpke'
|
|
225
222
|
import { fromString } from 'uint8arrays'
|
|
226
223
|
|
|
227
224
|
// recipient is any RecipientKey; keypair holds the matching private key
|
|
@@ -289,12 +286,12 @@ This exposes ESM and common JS via
|
|
|
289
286
|
|
|
290
287
|
### ESM
|
|
291
288
|
```js
|
|
292
|
-
import { seal, open, encrypt, decrypt } from '
|
|
289
|
+
import { seal, open, encrypt, decrypt } from 'simple-hpke'
|
|
293
290
|
```
|
|
294
291
|
|
|
295
292
|
### Common JS
|
|
296
293
|
```js
|
|
297
|
-
require('
|
|
294
|
+
require('simple-hpke')
|
|
298
295
|
```
|
|
299
296
|
|
|
300
297
|
### pre-built JS
|
|
@@ -303,7 +300,7 @@ accessible to your web server, then link to them in HTML.
|
|
|
303
300
|
|
|
304
301
|
#### copy
|
|
305
302
|
```sh
|
|
306
|
-
cp ./node_modules
|
|
303
|
+
cp ./node_modules/simple-hpke/dist/index.min.js ./public/hpke.min.js
|
|
307
304
|
```
|
|
308
305
|
|
|
309
306
|
#### HTML
|