@hugomrdias/foxer 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/src/bin/create.d.ts +3 -0
  2. package/dist/src/bin/create.d.ts.map +1 -0
  3. package/dist/src/bin/create.js +140 -0
  4. package/dist/src/bin/create.js.map +1 -0
  5. package/dist/src/bin/index.js +3 -2
  6. package/dist/src/bin/index.js.map +1 -1
  7. package/dist/tsconfig.tsbuildinfo +1 -1
  8. package/package.json +1 -1
  9. package/src/bin/index.ts +1 -1
  10. package/hello/apps/foc-api/README.md +0 -69
  11. package/hello/apps/foc-api/biome.json +0 -8
  12. package/hello/apps/foc-api/index.html +0 -13
  13. package/hello/apps/foc-api/package.json +0 -39
  14. package/hello/apps/foc-api/public/vite.svg +0 -1
  15. package/hello/apps/foc-api/src/app.css +0 -45
  16. package/hello/apps/foc-api/src/app.tsx +0 -43
  17. package/hello/apps/foc-api/src/assets/Cloudflare_Logo.svg +0 -51
  18. package/hello/apps/foc-api/src/assets/react.svg +0 -1
  19. package/hello/apps/foc-api/src/client.ts +0 -41
  20. package/hello/apps/foc-api/src/components/account.tsx +0 -100
  21. package/hello/apps/foc-api/src/components/wallet-options.tsx +0 -43
  22. package/hello/apps/foc-api/src/index.css +0 -68
  23. package/hello/apps/foc-api/src/main.tsx +0 -38
  24. package/hello/apps/foc-api/src/vite-env.d.ts +0 -1
  25. package/hello/apps/foc-api/tsconfig.app.json +0 -44
  26. package/hello/apps/foc-api/tsconfig.json +0 -17
  27. package/hello/apps/foc-api/tsconfig.node.json +0 -25
  28. package/hello/apps/foc-api/tsconfig.worker.json +0 -8
  29. package/hello/apps/foc-api/vite.config.ts +0 -8
  30. package/hello/apps/foc-api/worker/capabilities.ts +0 -25
  31. package/hello/apps/foc-api/worker/index.ts +0 -64
  32. package/hello/apps/foc-api/worker/router.ts +0 -35
  33. package/hello/apps/foc-api/worker-configuration.d.ts +0 -7357
  34. package/hello/apps/foc-api/wrangler.jsonc +0 -50
  35. package/hello/apps/foc-app/README.md +0 -69
  36. package/hello/apps/foc-app/biome.json +0 -8
  37. package/hello/apps/foc-app/index.html +0 -13
  38. package/hello/apps/foc-app/package.json +0 -39
  39. package/hello/apps/foc-app/public/vite.svg +0 -1
  40. package/hello/apps/foc-app/src/app.css +0 -45
  41. package/hello/apps/foc-app/src/app.tsx +0 -43
  42. package/hello/apps/foc-app/src/assets/Cloudflare_Logo.svg +0 -51
  43. package/hello/apps/foc-app/src/assets/react.svg +0 -1
  44. package/hello/apps/foc-app/src/client.ts +0 -41
  45. package/hello/apps/foc-app/src/components/account.tsx +0 -100
  46. package/hello/apps/foc-app/src/components/wallet-options.tsx +0 -43
  47. package/hello/apps/foc-app/src/index.css +0 -68
  48. package/hello/apps/foc-app/src/main.tsx +0 -38
  49. package/hello/apps/foc-app/src/vite-env.d.ts +0 -1
  50. package/hello/apps/foc-app/tsconfig.app.json +0 -44
  51. package/hello/apps/foc-app/tsconfig.json +0 -17
  52. package/hello/apps/foc-app/tsconfig.node.json +0 -25
  53. package/hello/apps/foc-app/tsconfig.worker.json +0 -8
  54. package/hello/apps/foc-app/vite.config.ts +0 -8
  55. package/hello/apps/foc-app/worker/capabilities.ts +0 -25
  56. package/hello/apps/foc-app/worker/index.ts +0 -64
  57. package/hello/apps/foc-app/worker/router.ts +0 -35
  58. package/hello/apps/foc-app/worker-configuration.d.ts +0 -7357
  59. package/hello/apps/foc-app/wrangler.jsonc +0 -50
  60. package/hello/biome.json +0 -50
  61. package/hello/package.json +0 -22
  62. package/hello/pnpm-workspace.yaml +0 -3
  63. package/hello/tsconfig.json +0 -37
