@libp2p/crypto 0.22.14 → 1.0.0

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 CHANGED
@@ -1,15 +1,48 @@
1
- # js-libp2p-crypto
1
+ # @libp2p/crypto <!-- omit in toc -->
2
+
3
+ [![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)
4
+ [![IRC](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p)
5
+ [![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io)
6
+ [![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p-crypto.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-crypto)
7
+ [![CI](https://img.shields.io/github/workflow/status/libp2p/js-libp2p-interfaces/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/libp2p/js-libp2p-crypto/actions/workflows/js-test-and-release.yml)
8
+
9
+ > Crypto primitives for libp2p
10
+
11
+ ## Table of contents <!-- omit in toc -->
12
+
13
+ - [Install](#install)
14
+ - [Lead Maintainer](#lead-maintainer)
15
+ - [Usage](#usage)
16
+ - [Web Crypto API](#web-crypto-api)
17
+ - [API](#api)
18
+ - [`crypto.aes`](#cryptoaes)
19
+ - [`crypto.aes.create(key, iv)`](#cryptoaescreatekey-iv)
20
+ - [`decrypt(data)`](#decryptdata)
21
+ - [`encrypt(data)`](#encryptdata)
22
+ - [`crypto.hmac`](#cryptohmac)
23
+ - [`crypto.hmac.create(hash, secret)`](#cryptohmaccreatehash-secret)
24
+ - [`digest(data)`](#digestdata)
25
+ - [`crypto.keys`](#cryptokeys)
26
+ - [`crypto.keys.generateKeyPair(type, bits)`](#cryptokeysgeneratekeypairtype-bits)
27
+ - [`crypto.keys.generateEphemeralKeyPair(curve)`](#cryptokeysgenerateephemeralkeypaircurve)
28
+ - [`crypto.keys.keyStretcher(cipherType, hashType, secret)`](#cryptokeyskeystretcherciphertype-hashtype-secret)
29
+ - [`crypto.keys.marshalPublicKey(key, [type])`](#cryptokeysmarshalpublickeykey-type)
30
+ - [`crypto.keys.unmarshalPublicKey(buf)`](#cryptokeysunmarshalpublickeybuf)
31
+ - [`crypto.keys.marshalPrivateKey(key, [type])`](#cryptokeysmarshalprivatekeykey-type)
32
+ - [`crypto.keys.unmarshalPrivateKey(buf)`](#cryptokeysunmarshalprivatekeybuf)
33
+ - [`crypto.keys.import(encryptedKey, password)`](#cryptokeysimportencryptedkey-password)
34
+ - [`privateKey.export(password, format)`](#privatekeyexportpassword-format)
35
+ - [`crypto.randomBytes(number)`](#cryptorandombytesnumber)
36
+ - [`crypto.pbkdf2(password, salt, iterations, keySize, hash)`](#cryptopbkdf2password-salt-iterations-keysize-hash)
37
+ - [Contribute](#contribute)
38
+ - [License](#license)
39
+ - [Contribution](#contribution)
2
40
 
3
- [![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)
4
- [![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)
5
- [![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p)
6
- [![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io)
7
- [![](https://img.shields.io/codecov/c/github/libp2p/js-libp2p-crypto.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-crypto)
8
- [![](https://img.shields.io/travis/libp2p/js-libp2p-crypto.svg?style=flat-square)](https://travis-ci.com/libp2p/js-libp2p-crypto)
9
- [![Dependency Status](https://david-dm.org/libp2p/js-libp2p-crypto.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-crypto)
10
- [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
41
+ ## Install
11
42
 
12
- > Crypto primitives for libp2p in JavaScript
43
+ ```console
44
+ $ npm i @libp2p/crypto
45
+ ```
13
46
 
14
47
  This repo contains the JavaScript implementation of the crypto primitives needed for libp2p. This is based on this [go implementation](https://github.com/libp2p/go-libp2p-crypto).
15
48
 
@@ -17,43 +50,6 @@ This repo contains the JavaScript implementation of the crypto primitives needed
17
50
 
18
51
  [Jacob Heun](https://github.com/jacobheun/)
19
52
 
20
- ## Table of Contents
21
-
22
- - [js-libp2p-crypto](#js-libp2p-crypto)
23
- - [Lead Maintainer](#lead-maintainer)
24
- - [Table of Contents](#table-of-contents)
25
- - [Install](#install)
26
- - [Usage](#usage)
27
- - [Web Crypto API](#web-crypto-api)
28
- - [API](#api)
29
- - [`crypto.aes`](#cryptoaes)
30
- - [`crypto.aes.create(key, iv)`](#cryptoaescreatekey-iv)
31
- - [`decrypt(data)`](#decryptdata)
32
- - [`encrypt(data)`](#encryptdata)
33
- - [`crypto.hmac`](#cryptohmac)
34
- - [`crypto.hmac.create(hash, secret)`](#cryptohmaccreatehash-secret)
35
- - [`digest(data)`](#digestdata)
36
- - [`crypto.keys`](#cryptokeys)
37
- - [`crypto.keys.generateKeyPair(type, bits)`](#cryptokeysgeneratekeypairtype-bits)
38
- - [`crypto.keys.generateEphemeralKeyPair(curve)`](#cryptokeysgenerateephemeralkeypaircurve)
39
- - [`crypto.keys.keyStretcher(cipherType, hashType, secret)`](#cryptokeyskeystretcherciphertype-hashtype-secret)
40
- - [`crypto.keys.marshalPublicKey(key, [type])`](#cryptokeysmarshalpublickeykey-type)
41
- - [`crypto.keys.unmarshalPublicKey(buf)`](#cryptokeysunmarshalpublickeybuf)
42
- - [`crypto.keys.marshalPrivateKey(key, [type])`](#cryptokeysmarshalprivatekeykey-type)
43
- - [`crypto.keys.unmarshalPrivateKey(buf)`](#cryptokeysunmarshalprivatekeybuf)
44
- - [`crypto.keys.import(encryptedKey, password)`](#cryptokeysimportencryptedkey-password)
45
- - [`privateKey.export(password, format)`](#privatekeyexportpassword-format)
46
- - [`crypto.randomBytes(number)`](#cryptorandombytesnumber)
47
- - [`crypto.pbkdf2(password, salt, iterations, keySize, hash)`](#cryptopbkdf2password-salt-iterations-keysize-hash)
48
- - [Contribute](#contribute)
49
- - [License](#license)
50
-
51
- ## Install
52
-
53
- ```sh
54
- npm install --save libp2p-crypto
55
- ```
56
-
57
53
  ## Usage
58
54
 
59
55
  ```js
@@ -311,4 +307,11 @@ This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/c
311
307
 
312
308
  ## License
313
309
 
314
- [MIT](./LICENSE)
310
+ Licensed under either of
311
+
312
+ - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
313
+ - MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
314
+
315
+ ## Contribution
316
+
317
+ Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
@@ -6,7 +6,7 @@ import generateEphemeralKeyPair from './ephemeral-keys.js';
6
6
  import * as RSA from './rsa-class.js';
7
7
  import * as Ed25519 from './ed25519-class.js';
8
8
  import * as Secp256k1 from './secp256k1-class.js';
9
- import type { PrivateKey, PublicKey } from '@libp2p/interfaces/keys';
9
+ import type { PrivateKey, PublicKey } from '@libp2p/interface-keys';
10
10
  export { keyStretcher };
11
11
  export { generateEphemeralKeyPair };
12
12
  export { keysPBM };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/keys/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AACpC,OAAO,wBAAwB,CAAA;AAC/B,OAAO,uBAAuB,CAAA;AAK9B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,wBAAwB,MAAM,qBAAqB,CAAA;AAE1D,OAAO,KAAK,GAAG,MAAM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,CAAC,EAAE,MAAM,GAAG,UAAU,CAIxF;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAgB5F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/crypto",
3
- "version": "0.22.14",
3
+ "version": "1.0.0",
4
4
  "description": "Crypto primitives for libp2p",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p-crypto#readme",
@@ -48,18 +48,23 @@
48
48
  ],
49
49
  "exports": {
50
50
  ".": {
51
+ "types": "./src/index.d.ts",
51
52
  "import": "./dist/src/index.js"
52
53
  },
53
54
  "./aes": {
55
+ "types": "./dist/src/aes/index.d.ts",
54
56
  "import": "./dist/src/aes/index.js"
55
57
  },
56
58
  "./ciphers": {
59
+ "types": "./dist/src/ciphers/index.d.ts",
57
60
  "import": "./dist/src/ciphers/index.js"
58
61
  },
59
62
  "./hmac": {
63
+ "types": "./dist/src/hmac/index.d.ts",
60
64
  "import": "./dist/src/hmac/index.js"
61
65
  },
62
66
  "./keys": {
67
+ "types": "./dist/src/keys/index.d.ts",
63
68
  "import": "./dist/src/keys/index.js"
64
69
  }
65
70
  },
@@ -169,7 +174,7 @@
169
174
  "generate": "protons ./src/keys/keys.proto"
170
175
  },
171
176
  "dependencies": {
172
- "@libp2p/interfaces": "^2.0.1",
177
+ "@libp2p/interface-keys": "^1.0.2",
173
178
  "@noble/ed25519": "^1.6.0",
174
179
  "@noble/secp256k1": "^1.5.4",
175
180
  "err-code": "^3.0.1",
package/src/keys/index.ts CHANGED
@@ -11,7 +11,7 @@ import { importer } from './importer.js'
11
11
  import * as RSA from './rsa-class.js'
12
12
  import * as Ed25519 from './ed25519-class.js'
13
13
  import * as Secp256k1 from './secp256k1-class.js'
14
- import type { PrivateKey, PublicKey } from '@libp2p/interfaces/keys'
14
+ import type { PrivateKey, PublicKey } from '@libp2p/interface-keys'
15
15
 
16
16
  export { keyStretcher }
17
17
  export { generateEphemeralKeyPair }