Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into import-w3ui
Browse files Browse the repository at this point in the history
* origin/main:
  chore(main): release upload-api 1.3.4 (#156)
  chore(main): release filecoin-api 1.1.2 (#155)
  chore(main): release client 1.1.5 (#154)
  chore(main): release upload-client 1.0.5 (#153)
  chore(main): release cli 1.1.2 (#152)
  chore(main): release access 1.0.3 (#151)
  chore(main): release capabilities 1.2.2 (#145)
  fix: store w3s accept invocation (#142)
  fix: dedupe proofs (#143)
  fix: use up.storacha.network (#144)
  fix: use correct object in cause (#140)
  Update CHANGELOG.md
  chore(main): release upload-api 1.3.3
  chore(upload-api): add comment for clarity
  refactor(blob-registry): pass cause as a parameter to deregister
  • Loading branch information
Peeja committed Feb 12, 2025
2 parents 1799124 + 084fb44 commit 2513989
Show file tree
Hide file tree
Showing 38 changed files with 221 additions and 101 deletions.
14 changes: 7 additions & 7 deletions .github/release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"packages/access-client": "1.0.2",
"packages/access-client": "1.0.3",
"packages/blob-index": "1.0.1",
"packages/cli": "1.1.1",
"packages/filecoin-api": "1.1.1",
"packages/cli": "1.1.2",
"packages/filecoin-api": "1.1.2",
"packages/filecoin-client": "1.0.2",
"packages/capabilities": "1.2.1",
"packages/upload-api": "1.3.2",
"packages/upload-client": "1.0.4",
"packages/w3up-client": "1.1.4",
"packages/capabilities": "1.2.2",
"packages/upload-api": "1.3.4",
"packages/upload-client": "1.0.5",
"packages/w3up-client": "1.1.5",
"packages/did-mailto": "1.0.1"
}
8 changes: 8 additions & 0 deletions packages/access-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [1.0.3](https://github.com/storacha/upload-service/compare/access-v1.0.2...access-v1.0.3) (2025-02-11)


### Fixes

* dedupe proofs ([#143](https://github.com/storacha/upload-service/issues/143)) ([de2ac67](https://github.com/storacha/upload-service/commit/de2ac67c1af1f968cdb359f96e4be5fbd8254b7d))
* use up.storacha.network ([#144](https://github.com/storacha/upload-service/issues/144)) ([ac6b5b4](https://github.com/storacha/upload-service/commit/ac6b5b4b9881f9889e99e18b38fbfb302b4fb3b5))

## [1.0.2](https://github.com/storacha/upload-service/compare/access-v1.0.1...access-v1.0.2) (2025-01-22)


Expand Down
2 changes: 1 addition & 1 deletion packages/access-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storacha/access",
"version": "1.0.2",
"version": "1.0.3",
"description": "access client",
"homepage": "https://storacha.network",
"repository": {
Expand Down
13 changes: 7 additions & 6 deletions packages/access-client/src/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,25 +265,26 @@ export class Agent {
* @param {API.DID} [options.sessionProofIssuer] - only include session proofs for this issuer
*/
proofs(caps, options) {
const authorizations = []
/** @type {Map<string, API.Delegation<API.Capabilities>>} */
const authorizations = new Map()
for (const { delegation } of this.#delegations(caps)) {
if (delegation.audience.did() === this.issuer.did()) {
authorizations.push(delegation)
authorizations.set(delegation.cid.toString(), delegation)
}
}

// now let's add any session proofs that refer to those authorizations
const sessions = getSessionProofs(this.#data)
for (const proof of authorizations) {
for (const proof of [...authorizations.values()]) {
const proofsByIssuer = sessions[proof.asCID.toString()] ?? {}
const sessionProofs = options?.sessionProofIssuer
? proofsByIssuer[options.sessionProofIssuer] ?? []
: Object.values(proofsByIssuer).flat()
if (sessionProofs.length) {
authorizations.push(...sessionProofs)
for (const sessionProof of sessionProofs) {
authorizations.set(sessionProof.cid.toString(), sessionProof)
}
}
return authorizations
return [...authorizations.values()]
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/access-client/test/agent-use-cases.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ describe('authorizeWaitAndClaim', async function () {
describe('getAccountPlan', async function () {
const accountWithAPlan = 'did:mailto:example.com:i-have-a-plan'
const accountWithoutAPlan = 'did:mailto:example.com:i-have-no-plan'
const product = 'did:web:test.upload.storacha.network'
const product = 'did:web:test.up.storacha.network'
/** @type {Record<Ucanto.DID, {product: Ucanto.DID, updatedAt: string}>} */
const plans = {
[accountWithAPlan]: {
Expand Down
19 changes: 19 additions & 0 deletions packages/access-client/test/agent.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,25 @@ describe('Agent', function () {
'invocation for serviceBWeb does not have sessionProof from serviceAWeb'
)
})

it('should dedupe proofs', async function () {
const agent = await Agent.create()
const space = await agent.createSpace('test-add')
const authorization = await space.createAuthorization(agent, {
access: { '*': {} },
expiration: Infinity,
})

await agent.importSpaceFromDelegation(authorization)
const proofs = agent.proofs([
{ can: 'space/blob/add', with: space.did() },
{ can: 'space/index/add', with: space.did() },
])

// the same proof proves both capabilities
assert.equal(proofs.length, 1)
assert.equal(proofs[0].cid.toString(), authorization.cid.toString())
})
})

/**
Expand Down
7 changes: 7 additions & 0 deletions packages/capabilities/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [1.2.2](https://github.com/storacha/upload-service/compare/capabilities-v1.2.1...capabilities-v1.2.2) (2025-02-11)


### Fixes

* use up.storacha.network ([#144](https://github.com/storacha/upload-service/issues/144)) ([ac6b5b4](https://github.com/storacha/upload-service/commit/ac6b5b4b9881f9889e99e18b38fbfb302b4fb3b5))

## [1.2.1](https://github.com/storacha/upload-service/compare/capabilities-v1.2.0...capabilities-v1.2.1) (2025-01-22)


Expand Down
2 changes: 1 addition & 1 deletion packages/capabilities/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storacha/capabilities",
"version": "1.2.1",
"version": "1.2.2",
"description": "UCAN Capabilities provided by storacha.network",
"homepage": "https://storacha.network",
"repository": {
Expand Down
34 changes: 17 additions & 17 deletions packages/capabilities/test/capabilities/provider.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: space.did(),
},
proofs: await createAuthorization({ agent, service, account }),
Expand All @@ -36,7 +36,7 @@ describe('provider/add', function () {
assert.deepEqual(result.ok.audience.did(), service.did())
assert.equal(result.ok.capability.can, 'provider/add')
assert.deepEqual(result.ok.capability.nb, {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: space.did(),
})
}
Expand All @@ -51,7 +51,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: space.did(),
},
})
Expand Down Expand Up @@ -80,7 +80,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: space.did(),
},
proofs: [delegation],
Expand Down Expand Up @@ -110,7 +110,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: space.did(),
},
proofs: [attestation],
Expand All @@ -135,7 +135,7 @@ describe('provider/add', function () {
with: bobAccount.did(),
// @ts-ignore
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
},
})
}, /Error: Invalid 'nb' - Object contains invalid field "consumer"/)
Expand All @@ -149,7 +149,7 @@ describe('provider/add', function () {
audience: service,
with: bobAccount.did(),
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
// @ts-expect-error
consumer: 'did:mailto:storacha.network:user',
},
Expand All @@ -166,7 +166,7 @@ describe('provider/add', function () {
with: bobAccount.did(),
// @ts-expect-error - missing provider
nb: {
// provider: 'did:web:test.upload.storacha.network',
// provider: 'did:web:test.up.storacha.network',
consumer: bob.did(),
},
})
Expand Down Expand Up @@ -197,7 +197,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: space.did(),
},
proofs: [
Expand All @@ -206,7 +206,7 @@ describe('provider/add', function () {
audience: bob,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: space.did(),
},
proofs: await createAuthorization({ agent, service, account }),
Expand All @@ -233,7 +233,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: space.did(),
},
proofs: [
Expand All @@ -242,7 +242,7 @@ describe('provider/add', function () {
audience: bob,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
},
proofs: await createAuthorization({ agent, service, account }),
}),
Expand All @@ -268,7 +268,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: space.did(),
},
proofs: [
Expand Down Expand Up @@ -303,7 +303,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: bob.did(),
},
proofs: [
Expand Down Expand Up @@ -338,7 +338,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: bob.did(),
},
proofs: [
Expand Down Expand Up @@ -379,7 +379,7 @@ describe('provider/add', function () {
audience: service,
with: 'did:mailto:mallory.com:bob',
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: bob.did(),
},
proofs: [
Expand Down Expand Up @@ -428,7 +428,7 @@ describe('provider/add', function () {
with: account.did(),
nb: {
consumer: space.did(),
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
},
// NOTE: no proofs!
})
Expand Down
2 changes: 1 addition & 1 deletion packages/capabilities/test/helpers/fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const malloryAccount = Absentee.from({

export const service = Signer.parse(
'MgCYKXoHVy7Vk4/QjcEGi+MCqjntUiasxXJ8uJKY0qh11e+0Bs8WsdqGK7xothgrDzzWD0ME7ynPjz2okXDh8537lId8='
).withDID('did:web:test.upload.storacha.network')
).withDID('did:web:test.up.storacha.network')

export const readmeCID = parseLink(
'bafybeihqfdg2ereoijjoyrqzr2x2wsasqm2udurforw7pa3tvbnxhojao4'
Expand Down
7 changes: 7 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [1.1.2](https://github.com/storacha/upload-service/compare/cli-v1.1.1...cli-v1.1.2) (2025-02-11)


### Fixes

* use up.storacha.network ([#144](https://github.com/storacha/upload-service/issues/144)) ([ac6b5b4](https://github.com/storacha/upload-service/commit/ac6b5b4b9881f9889e99e18b38fbfb302b4fb3b5))

## [1.1.1](https://github.com/storacha/upload-service/compare/cli-v1.1.0...cli-v1.1.1) (2025-01-22)


Expand Down
10 changes: 5 additions & 5 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,23 +271,23 @@ Default `storacha-cli`

### `STORACHA_SERVICE_URL`

`storacha` CLI will use the w3up service at https://upload.storacha.network. If you would like
`storacha` CLI will use the w3up service at https://up.storacha.network. If you would like
to use a different w3up-compatible service, set `STORACHA_SERVICE_DID` and `STORACHA_SERVICE_URL` environment variables to set the service DID and URL endpoint.

Default `https://upload.storacha.network`
Default `https://up.storacha.network`

### `STORACHA_SERVICE_DID`

`storacha` CLI will use the w3up `did:web:upload.storacha.network` as the service DID. If you would like
`storacha` CLI will use the w3up `did:web:up.storacha.network` as the service DID. If you would like
to use a different w3up-compatible service, set `STORACHA_SERVICE_DID` and `STORACHA_SERVICE_URL` environment variables to set the service DID and URL endpoint.

Default `did:web:upload.storacha.network`
Default `did:web:up.storacha.network`

### `STORACHA_RECEIPTS_URL`

The URL at which UCAN receipts issued by the service may be fetched.

Default `https://upload.storacha.network/receipt/`
Default `https://up.storacha.network/receipt/`

## FAQ

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@storacha/cli",
"type": "module",
"version": "1.1.1",
"version": "1.1.2",
"license": "Apache-2.0 OR MIT",
"description": "Command Line Interface to the Storacha Network",
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/bin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ export const testSpace = {
})

/** @type {import('@storacha/client/types').DID<'web'>} */
const providerDID = 'did:web:test.upload.storacha.network'
const providerDID = 'did:web:test.up.storacha.network'

const infoWithoutProvider = await storacha
.args(['space', 'info'])
Expand Down
7 changes: 7 additions & 0 deletions packages/filecoin-api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [1.1.2](https://github.com/storacha/upload-service/compare/filecoin-api-v1.1.1...filecoin-api-v1.1.2) (2025-02-11)


### Fixes

* use up.storacha.network ([#144](https://github.com/storacha/upload-service/issues/144)) ([ac6b5b4](https://github.com/storacha/upload-service/commit/ac6b5b4b9881f9889e99e18b38fbfb302b4fb3b5))

## [1.1.1](https://github.com/storacha/upload-service/compare/filecoin-api-v1.1.0...filecoin-api-v1.1.1) (2025-01-22)


Expand Down
2 changes: 1 addition & 1 deletion packages/filecoin-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storacha/filecoin-api",
"version": "1.1.1",
"version": "1.1.2",
"type": "module",
"main": "./src/lib.js",
"homepage": "https://storacha.network",
Expand Down
16 changes: 16 additions & 0 deletions packages/upload-api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## [1.3.4](https://github.com/storacha/upload-service/compare/upload-api-v1.3.3...upload-api-v1.3.4) (2025-02-11)


### Fixes

* store w3s accept invocation ([#142](https://github.com/storacha/upload-service/issues/142)) ([e0c509d](https://github.com/storacha/upload-service/commit/e0c509dec75386e3275abaca1e94c4de0ccefacd))
* use up.storacha.network ([#144](https://github.com/storacha/upload-service/issues/144)) ([ac6b5b4](https://github.com/storacha/upload-service/commit/ac6b5b4b9881f9889e99e18b38fbfb302b4fb3b5))

## [1.3.3](https://github.com/storacha/upload-service/compare/upload-api-v1.3.2...upload-api-v1.3.3) (2025-01-29)


### Other Changes

* **upload-api:** add comment for clarity ([c678bde](https://github.com/storacha/upload-service/commit/c678bde352ba44e9f320f731411705b2233e83ee))
* **upload-api:** refactor(blob-registry): pass cause as a parameter to deregister ([632348d](https://github.com/storacha/upload-service/commit/632348d1529808f67873f332c695a504ca5bd7c4))

## [1.3.2](https://github.com/storacha/upload-service/compare/upload-api-v1.3.1...upload-api-v1.3.2) (2025-01-22)


Expand Down
Loading

0 comments on commit 2513989

Please sign in to comment.