Skip to content
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

fix: sync space names from proofs #1193

Merged
merged 4 commits into from
Nov 29, 2023
Merged

fix: sync space names from proofs #1193

merged 4 commits into from
Nov 29, 2023

Conversation

olizilla
Copy link
Contributor

space names are stored as facts in proofs in the special ucan:* delegation from email to agent e.g.

iss: did:mailto:protocol.ai:oli
att:
  - can: *
    with: ucan:*
fct:
  - {"access/confirm":{"/":"bafyreidadrwbxueiuhtbph2tj2m7a6nizpx7sbtqotbfkkjsoytn3dg2t4"},"access/request":{"/":"bafyreigmlliovbpxka2borbdaw6zpsai4qzmzv5nv7syl7nagecxjcub6e"}}
prf:
  - {"iss":"did:key:z6Mku56ywWspVnzkcVQbeSkw6egVRSNKVSYgS38HhKcUJRiN","aud":"did:mailto:protocol.ai:oli","v":"0.9.1","s":{"/":{"bytes":"7aEDQPgUVQFVOoLmijx8O7Li9zyc7iIHEDnCwiqr+LcV9CyHd/KzUg1Ige7Okh+ipVMOKy2EvG8dGjWfsdAAbUVPMwo"}},"exp":null,"att":[{"can":"*","with":"did:key:z6Mku56ywWspVnzkcVQbeSkw6egVRSNKVSYgS38HhKcUJRiN"}],"fct":[{"space":{"name":"fruits"}}],"prf":[],"/":"bafyreihhlz5yjci6h7vdrlgn5xnyc65e3unp3dx2yrspepwoftaxszxpxa"}

this will be fixed more robustly by the proposed re-imagining of the client as a stateless view over the stored ucans, but i'd like to land this fix asap, as it's currently you dont' get to see your existing space names when calling login in a new agent.

fixes: #1176

License: MIT

space names are stored as facts in proofs in the special `ucan:*` delegation from email to agent e.g.

```yaml
iss: did:mailto:protocol.ai:oli
att:
  - can: *
    with: ucan:*
fct:
  - {"access/confirm":{"/":"bafyreidadrwbxueiuhtbph2tj2m7a6nizpx7sbtqotbfkkjsoytn3dg2t4"},"access/request":{"/":"bafyreigmlliovbpxka2borbdaw6zpsai4qzmzv5nv7syl7nagecxjcub6e"}}
prf:
  - {"iss":"did:key:z6Mku56ywWspVnzkcVQbeSkw6egVRSNKVSYgS38HhKcUJRiN","aud":"did:mailto:protocol.ai:oli","v":"0.9.1","s":{"/":{"bytes":"7aEDQPgUVQFVOoLmijx8O7Li9zyc7iIHEDnCwiqr+LcV9CyHd/KzUg1Ige7Okh+ipVMOKy2EvG8dGjWfsdAAbUVPMwo"}},"exp":null,"att":[{"can":"*","with":"did:key:z6Mku56ywWspVnzkcVQbeSkw6egVRSNKVSYgS38HhKcUJRiN"}],"fct":[{"space":{"name":"fruits"}}],"prf":[],"/":"bafyreihhlz5yjci6h7vdrlgn5xnyc65e3unp3dx2yrspepwoftaxszxpxa"}
```

this will be fixed more robustly by the proposed re-imagining of the client as a stateless view over the stored ucans, but i'd like to land this fix asap, as it's currently you dont' get to see your existing space names when calling login in a new agent.

fixes: #1176

License: MIT
Signed-off-by: Oli Evans <oli@protocol.ai>
@olizilla olizilla requested a review from Gozala November 28, 2023 20:09
@olizilla
Copy link
Contributor Author

olizilla commented Nov 28, 2023

many of my spaces have no name, but here we see the ones that do have names are synced correctly.

set -x W3_STORE_NAME test13

❯ w3 proof ls
# 0 proofs for did:key:z6MkoKBnbwsiPHzqkX8DnYnaZjqqh3EwALccpsBxS2zBzgky

❯ w3 login oli@protocol.ai
⠏ 🔗 please click the link sent to oli@protocol.ai to authorize this agent
⁂ Agent was authorized by did:mailto:protocol.ai:oli

