-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make Storacha service information configurable (#13)
This lets us use staging Storacha for the staging environment, and allows us to send folks through the Storacha auth rather than web3.storage auth. --------- Co-authored-by: Crostons <shubh1608003@gmail.com>
- Loading branch information
Showing
5 changed files
with
42 additions
and
4 deletions.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -28,5 +28,5 @@ export default function StorachaAuthenticator () { | |
<Identity /> | ||
</AuthenticationEnsurer> | ||
</Authenticator> | ||
) | ||
) | ||
} |
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 |
---|---|---|
@@ -1,9 +1,14 @@ | ||
import type { ReactNode } from 'react' | ||
import { Provider } from '@w3ui/react' | ||
import { serviceConnection, servicePrincipal } from './services' | ||
|
||
export default function W3UIProvider({ children }: { children: React.ReactNode }) { | ||
export default function W3UIProvider ({ children }: { children: ReactNode }) { | ||
return ( | ||
<Provider> | ||
{children} | ||
<Provider | ||
connection={serviceConnection} | ||
servicePrincipal={servicePrincipal} | ||
> | ||
<>{children}</> | ||
</Provider> | ||
) | ||
} |
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,21 @@ | ||
import type { Service } from '@w3ui/react' | ||
import { connect } from '@ucanto/client' | ||
import { CAR, HTTP } from '@ucanto/transport' | ||
import * as DID from '@ipld/dag-ucan/did' | ||
|
||
export const serviceURL = new URL( | ||
process.env.NEXT_PUBLIC_STORACHA_SERVICE_URL ?? 'https://up.storacha.network' | ||
) | ||
|
||
export const servicePrincipal = DID.parse( | ||
process.env.NEXT_PUBLIC_STORACHA_SERVICE_DID ?? 'did:web:web3.storage' | ||
) | ||
|
||
export const serviceConnection = connect<Service>({ | ||
id: servicePrincipal, | ||
codec: CAR.outbound, | ||
channel: HTTP.open({ | ||
url: serviceURL, | ||
method: 'POST', | ||
}), | ||
}) |