Skip to content

Commit

Permalink
fix(access-api): changes names, update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias committed Aug 19, 2022
1 parent f00e48a commit 3f9e1f8
Show file tree
Hide file tree
Showing 11 changed files with 548 additions and 323 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/access-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ jobs:
node-version: 18
cache: 'pnpm'
- run: pnpm install
- run: pnpm -r --filter @web3-storage/access-api run deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

# Publish worker to cloudflare
- uses: cloudflare/wrangler-action@2.0.0
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
workingDirectory: 'packages/access-api'
# - run: pnpm -r --filter @web3-storage/access-api run deploy
# env:
# CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
# CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"test": "pnpm -r run test"
},
"devDependencies": {
"lint-staged": "^12.4.0",
"lint-staged": "^13.0.3",
"prettier": "2.7.1",
"simple-git-hooks": "^2.8.0",
"wrangler": "^2.0.8"
"wrangler": "^2.0.26"
},
"simple-git-hooks": {
"pre-commit": "npx lint-staged"
Expand Down
26 changes: 13 additions & 13 deletions packages/access-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"main": "dist/worker.js",
"private": "true",
"scripts": {
"lint": "tsc && eslint '**/*.{js,ts}' && prettier --check '**/*.{js,ts,md,yml,json}' --ignore-path ../../.gitignore",
"lint": "tsc --build && eslint '**/*.{js,ts}' && prettier --check '**/*.{js,ts,md,yml,json}' --ignore-path ../../.gitignore",
"deploy": "wrangler publish",
"dev": "miniflare --watch --debug --env ../../.env",
"build": "scripts/cli.js build",
Expand All @@ -16,32 +16,32 @@
"license": "(Apache-2.0 OR MIT)",
"dependencies": {
"@ipld/dag-ucan": "1.7.0-beta",
"@ucanto/authority": "^0.4.5",
"@ucanto/client": "^0.5.4",
"@ucanto/core": "^0.5.4",
"@ucanto/interface": "^0.6.2",
"@ucanto/server": "^0.6.4",
"@ucanto/transport": "^0.6.3",
"@ucanto/validator": "^0.5.5",
"@web3-storage/w3access": "workspace:^",
"@ucanto/authority": "^0.5.0",
"@ucanto/client": "^0.6.0",
"@ucanto/core": "^0.6.0",
"@ucanto/interface": "^0.7.0",
"@ucanto/server": "^0.7.0",
"@ucanto/transport": "^0.7.0",
"@ucanto/validator": "^0.6.0",
"@web3-storage/access": "workspace:^",
"@web3-storage/worker-utils": "0.2.0-dev",
"multiformats": "^9.6.5",
"nanoid": "^4.0.0",
"toucan-js": "^2.6.0"
},
"devDependencies": {
"@cloudflare/workers-types": "^3.14.0",
"@sentry/cli": "^2.1.0",
"@sentry/cli": "^2.5.2",
"@sentry/webpack-plugin": "^1.16.0",
"@types/assert": "^1.5.6",
"@types/git-rev-sync": "^2.0.0",
"@types/node": "^18.6.2",
"@types/node": "^18.7.6",
"assert": "^2.0.0",
"ava": "^4.3.0",
"buffer": "^6.0.3",
"delay": "^5.0.0",
"dotenv": "^16.0.0",
"esbuild": "^0.14.51",
"esbuild": "^0.15.5",
"execa": "^6.1.0",
"git-rev-sync": "^3.0.1",
"hd-scripts": "^2.0.1",
Expand All @@ -50,7 +50,7 @@
"readable-stream": "^4.1.0",
"sade": "^1.7.4",
"typescript": "4.7.4",
"wrangler": "^2.0.23"
"wrangler": "^2.0.26"
},
"eslintConfig": {
"extends": [
Expand Down
4 changes: 2 additions & 2 deletions packages/access-api/src/ucanto/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import {
identityIdentify,
identityRegister,
identityValidate,
} from '@web3-storage/w3access/capabilities'
} from '@web3-storage/access/capabilities'

/**
* @param {import('../bindings').RouteContext} ctx
* @returns {import('@web3-storage/w3access/types').Service}
* @returns {import('@web3-storage/access/types').Service}
*/
export function service(ctx) {
return {
Expand Down
2 changes: 1 addition & 1 deletion packages/access-api/test/helpers/setup.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as UCAN from '@ipld/dag-ucan'
import { SigningAuthority } from '@ucanto/authority'
import anyTest from 'ava'
import { connection as w3connection } from '@web3-storage/w3access/connection'
import { connection as w3connection } from '@web3-storage/access/connection'
import { Miniflare } from 'miniflare'
import dotenv from 'dotenv'
import path from 'path'
Expand Down
6 changes: 3 additions & 3 deletions packages/access-api/test/identity-register.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as UCAN from '@ipld/dag-ucan'
import { SigningAuthority } from '@ucanto/authority'
import { Delegation } from '@ucanto/core'
import { Accounts } from '../src/kvs/accounts.js'
import * as caps from '@web3-storage/w3access/capabilities'
import * as caps from '@web3-storage/access/capabilities'
import { connection, mf, serviceAuthority, test } from './helpers/setup.js'
// eslint-disable-next-line no-unused-vars
import * as Types from '@ucanto/interface'
Expand Down Expand Up @@ -77,12 +77,12 @@ test('identify', async (t) => {
if (out?.error || !out) {
return
}
/** @type {Types.UCAN.JWT<import('@web3-storage/w3access/types').IdentityRegister>} */
/** @type {Types.UCAN.JWT<import('@web3-storage/access/types').IdentityRegister>} */
// @ts-ignore
const jwt = out.delegation.replace('http://localhost:8787/validate?ucan=', '')
const ucan = UCAN.parse(jwt)
const root = await UCAN.write(ucan)
/** @type {Types.Delegation<[import('@web3-storage/w3access/types').IdentityRegister]>} */
/** @type {Types.Delegation<[import('@web3-storage/access/types').IdentityRegister]>} */
const proof = Delegation.create({ root })

const register = caps.identityRegister.invoke({
Expand Down
2 changes: 1 addition & 1 deletion packages/access-api/test/identity-validate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from './helpers/setup.js'
import * as UCAN from '@ipld/dag-ucan'
import { SigningAuthority } from '@ucanto/authority'
import * as caps from '@web3-storage/w3access/capabilities'
import * as caps from '@web3-storage/access/capabilities'

test.before((t) => {
t.context = { mf }
Expand Down
4 changes: 2 additions & 2 deletions packages/access-api/test/ucan.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ test('should fail with 0 caps', async (t) => {
{
name: 'InvocationCapabilityError',
error: true,
message: 'Invocation is required to have one single capability.',
message: 'Invocation is required to have a single capability.',
capabilities: [],
},
])
Expand Down Expand Up @@ -119,7 +119,7 @@ test('should fail with with more than 1 cap', async (t) => {
{
name: 'InvocationCapabilityError',
error: true,
message: 'Invocation is required to have one single capability.',
message: 'Invocation is required to have a single capability.',
capabilities: [
{ can: 'identity/validate', with: 'mailto:admin@dag.house' },
{ can: 'identity/register', with: 'mailto:admin@dag.house' },
Expand Down
13 changes: 9 additions & 4 deletions packages/access-api/wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ no_bundle = true
binding = "BUCKET"
bucket_name = "access-test"

kv_namespaces = [
{ binding = "ACCOUNTS", id = "e9fad7e04b254bf49206e08e50074387", preview_id = "e9fad7e04b254bf49206e08e50074387" },
{ binding = "VALIDATIONS", id = "62e57652625c44a3b1fef2f840ffc882", preview_id = "62e57652625c44a3b1fef2f840ffc882" },
]
[[kv_namespaces]]
binding = "ACCOUNTS"
id = "e9fad7e04b254bf49206e08e50074387"
preview_id = "e9fad7e04b254bf49206e08e50074387"

[[kv_namespaces]]
binding = "VALIDATIONS"
id = "62e57652625c44a3b1fef2f840ffc882"
preview_id = "62e57652625c44a3b1fef2f840ffc882"

[vars]
ENV = "dev"
Expand Down
12 changes: 6 additions & 6 deletions packages/wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
"lint": "next lint && tsc"
},
"dependencies": {
"next": "12.2.3",
"next": "12.2.5",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@types/node": "^18.6.2",
"@types/react": "^18.0.12",
"eslint": "^8.17.0",
"eslint-config-next": "12.2.3",
"@types/node": "^18.7.6",
"@types/react": "^18.0.17",
"eslint": "^8.22.0",
"eslint-config-next": "12.2.5",
"hd-scripts": "^2.0.1",
"typescript": "4.7.4",
"wrangler": "^2.0.16"
"wrangler": "^2.0.26"
},
"eslintConfig": {
"extends": [
Expand Down
Loading

0 comments on commit 3f9e1f8

Please sign in to comment.