❯ w3 space ls
  did:key:z6Mku56ywWspVnzkcVQbeSkw6egVRSNKVSYgS38HhKcUJRiN fruits
  did:key:z6Mktg5HxV1fifagzK8tnXXgCDsw1o4ekQHQpp9DKbLkh9hU veg
  did:key:z6MkmZvd21CiTgTSNQTqf3aqFyitcJktmNFXsi3foVn6kNNY 
  did:key:z6Mkv8gU6CYtiKGjLwTjyfzTQGfrog9VaxQYSqWNWD7x8svz 
  did:key:z6MkuTBeASiY4EzDxyPFPcYAfypXXVa7Dc27AfJNeXbJACMH 
  did:key:z6MkhfzTwZJ28aRobCp76uXRqzsjH6GNu18WFwMumkAF5ojW toots
  did:key:z6Mkour56pdfCbg7ZP96H2RkWVH8h9VbtYPB3KfKMGnGu9SZ 
  did:key:z6MknD58DihJ7j3XdPZLuJPVPt8LC8BtdTULatbWmoqr8Awp clean
  did:key:z6MkqUsPAfYfpZnf4bKr9wtQeMv79fQz9fXFSKY6jYZq4HTP 
  did:key:z6MktTBCTHH9MNCAXVWAY7d1CKm6UzCCdWCdk1oNLKbzbxPA 
  did:key:z6MknAAipsL2Bt67Ls5JanjWKkS9AZyaKFkbMmpVbmrtUNbA 
  did:key:z6MkqCQWWMykghbNHEyN97CAvKDgEDTt4q5vGvWN89q47vd5 
  did:key:z6Mkr9KKd6kwNdozZxwRctxkZoqNwm6ZfArq3SaCNCaPTNC4 

@olizilla
Copy link
Contributor Author

i'd note that the fix here is not particularly generic or ideal, but i think it's a reasonable patch until we land a better client.

Copy link
Member

@alanshaw alanshaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

}
}
}
}

