Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 6 additions & 9 deletions .github/actions/pnpm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ description: 'Setup node & pnpm'
runs:
using: 'composite'
steps:
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
with:
version: 8
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
node-version: 24
cache: 'pnpm'
- name: Install npm package dependencies
shell: bash
run: pnpm install --frozen-lockfile
4 changes: 3 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ jobs:
needs:
- test
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- uses: ./.github/actions/pnpm
- run: pnpm pages:build
env:
Expand Down
12 changes: 9 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
# dependencies
/node_modules
/.pnp
.pnp.js
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage
Expand All @@ -23,9 +28,10 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local
# env files (can opt-in for committing if needed)
.env*

# vercel
.vercel
Expand Down
82 changes: 0 additions & 82 deletions CHANGELOG.md

This file was deleted.

File renamed without changes.
8 changes: 3 additions & 5 deletions src/app/console/page.tsx → app/console/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import { useContext, useState, useEffect, ChangeEvent } from 'react'

Check warning on line 3 in app/console/page.tsx

View workflow job for this annotation

GitHub Actions / test / Test

'useEffect' is defined but never used
import { delegate } from '@ucanto/core'
import Countdown from 'react-countdown'
import { useAgent } from "@/hooks/agent"
Expand All @@ -27,13 +27,11 @@
const agent = useAgent()
const agentDID = agent?.did()
const [delegations, setDelegations] = useState<Delegation<Capabilities>[]>([])
if (agent) {
setDelegations(agent.proofs())
}
const [configuredServiceSigner, setConfiguredServiceSigner] = useState<Ucanto.Signer>()
const [expiry, setExpiry] = useState<number>(30)
useEffect(function () {
if (agent) {
setDelegations(agent.proofs())
}
}, [agent])
const { servicePrincipal } = useContext(ServiceContext)

const serviceSigner = configuredServiceSigner || servicePrincipal as Ucanto.Signer | undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import Link from "next/link"
import { notFound } from "next/navigation"
import * as DidMailto from '@web3-storage/did-mailto'
import * as DidMailto from '@storacha/did-mailto'

import { useCustomer } from "@/hooks/customer"
import { useRateLimitActions } from "@/hooks/rate-limit"
Expand Down
File renamed without changes.
4 changes: 1 addition & 3 deletions src/app/globals.css → app/globals.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@import "tailwindcss";

