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

feat!: upgrade to @ucanto/{interface,principal}@^4.0.0 #238

Merged
merged 22 commits into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5911726
upgrade ucanto in access-client
gobengo Dec 1, 2022
c73b355
start access-client cli test-ucanto-connection
gobengo Dec 1, 2022
98f17b3
upgrade all packages dep on @ucanto/interface and @ucanto/principal t…
gobengo Dec 2, 2022
6e792ac
access-client connection principal typefix
gobengo Dec 2, 2022
eedd403
access - upgrade @ucanto/princpal to 4.0.1
gobengo Dec 2, 2022
9394b30
rm unused ts-expect-error
gobengo Dec 2, 2022
750b6d7
capabilities,access: upgrade ucanto libraries to latest patch versions
gobengo Dec 2, 2022
56f69d2
fix IndexedDB store test to handle new SignerArchive type with keys n…
gobengo Dec 2, 2022
158f0da
upgrade ucanto packages in access-client,capabilities
gobengo Dec 2, 2022
7558a0d
upload-client upgrade ucanto libs
gobengo Dec 2, 2022
32b9a87
access-api upgrade ucanto versions
gobengo Dec 2, 2022
d1d3d3e
fix type issue in packages/access-api/test/helpers/utils.js
gobengo Dec 2, 2022
7030238
finish upgrade of @ucanto/{core,interface,principal,transport,validat…
gobengo Dec 2, 2022
00db6c2
rm unused dependencies from packages/capabilities/package.json
gobengo Dec 2, 2022
c28311f
update pnpm-lock.yaml
gobengo Dec 2, 2022
02017b7
rm unnecessary WIP changes to access-client cli (test-ucanto-connection)
gobengo Dec 2, 2022
4bca15c
Update packages/access-client/src/stores/types.ts
gobengo Dec 2, 2022
2bf043c
Update packages/access-client/test/stores/store-indexeddb.browser.tes…
gobengo Dec 2, 2022
f32a6e7
Update packages/access-client/src/stores/types.ts
gobengo Dec 2, 2022
ea4f24a
Update packages/access-client/src/stores/types.ts
gobengo Dec 2, 2022
f3e5ca5
fix comment in voucher capabilities
gobengo Dec 2, 2022
f4fcc4a
lint
gobengo Dec 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/access-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
"author": "Hugo Dias <hugomrdias@gmail.com> (hugodias.me)",
"license": "(Apache-2.0 OR MIT)",
"dependencies": {
"@ipld/dag-ucan": "^2.0.1",
"@ucanto/core": "^3.0.2",
"@ucanto/interface": "^3.0.1",
"@ucanto/principal": "^3.0.1",
"@ucanto/server": "^3.0.4",
"@ucanto/transport": "^3.0.2",
"@ipld/dag-ucan": "^3.0.1",
"@ucanto/core": "^4.0.2",
"@ucanto/interface": "^4.0.2",
"@ucanto/principal": "^4.0.2",
"@ucanto/server": "^4.0.2",
"@ucanto/transport": "^4.0.2",
"@web3-storage/access": "workspace:^",
"@web3-storage/capabilities": "workspace:^",
"@web3-storage/worker-utils": "0.4.3-dev",
Expand Down
2 changes: 1 addition & 1 deletion packages/access-api/test/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export async function send(ucan, mf) {

/**
* @param {Types.Signer} issuer
* @param {Types.Principal<"key">} service
* @param {Types.Principal<UCAN.DID>} service
* @param {Types.ConnectionView<import('@web3-storage/access/types').Service>} conn
* @param {string} email
*/
Expand Down
17 changes: 9 additions & 8 deletions packages/access-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"test:node": "mocha 'test/**/!(*.browser).test.js' -n experimental-vm-modules -n no-warnings",
"test:browser": "playwright-test 'test/**/!(*.node).test.js'",
"testw": "watch 'pnpm test' src test --interval 1",
"rc": "npm version prerelease --preid rc"
"rc": "npm version prerelease --preid rc",
"w3access": "./src/cli/index.js"
},
"exports": {
".": "./src/index.js",
Expand Down Expand Up @@ -56,12 +57,12 @@
"dependencies": {
"@ipld/car": "^5.0.1",
"@ipld/dag-ucan": "^2.0.1",
"@ucanto/client": "^3.0.2",
"@ucanto/core": "^3.0.2",
"@ucanto/interface": "^3.0.1",
"@ucanto/principal": "^3.0.1",
"@ucanto/transport": "^3.0.2",
"@ucanto/validator": "^3.0.4",
"@ucanto/client": "^4.0.2",
"@ucanto/core": "^4.0.2",
"@ucanto/interface": "^4.0.2",
"@ucanto/principal": "^4.0.2",
"@ucanto/transport": "^4.0.2",
"@ucanto/validator": "^4.0.2",
"@web3-storage/capabilities": "workspace:^",
"bigint-mod-arith": "^3.1.2",
"conf": "^10.2.0",
Expand All @@ -83,7 +84,7 @@
"@types/mocha": "^10.0.0",
"@types/node": "^18.11.10",
"@types/ws": "^8.5.3",
"@ucanto/server": "^3.0.4",
"@ucanto/server": "^4.0.2",
"assert": "^2.0.0",
"delay": "^5.0.0",
"hd-scripts": "^3.0.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/access-client/src/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const HOST = 'https://access.web3.storage'
* import { connection } from '@web3-storage/access/agent'
* ```
*
* @template {string} T - DID method
* @template {Ucanto.DID} T - DID method
* @param {Ucanto.Principal<T>} principal - w3access API Principal
* @param {typeof fetch} _fetch - fetch implementation to use
* @param {URL} url - w3access API URL
Expand Down Expand Up @@ -70,7 +70,7 @@ export function connection(principal, _fetch, url, channel) {
* @template {Ucanto.Signer} T - Ucanto Signer ie. ed25519, RSA or others
*/
export class Agent {
/** @type {Ucanto.Principal<"key">|undefined} */
/** @type {Ucanto.Principal<Ucanto.DID>|undefined} */
#service

/** @type {typeof fetch} */
Expand Down
1 change: 1 addition & 0 deletions packages/access-client/src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,5 @@ prog
console.error(`Run "${NAME} setup" first`)
}
})

prog.parse(process.argv)
1 change: 0 additions & 1 deletion packages/access-client/src/stores/store-indexeddb.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ export class StoreIndexedDB {
const raw = {
id: DATA_ID,
meta: data.meta,
// @ts-expect-error
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉

principal: data.principal.toArchive(),
currentSpace: data.currentSpace,
spaces: data.spaces,
Expand Down
6 changes: 3 additions & 3 deletions packages/access-client/src/stores/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
DelegationMeta,
SpaceMeta,
} from '../types.js'
import { RSASigner } from '@ucanto/principal/rsa'
import { SignerArchive, DID } from '@ucanto/interface'
import { SignerArchive, DID, DIDKey } from '@ucanto/interface'
import { RSA } from '@ucanto/principal'

/**
* Store interface that all stores need to implement
Expand Down Expand Up @@ -50,7 +50,7 @@ export interface IStore<T> {
export interface StoreDataIDB {
id: number
meta: AgentMeta
principal: SignerArchive<RSASigner>
principal: SignerArchive<DIDKey, typeof RSA.signatureCode>
currentSpace?: DID
spaces: Map<DID, SpaceMeta>
delegations: Map<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ describe('IndexedDB store', () => {
// principal private key is not extractable
const archive = data.principal.toArchive()
assert(!(archive instanceof Uint8Array))
assert(archive.key instanceof CryptoKey)
assert.equal(archive.key.extractable, false)
// eslint-disable-next-line no-unused-vars
const [[_, key], ...keys] = [...Object.entries(archive.keys)]
assert.deepEqual(keys, [])
assert(key instanceof CryptoKey)
assert.equal(key.extractable, false)

// no accounts or delegations yet
assert.equal(data.spaces.size, 0)
Expand Down
10 changes: 5 additions & 5 deletions packages/capabilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@
"dist/src/**/*.d.ts.map"
],
"dependencies": {
"@ucanto/core": "^3.0.2",
"@ucanto/interface": "^3.0.1",
"@ucanto/principal": "^3.0.1",
"@ucanto/transport": "^3.0.2",
"@ucanto/validator": "^3.0.4"
"@ucanto/core": "^4.0.2",
"@ucanto/interface": "^4.0.2",
"@ucanto/principal": "^4.0.2",
"@ucanto/transport": "^4.0.2",
"@ucanto/validator": "^4.0.2"
},
"devDependencies": {
"@types/assert": "^1.5.6",
Expand Down
4 changes: 2 additions & 2 deletions packages/capabilities/src/voucher.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ export const Product = URI.uri()
export const Identity = URI.match({ protocol: 'mailto:' })

/**
* Services are identified using did:key identifier.
* Services are identified using a decentralized identifier.
*/
export const Service = DID.match({ method: 'key' })
export const Service = DID.match({})
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export const Service = DID.match({})
export const Service = DID.match({ method: 'web' })

Should the above be ^^ instead ? Also comment need to be updated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I intended the type to allow any did. specifically I wanted to at least allow both did:key and did:web.
Does it matter much right now? we can narrow the type later if needed.... it seems like at this capabilities layer it shouldn't care which did method?


/**
* Capability can only be delegated (but not invoked) allowing audience to
Expand Down
10 changes: 5 additions & 5 deletions packages/upload-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
"@ipld/car": "^5.0.0",
"@ipld/dag-ucan": "^2.0.1",
"@ipld/unixfs": "^2.0.0",
"@ucanto/client": "^3.0.1",
"@ucanto/interface": "^3.0.0",
"@ucanto/transport": "^3.0.1",
"@ucanto/client": "^4.0.2",
"@ucanto/interface": "^4.0.2",
"@ucanto/transport": "^4.0.2",
"@web3-storage/capabilities": "workspace:^",
"multiformats": "^10.0.2",
"p-queue": "^7.3.0",
Expand All @@ -77,8 +77,8 @@
"devDependencies": {
"@types/assert": "^1.5.6",
"@types/mocha": "^10.0.0",
"@ucanto/principal": "^3.0.0",
"@ucanto/server": "^3.0.1",
"@ucanto/principal": "^4.0.2",
"@ucanto/server": "^4.0.2",
"assert": "^2.0.0",
"blockstore-core": "^2.0.2",
"c8": "^7.12.0",
Expand Down
Loading