Skip to content

Commit

Permalink
feat: Revert "feat!: upgrade to @ucanto/{interface,principal}@^4.0.…
Browse files Browse the repository at this point in the history
…0" (#245)

Reverts #238

(requested by @hugomrdias )
  • Loading branch information
gobengo committed Dec 3, 2022
1 parent 309aff0 commit 197439e
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 121 deletions.
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": "^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",
"@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",
"@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<UCAN.DID>} service
* @param {Types.Principal<"key">} service
* @param {Types.ConnectionView<import('@web3-storage/access/types').Service>} conn
* @param {string} email
*/
Expand Down
17 changes: 8 additions & 9 deletions packages/access-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
"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",
"w3access": "./src/cli/index.js"
"rc": "npm version prerelease --preid rc"
},
"exports": {
".": "./src/index.js",
Expand Down Expand Up @@ -57,12 +56,12 @@
"dependencies": {
"@ipld/car": "^5.0.1",
"@ipld/dag-ucan": "^2.0.1",
"@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",
"@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",
"@web3-storage/capabilities": "workspace:^",
"bigint-mod-arith": "^3.1.2",
"conf": "^10.2.0",
Expand All @@ -84,7 +83,7 @@
"@types/mocha": "^10.0.0",
"@types/node": "^18.11.10",
"@types/ws": "^8.5.3",
"@ucanto/server": "^4.0.2",
"@ucanto/server": "^3.0.4",
"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 {Ucanto.DID} T - DID method
* @template {string} 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<Ucanto.DID>|undefined} */
/** @type {Ucanto.Principal<"key">|undefined} */
#service

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

prog.parse(process.argv)
1 change: 1 addition & 0 deletions packages/access-client/src/stores/store-indexeddb.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export class StoreIndexedDB {
const raw = {
id: DATA_ID,
meta: data.meta,
// @ts-expect-error
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 { SignerArchive, DID, DIDKey } from '@ucanto/interface'
import { RSA } from '@ucanto/principal'
import { RSASigner } from '@ucanto/principal/rsa'
import { SignerArchive, DID } from '@ucanto/interface'

/**
* 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<DIDKey, typeof RSA.signatureCode>
principal: SignerArchive<RSASigner>
currentSpace?: DID
spaces: Map<DID, SpaceMeta>
delegations: Map<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ describe('IndexedDB store', () => {
// principal private key is not extractable
const archive = data.principal.toArchive()
assert(!(archive instanceof Uint8Array))
// 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)
assert(archive.key instanceof CryptoKey)
assert.equal(archive.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": "^4.0.2",
"@ucanto/interface": "^4.0.2",
"@ucanto/principal": "^4.0.2",
"@ucanto/transport": "^4.0.2",
"@ucanto/validator": "^4.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"
},
"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 a decentralized identifier.
* Services are identified using did:key identifier.
*/
export const Service = DID.match({})
export const Service = DID.match({ method: 'key' })

/**
* 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": "^4.0.2",
"@ucanto/interface": "^4.0.2",
"@ucanto/transport": "^4.0.2",
"@ucanto/client": "^3.0.1",
"@ucanto/interface": "^3.0.0",
"@ucanto/transport": "^3.0.1",
"@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": "^4.0.2",
"@ucanto/server": "^4.0.2",
"@ucanto/principal": "^3.0.0",
"@ucanto/server": "^3.0.1",
"assert": "^2.0.0",
"blockstore-core": "^2.0.2",
"c8": "^7.12.0",
Expand Down
Loading

0 comments on commit 197439e

Please sign in to comment.