-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use @helia/verified-fetch #63
Merged
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
9a080cd
feat: use @helia/verified-fetch
SgtPooki a27934d
chore: use local tarball so CI runs properly
SgtPooki b4c61e5
feat: re-enable custom libp2p
SgtPooki e9f47e5
chore: update fastify
SgtPooki 1c781c4
chore: some minor changes
SgtPooki daa4fed
fix: fastify/cors patch version
SgtPooki 893a320
chore: package-lock cleared out
SgtPooki 3ad077f
fix: lint issues
SgtPooki a774085
deps: use @helia/verified-fetch@next
SgtPooki d9d14e9
feat: content-type-parser for verified-fetch & dep-check fixes
SgtPooki 34afd73
deps: update *-level deps
SgtPooki 7dc2af9
deps: update libp2p deps
SgtPooki 7933118
deps: fix pino-pretty missing error from fastify
SgtPooki 9e2e338
fix: dns-link label decoding
SgtPooki 6564215
chore: remove verified-fetch tarball
SgtPooki 6312031
chore: cleanup console logging and eslint disabling comments
SgtPooki 29c27d6
deps: helia&libp2p deps
SgtPooki 4597384
deps: use full semver strings for deps. remove @types/mime-types
SgtPooki 0630e45
chore: remove unnecessary casting
SgtPooki a65e3f6
feat: use latest @helia/verified-fetch
SgtPooki 36b2226
chore: set discoverRelays to 0
SgtPooki 4a7a253
chore: address PR comments and cleanup
SgtPooki a6b08bf
Merge branch 'main' into feat/helia-verified-fetch
SgtPooki 5509431
chore: fix build
SgtPooki 84455c1
chore: disable drand.love from e2e tests
SgtPooki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* For dnslinks see https://specs.ipfs.tech/http-gateways/subdomain-gateway/#host-request-header | ||
* DNSLink names include . which means they must be inlined into a single DNS label to provide unique origin and work with wildcard TLS certificates. | ||
*/ | ||
|
||
/** | ||
* We can receive either a peerId string or dnsLink label string here. PeerId strings do not have dots or dashes. | ||
*/ | ||
export function isDnsLabel (label: string): boolean { | ||
return ['-', '.'].some((char) => label.includes(char)) | ||
} | ||
|
||
/** | ||
* DNSLink label decoding | ||
* * Every standalone - is replaced with . | ||
* * Every remaining -- is replaced with - | ||
* | ||
* @example en-wikipedia--on--ipfs-org.ipns.example.net -> example.net/ipns/en.wikipedia-on-ipfs.org | ||
*/ | ||
export function dnsLinkLabelDecoder (linkLabel: string): string { | ||
return linkLabel.replace(/--/g, '-').replace(/-/g, '.') | ||
} | ||
|
||
/** | ||
* DNSLink label encoding: | ||
* * Every - is replaced with -- | ||
* * Every . is replaced with - | ||
* | ||
* @example example.net/ipns/en.wikipedia-on-ipfs.org → Host: en-wikipedia--on--ipfs-org.ipns.example.net | ||
*/ | ||
export function dnsLinkLabelEncoder (linkLabel: string): string { | ||
return linkLabel.replace(/\./g, '-').replace(/-/g, '--') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SgtPooki small nit: (unless we check before) we should check if
address
is a valid CID (with ipns name) first, and apply this normalization only if it is not a valid CID – see some prior art in https://github.com/ipfs/ipfs-companion/blob/7ca6433418909d43ec8801f27e417514614a164c/add-on/src/lib/ipfs-path.js#L71(better safe than sorry, there could be a multibase encoding which uses
.
and-
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since helia-verified-fetch handles this entirely now, we should be able to remove this code