-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: content serve authorization (#1590)
### Context To enable a gateway to serve content from a specific space, we must ensure that the space owner delegates the `space/content/serve/*` capability to the Gateway. This delegation allows the Gateway to serve content and log egress events appropriately. I created a new function `authorizeContentServe` for this implementation and included it in the `createSpace` flow. This is a breaking change because now the user is forced to provide the DIDs of the Content Serve services, and the connection, or skip the authorization flow. Additionally, with the `authorizeContentServe` function, we can implement a feature in the Console App that enables users to explicitly authorize the Freeway Gateway to serve content from existing/legacy spaces. ### Main Changes - **New Functionality:** Added a new function, `authorizeContentServe`, in the `w3up-client` module to facilitate the delegation process. Integrated it with the `createdSpace` flow. - **Testing:** Introduced test cases to verify the authorization of specified gateways. - **Fixes:** Resolved issues with previously broken test cases (Egress Record). ### Related Issues - storacha/project-tracking#158 - storacha/project-tracking#160
- Loading branch information
Showing
22 changed files
with
541 additions
and
73 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
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
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
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
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
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
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
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
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 |
---|---|---|
|
@@ -111,7 +111,9 @@ export const testAccount = Test.withContext({ | |
assert, | ||
{ client, mail, grantAccess } | ||
) => { | ||
const space = await client.createSpace('test') | ||
const space = await client.createSpace('test', { | ||
skipGatewayAuthorization: true, | ||
}) | ||
const mnemonic = space.toMnemonic() | ||
const { signer } = await Space.fromMnemonic(mnemonic, { name: 'import' }) | ||
assert.deepEqual( | ||
|
@@ -147,7 +149,9 @@ export const testAccount = Test.withContext({ | |
|
||
'multi device workflow': async (asserts, { connect, mail, grantAccess }) => { | ||
const laptop = await connect() | ||
const space = await laptop.createSpace('main') | ||
const space = await laptop.createSpace('main', { | ||
skipGatewayAuthorization: true, | ||
}) | ||
|
||
// want to provision space ? | ||
const email = '[email protected]' | ||
|
@@ -183,7 +187,9 @@ export const testAccount = Test.withContext({ | |
asserts.deepEqual(result.did, space.did()) | ||
}, | ||
'setup recovery': async (assert, { client, mail, grantAccess }) => { | ||
const space = await client.createSpace('test') | ||
const space = await client.createSpace('test', { | ||
skipGatewayAuthorization: true, | ||
}) | ||
|
||
const email = '[email protected]' | ||
const login = Account.login(client, email) | ||
|
@@ -280,7 +286,9 @@ export const testAccount = Test.withContext({ | |
assert, | ||
{ client, mail, grantAccess } | ||
) => { | ||
const space = await client.createSpace('test') | ||
const space = await client.createSpace('test', { | ||
skipGatewayAuthorization: true, | ||
}) | ||
|
||
const email = '[email protected]' | ||
const login = Account.login(client, email) | ||
|
@@ -299,8 +307,10 @@ export const testAccount = Test.withContext({ | |
assert.equal(typeof subs.results[0].subscription, 'string') | ||
}, | ||
|
||
'space.save': async (assert, { client, mail, grantAccess }) => { | ||
const space = await client.createSpace('test') | ||
'space.save': async (assert, { client }) => { | ||
const space = await client.createSpace('test', { | ||
skipGatewayAuthorization: true, | ||
}) | ||
assert.deepEqual(client.spaces(), []) | ||
|
||
const result = await space.save() | ||
|
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.