for (const [did, meta] of spaces) {
data.addSpace(did, meta)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
data.addSpace(did, meta)
await data.addSpace(did, meta)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not broken in this PR but please fix it 🙏

License: MIT
Signed-off-by: Oli Evans <oli@protocol.ai>
License: MIT
Signed-off-by: Oli Evans <oli@protocol.ai>
@olizilla olizilla merged commit f552036 into main Nov 29, 2023
3 checks passed
@olizilla olizilla deleted the sync-space-names branch November 29, 2023 11:21
alanshaw pushed a commit that referenced this pull request Nov 29, 2023
🤖 I have created a release *beep* *boop*
---


##
[18.0.5](access-v18.0.4...access-v18.0.5)
(2023-11-29)


### Fixes

* fix IndexedDB reset function
([#1199](#1199))
([48cf555](48cf555))
* sync space names from proofs
([#1193](#1193))
([f552036](f552036))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
fforbeck pushed a commit to storacha/upload-service that referenced this pull request Dec 19, 2024
🤖 I have created a release *beep* *boop*
---


## 1.0.0 (2024-12-02)


### ⚠ BREAKING CHANGES

* **upload-api:** integrate agent store for idempotence &
invocation/receipt persistence
([storacha#1444](https://github.com/storacha/upload-service/issues/1444))
* delegated capabilities required to use `uploadFile`, `uploadDirectory`
and `uploadCAR` have changed. In order to use these methods your agent
will now need to be delegated `blob/add`, `index/add`, `filecoin/offer`
and `upload/add` capabilities. Note: no code changes are required.
* coupon
([storacha#1136](https://github.com/storacha/upload-service/issues/1136))
* tweak readmes to get release-please to bump major version
([storacha#1102](https://github.com/storacha/upload-service/issues/1102))

### Features

* add "plan/create-admin-session" capability
([storacha#1411](https://github.com/storacha/upload-service/issues/1411))
([50eeeb5](50eeeb5))
* add `subscription/list` capability
([storacha#1088](https://github.com/storacha/upload-service/issues/1088))
([471d7e5](471d7e5))
* add blob protocol to upload-client
([storacha#1425](https://github.com/storacha/upload-service/issues/1425))
([49aef56](49aef56))
* add CLI ([#39](#39))
([112720e](112720e))
* add usage/report capability
([storacha#1079](https://github.com/storacha/upload-service/issues/1079))
([6418b4b](6418b4b))
* coupon
([storacha#1136](https://github.com/storacha/upload-service/issues/1136))
([1b94f2d](1b94f2d))
* expose OwnedSpace and SharedSpace from access-client
([storacha#1244](https://github.com/storacha/upload-service/issues/1244))
([8ec1b44](8ec1b44))
* generate sharded DAG index on client and invoke w `index/add`
([storacha#1451](https://github.com/storacha/upload-service/issues/1451))
([a6d9026](a6d9026))
* Generate Space proofs on the fly, on `access/claim`
([storacha#1555](https://github.com/storacha/upload-service/issues/1555))
([9e2b1d4](9e2b1d4))
* router ([#11](#11))
([c810735](c810735))
* tweak readmes to get release-please to bump major version
([storacha#1102](https://github.com/storacha/upload-service/issues/1102))
([a411255](a411255))
* two more interface tweaks
([storacha#1287](https://github.com/storacha/upload-service/issues/1287))
([bc3c364](bc3c364))
* upgrade ucanto/transport to 9.1.0 in all packages to get more verbose
errors from HTTP transport on non-ok response
([storacha#1312](https://github.com/storacha/upload-service/issues/1312))
([d6978d7](d6978d7))
* **upload-api:** integrate agent store for idempotence &
invocation/receipt persistence
([storacha#1444](https://github.com/storacha/upload-service/issues/1444))
([c9bf33e](c9bf33e))
* w3up client login
([storacha#1120](https://github.com/storacha/upload-service/issues/1120))
([8279bf6](8279bf6))


### Fixes

* access client should request blob namespace capabilities
([storacha#1378](https://github.com/storacha/upload-service/issues/1378))
([fc5bb4a](fc5bb4a))
* access-client package.json uses https instead of git for one-webcrypto
dep to help with yarn compat
([storacha#1157](https://github.com/storacha/upload-service/issues/1157))
([e1d0798](e1d0798))
* don't error when we can't figure out a name for a space
([storacha#1177](https://github.com/storacha/upload-service/issues/1177))
([a31f667](a31f667))
* fix export paths for JS files
([storacha#1089](https://github.com/storacha/upload-service/issues/1089))
([1a5d1aa](1a5d1aa))
* fix IndexedDB reset function
([storacha#1199](https://github.com/storacha/upload-service/issues/1199))
([48cf555](48cf555))
* floating promises and add no-floating-promises to eslint-config-w3up
([storacha#1198](https://github.com/storacha/upload-service/issues/1198))
([1b8c5aa](1b8c5aa))
* issue where typedoc docs would only show full docs for w3up-client
([storacha#1141](https://github.com/storacha/upload-service/issues/1141))
([0b8d3f3](0b8d3f3))
* migrate repo
([storacha#1389](https://github.com/storacha/upload-service/issues/1389))
([475a287](475a287))
* package metadata
([storacha#1161](https://github.com/storacha/upload-service/issues/1161))
([b8a1cc2](b8a1cc2))
* point `main` at files included in the package
([storacha#1241](https://github.com/storacha/upload-service/issues/1241))
([c0b306d](c0b306d))
* repo URLs
([storacha#1550](https://github.com/storacha/upload-service/issues/1550))
([e02ddf3](e02ddf3))
* support storing ArrayBuffers in conf
([storacha#1236](https://github.com/storacha/upload-service/issues/1236))
([9b1aafb](9b1aafb))
* sync space names from proofs
([storacha#1193](https://github.com/storacha/upload-service/issues/1193))
([f552036](f552036))
* upgrade @ucanto/validator with bugfix
([storacha#1151](https://github.com/storacha/upload-service/issues/1151))
([d4e961b](d4e961b))
* upgrade type-fest in access
([storacha#1263](https://github.com/storacha/upload-service/issues/1263))
([47a4589](47a4589))
* upgrade ucanto core
([storacha#1127](https://github.com/storacha/upload-service/issues/1127))
([5ce4d22](5ce4d22))
* upgrade ucanto libs and format filecoin api
([storacha#1359](https://github.com/storacha/upload-service/issues/1359))
([87ca098](87ca098))
* upload API test fixes
([6b0d72d](6b0d72d))
* use an ArrayBuffer for delegation bits in AgentData
([storacha#1219](https://github.com/storacha/upload-service/issues/1219))
([bddf874](bddf874))
* use one-webcrypto from npm
([storacha#1525](https://github.com/storacha/upload-service/issues/1525))
([9345c54](9345c54))


### Other Changes

* Add `pnpm dev` to watch-build all packages
([storacha#1533](https://github.com/storacha/upload-service/issues/1533))
([07970ef](07970ef))
* **main:** release access 16.5.0
([storacha#1086](https://github.com/storacha/upload-service/issues/1086))
([cf81c3a](cf81c3a))
* **main:** release access 16.5.1
([storacha#1090](https://github.com/storacha/upload-service/issues/1090))
([cb46ee9](cb46ee9))
* **main:** release access 17.0.0
([storacha#1103](https://github.com/storacha/upload-service/issues/1103))
([5b34dfb](5b34dfb))
* **main:** release access 17.1.0
([storacha#1122](https://github.com/storacha/upload-service/issues/1122))
([3f302a3](3f302a3))
* **main:** release access 18.0.0
([storacha#1132](https://github.com/storacha/upload-service/issues/1132))
([aa4ba63](aa4ba63))
* **main:** release access 18.0.1
([storacha#1142](https://github.com/storacha/upload-service/issues/1142))
([3d7f118](3d7f118))
* **main:** release access 18.0.2
([storacha#1158](https://github.com/storacha/upload-service/issues/1158))
([1dd371b](1dd371b))
* **main:** release access 18.0.3
([storacha#1166](https://github.com/storacha/upload-service/issues/1166))
([dfbc3f1](dfbc3f1))
* **main:** release access 18.0.4
([storacha#1200](https://github.com/storacha/upload-service/issues/1200))
([f51b066](f51b066))
* **main:** release access 18.0.5
([storacha#1203](https://github.com/storacha/upload-service/issues/1203))
([89080ca](89080ca))
* **main:** release access 18.0.6
([storacha#1233](https://github.com/storacha/upload-service/issues/1233))
([ddb413f](ddb413f))
* **main:** release access 18.0.7
([storacha#1237](https://github.com/storacha/upload-service/issues/1237))
([bb5235f](bb5235f))
* **main:** release access 18.1.0
([storacha#1243](https://github.com/storacha/upload-service/issues/1243))
([4991f70](4991f70))
* **main:** release access 18.1.1
([storacha#1265](https://github.com/storacha/upload-service/issues/1265))
([3244a26](3244a26))
* **main:** release access 18.2.0
([storacha#1288](https://github.com/storacha/upload-service/issues/1288))
([787fca6](787fca6))
* **main:** release access 18.3.0
([storacha#1319](https://github.com/storacha/upload-service/issues/1319))
([5701761](5701761))
* **main:** release access 18.3.1
([storacha#1381](https://github.com/storacha/upload-service/issues/1381))
([086759d](086759d))
* **main:** release access 18.3.2
([storacha#1396](https://github.com/storacha/upload-service/issues/1396))
([bcc958f](bcc958f))
* **main:** release access 18.4.0
([storacha#1446](https://github.com/storacha/upload-service/issues/1446))
([af9f44e](af9f44e))
* **main:** release access 19.0.0
([storacha#1462](https://github.com/storacha/upload-service/issues/1462))
([b16a0bf](b16a0bf))
* **main:** release access 20.0.0
([storacha#1473](https://github.com/storacha/upload-service/issues/1473))
([be8247f](be8247f))
* **main:** release access 20.0.1
([storacha#1529](https://github.com/storacha/upload-service/issues/1529))
([a82c4fb](a82c4fb))
* **main:** release access 20.1.0
([storacha#1541](https://github.com/storacha/upload-service/issues/1541))
([89836c0](89836c0))
* package renames
([0f797ed](0f797ed))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Space names lost when syncing delegations to new store
2 participants