Skip to content

Commit

Permalink
chore: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed Nov 13, 2024
1 parent 545f65f commit 9a4c3cc
Show file tree
Hide file tree
Showing 15 changed files with 1,293 additions and 103 deletions.
4 changes: 4 additions & 0 deletions packages/auto-tls/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ It also requires the Identify protocol.
import { noise } from '@chainsafe/libp2p-noise'
import { yamux } from '@chainsafe/libp2p-yamux'
import { autoTLS } from '@libp2p/auto-tls'
import { identify } from '@libp2p/identify'
import { keychain } from '@libp2p/keychain'
import { webSockets } from '@libp2p/websockets'
import { uPnPNAT } from '@libp2p/upnp-nat'
import { createLibp2p } from 'libp2p'
Expand All @@ -64,6 +66,8 @@ const node = await createLibp2p({
],
services: {
autoTLS: autoTLS(),
identify: identify(),
keychain: keychain(),
upnp: uPnPNAT()
}
})
Expand Down
20 changes: 17 additions & 3 deletions packages/auto-tls/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,33 @@
"doc-check": "aegir doc-check"
},
"dependencies": {
"@chainsafe/is-ip": "^2.0.2",
"@libp2p/crypto": "^5.0.6",
"@libp2p/http-fetch": "^2.0.2",
"@libp2p/interface": "^2.2.0",
"@libp2p/interface-internal": "^2.0.10",
"@libp2p/keychain": "^5.0.9",
"@libp2p/utils": "^6.1.3",
"@multiformats/multiaddr": "^12.3.1",
"@multiformats/multiaddr-matcher": "^1.4.0",
"@peculiar/webcrypto": "^1.5.0",
"@peculiar/x509": "^1.12.3",
"acme-client": "^5.4.0",
"multiformats": "^13.3.1"
"interface-datastore": "^8.3.1",
"multiformats": "^13.3.1",
"uint8arrays": "^5.1.0"
},
"devDependencies": {
"aegir": "^44.0.1"
"@libp2p/logger": "^5.1.3",
"@libp2p/peer-id": "^5.0.7",
"aegir": "^44.0.1",
"datastore-core": "^10.0.2",
"delay": "^6.0.0",
"p-event": "^6.0.1",
"sinon": "^19.0.2",
"sinon-ts": "^2.0.0"
},
"browser": {
"./dist/src/auto-tls.js": "./dist/src/auto-tls.browser.js"
},
"sideEffects": false
}
10 changes: 10 additions & 0 deletions packages/auto-tls/src/auto-tls.browser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { AutoTLS as AutoTLSInterface } from './index.js'
import type { TLSCertificate } from '@libp2p/interface'

export class AutoTLS implements AutoTLSInterface {
public certificate?: TLSCertificate

constructor () {
throw new Error('Auto-TLS does not work in browsers')
}
}
Loading

0 comments on commit 9a4c3cc

Please sign in to comment.