@layer components {
.btn {
Expand Down
1 change: 1 addition & 0 deletions src/app/layout.tsx → app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client'

import './globals.css'
import type { JSX } from 'react'
import { AgentProvider } from '@/contexts/agent'
import { ServiceProvider } from '@/contexts/service'
import Nav from '@/components/nav'
Expand Down
4 changes: 2 additions & 2 deletions src/app/page.tsx → app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use client'
import type { EmailAddress } from "@web3-storage/did-mailto/dist/src/types";
import type { EmailAddress } from "@storacha/did-mailto";
import { useState, useCallback, ChangeEvent, FormEvent } from "react"
import { useRouter } from "next/navigation";
import * as MailtoDid from '@web3-storage/did-mailto'
import * as MailtoDid from '@storacha/did-mailto'
import Link from "next/link";

Check warning on line 6 in app/page.tsx

View workflow job for this annotation

GitHub Actions / test / Test

'Link' is defined but never used

export default function Root () {
const router = useRouter();
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { capability, struct, ok, Schema } from '@ucanto/validator'
import { Utils, Customer } from '@web3-storage/capabilities'
import { Utils, Customer } from '@storacha/capabilities'

const { equal, equalWith, and } = Utils
const { ProviderDID } = Customer
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 3 additions & 4 deletions src/contexts/agent.tsx → contexts/agent.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
'use client'

import { useEffect, useState, createContext } from "react"

import { useEffect, useState, createContext, type JSX } from "react"
import type {
ConnectionView,
Principal,
} from '@ucanto/interface'
import { Service } from './service'
import { Agent } from '@web3-storage/access/agent'
import { StoreIndexedDB } from '@web3-storage/access/stores/store-indexeddb'
import { Agent } from '@storacha/access/agent'
import { StoreIndexedDB } from '@storacha/access/stores/store-indexeddb'
import * as RSASigner from '@ucanto/principal/rsa'
import * as Ucanto from '@ucanto/interface'
import { useClient } from "@/hooks/service"
Expand Down
12 changes: 8 additions & 4 deletions src/contexts/service.tsx → contexts/service.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use client'

import { useEffect, useState, createContext } from "react"
import { useEffect, useState, createContext, type JSX } from "react"
import { ServiceMethod, DIDKey, InferInvokedCapability } from '@ucanto/interface'
import * as Server from '@ucanto/server'
import { CAR, HTTP } from '@ucanto/transport'
import * as Ucanto from '@ucanto/interface'
import * as Signer from '@ucanto/principal/ed25519'
import { Admin, Customer, Consumer, Subscription, RateLimit } from '@web3-storage/capabilities'
import { Admin, Customer, Consumer, Subscription, RateLimit } from '@storacha/capabilities'
import { webDidFromMailtoDid } from '@/util/did'
import { spaceOneDid, spaceTwoDid } from '@/util/spaces'
import {
Expand All @@ -27,7 +27,7 @@
AdminUploadInspectFailure,
AdminStoreInspectSuccess,
AdminStoreInspectFailure
} from "@web3-storage/capabilities/types"
} from "@storacha/capabilities/types"
import { Absentee } from "@ucanto/principal"

export type AccountDID = Ucanto.DID<'mailto'>
Expand Down Expand Up @@ -164,11 +164,13 @@
export async function createLocalServer (id: Ucanto.Signer) {
return Server.create<Service>({
id,
// TODO: check revocations here
validateAuthorization: () => ({ ok: {} }),
service: {
customer: {
get: Server.provide(Customer.get, async ({ capability }) => {
const did = capability.nb.customer
const domainBlocked = domains[webDidFromMailtoDid(did)]?.blocked

Check warning on line 173 in contexts/service.tsx

View workflow job for this annotation

GitHub Actions / test / Test

'domainBlocked' is assigned a value but never used
if (customers[did]) {
return {
ok: {
Expand All @@ -191,7 +193,9 @@
if (spaces[did]) {
return {
ok: {
did, ...spaces[did]
did,
...spaces[did],
customer: subscriptions[did].customer
}
}
} else {
Expand Down Expand Up @@ -296,7 +300,7 @@

type ServiceConfigs = Record<string, ServiceConfig>

const staticServiceConfigs: ServiceConfigs = {

Check warning on line 303 in contexts/service.tsx

View workflow job for this annotation

GitHub Actions / test / Test

'staticServiceConfigs' is assigned a value but never used
local: { name: "Local", local: true },
travis: { name: "Travis", url: 'https://9bovsbxdii.execute-api.us-west-2.amazonaws.com', did: 'did:web:staging.web3.storage' }
}
Expand Down
18 changes: 18 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { defineConfig, globalIgnores } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";
import nextTs from "eslint-config-next/typescript";

const eslintConfig = defineConfig([
...nextVitals,
...nextTs,
// Override default ignores of eslint-config-next.
globalIgnores([
// Default ignores of eslint-config-next:
".next/**",
"out/**",
"build/**",
"next-env.d.ts",
]),
]);

export default eslintConfig;
File renamed without changes.
2 changes: 1 addition & 1 deletion src/hooks/cid.ts → hooks/cid.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import useSWR from 'swr'
import { DID } from '@ucanto/interface'
import { Admin } from '@web3-storage/capabilities'
import { Admin } from '@storacha/capabilities'
import { useServicePrincipal } from './service'
import { useAgent } from './agent'
import { parseLink } from '@ucanto/core'
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/consumer.ts → hooks/consumer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import useSWR from 'swr'
import { DID } from '@ucanto/interface'
import { Consumer } from '@web3-storage/capabilities'
import { Consumer } from '@storacha/capabilities'
import { useServicePrincipal } from './service'
import { useAgent } from './agent'

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/customer.ts → hooks/customer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import useSWR from 'swr'
import { DID } from '@ucanto/interface'
import { Customer } from '@web3-storage/capabilities'
import { Customer } from '@storacha/capabilities'
import { useAgent } from './agent'
import { useServicePrincipal } from './service'

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/rate-limit.ts → hooks/rate-limit.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import useSWR, { useSWRConfig } from 'swr'
import { RateLimit } from '@web3-storage/capabilities'
import { RateLimit } from '@storacha/capabilities'
import { DID, Signer } from '@ucanto/interface'

Check warning on line 3 in hooks/rate-limit.ts

View workflow job for this annotation

GitHub Actions / test / Test

'Signer' is defined but never used
import { useClient, useServicePrincipal } from './service'
import { useAgent } from './agent'

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
4 changes: 0 additions & 4 deletions next.config.js

This file was deleted.

7 changes: 7 additions & 0 deletions next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
/* config options here */
};

export default nextConfig;
Loading
Loading