@@ -1,25 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
- "target": "ES2023",
5
- "lib": ["ES2023"],
6
- "module": "ESNext",
7
- "skipLibCheck": true,
8
-
9
- /* Bundler mode */
10
- "moduleResolution": "bundler",
11
- "allowImportingTsExtensions": true,
12
- "verbatimModuleSyntax": true,
13
- "moduleDetection": "force",
14
- "noEmit": true,
15
-
16
- /* Linting */
17
- "strict": true,
18
- "noUnusedLocals": true,
19
- "noUnusedParameters": true,
20
- "erasableSyntaxOnly": true,
21
- "noFallthroughCasesInSwitch": true,
22
- "noUncheckedSideEffectImports": true
23
- },
24
- "include": ["vite.config.ts"]
25
- }
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "./tsconfig.app.json",
3
- "compilerOptions": {
4
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.worker.tsbuildinfo",
5
- "types": ["./worker-configuration.d.ts", "vite/client"]
6
- },
7
- "include": ["./worker-configuration.d.ts", "./worker"]
8
- }
@@ -1,8 +0,0 @@
1
- import { cloudflare } from '@cloudflare/vite-plugin'
2
- import react from '@vitejs/plugin-react'
3
- import { defineConfig } from 'vite'
4
-
5
- // https://vite.dev/config/
6
- export default defineConfig({
7
- plugins: [react(), cloudflare()],
8
- })
@@ -1,25 +0,0 @@
1
- import { Capability } from 'iso-ucan/capability'
2
- import { z } from 'zod/v4'
3
-
4
- export const CapAccountCreate = Capability.from({
5
- schema: z.object({
6
- type: z.string(),
7
- properties: z
8
- .object({
9
- name: z.string(),
10
- })
11
- .strict(),
12
- }),
13
- cmd: '/account/create',
14
- })
15
-
16
- export const CapAccount = Capability.from({
17
- schema: z
18
- .object({
19
- name: z.string(),
20
- })
21
- .strict(),
22
- cmd: '/account',
23
- })
24
-
25
- export const capabilities = [CapAccountCreate, CapAccount] as const
@@ -1,64 +0,0 @@
1
- import { Hono } from 'hono'
2
- import { base64pad } from 'iso-base/rfc4648'
3
- import { u8 } from 'iso-base/utils'
4
- import { MemoryDriver } from 'iso-kv/drivers/memory.js'
5
- import { EdDSASigner } from 'iso-signatures/signers/eddsa.js'
6
- import * as EdDSA from 'iso-signatures/verifiers/eddsa.js'
7
- import { Resolver } from 'iso-signatures/verifiers/resolver.js'
8
- import { Delegation } from 'iso-ucan/delegation'
9
- import { Invocation } from 'iso-ucan/invocation'
10
- import { Store } from 'iso-ucan/store'
11
- import { router } from './router'
12
-
13
- const audience = await EdDSASigner.import(
14
- 'gCZx8eS6eh6NR1yuz4Ru78uCFGwr3ORwuAHzhabEu0zM/g=='
15
- )
16
- const verifierResolver = new Resolver(
17
- {
18
- Ed25519: EdDSA.verify,
19
- },
20
- {}
21
- )
22
-
23
- const store = new Store(new MemoryDriver())
24
-
25
- const delegation1 = await Delegation.from({
26
- bytes: base64pad.decode(
27
- 'glhApGlsy06H1NFEhHmtHe4KNCcOjRkEj/Ze1gCw9WZXJsW6cZFTxXRuSc4Z5K66acMyue9b6X/DJ9wawMEGKrUEBaJhaEg0Ae0B7QETcXN1Y2FuL2RsZ0AxLjAuMC1yYy4xp2NhdWR4OGRpZDprZXk6ejZNa3V1R3hrQ0FtZlY2Mnc3Vlg2OTJnZ1d6OXFuZjhqTlBqUXVWYUJ2ZnpueThnY2NtZG8vYWNjb3VudC9jcmVhdGVjZXhw9mNpc3N4OGRpZDprZXk6ejZNa3FGc0RzbTh5bzJ2VEVIWXN0ak1taVhhVWFmSndXZERFOFJXSjhXTUZyMzVGY3BvbIBjc3VieDhkaWQ6a2V5Ono2TWtxRnNEc204eW8ydlRFSFlzdGpNbWlYYVVhZkp3V2RERThSV0o4V01GcjM1RmVub25jZUzmFzqW9dAm218FqzA='
28
- ),
29
- verifierResolver,
30
- })
31
- await store.add([delegation1])
32
-
33
- const app = new Hono()
34
-
35
- app.get('/api', (c) => c.json({ name: 'Cloudflare' }))
36
-
37
- app.post('/ucan', async (c) => {
38
- const inv = await Invocation.from({
39
- bytes: u8(await c.req.arrayBuffer()),
40
- audience,
41
- verifierResolver,
42
- resolveProof: store.resolveProof.bind(store),
43
- })
44
- inv.payload.cmd
45
-
46
- const route = router[inv.payload.cmd as keyof typeof router]
47
- if (!route) {
48
- return c.text('Route not found', 404)
49
- }
50
-
51
- console.log('route', inv.payload.args)
52
-
53
- const result = await route.fn({
54
- request: c.req.raw,
55
- issuer: audience,
56
- invocation: inv,
57
- store,
58
- })
59
-
60
- console.log('hello', inv.payload.cmd)
61
- return c.json(result)
62
- })
63
-
64
- export default app
@@ -1,35 +0,0 @@
1
- import { route } from 'iso-ucan/server'
2
- import type { InferProtocol, Router } from 'iso-ucan/types'
3
- import * as Capabilities from './capabilities'
4
-
5
- const accountRoute = route({
6
- capability: Capabilities.CapAccount,
7
- handler: ({ args }) => {
8
- console.log(args)
9
-
10
- return {
11
- status: 200,
12
- body: {
13
- message: 'Account created',
14
- },
15
- }
16
- },
17
- })
18
-
19
- const accountCreate = route({
20
- capability: Capabilities.CapAccountCreate,
21
- handler: ({ args }) => {
22
- console.log(args)
23
-
24
- return {
25
- id: args.properties.name,
26
- }
27
- },
28
- })
29
-
30
- export const router = {
31
- '/account/create': accountCreate,
32
- '/account': accountRoute,
33
- } satisfies Router<typeof Capabilities.capabilities>
34
-
35
- export type Protocol = InferProtocol<typeof router>