Skip to content
Open
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
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ clean:

docker-build:
$(DOCKER) build -t sprue:latest .

gen:
go generate ./...
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ Sprue supports three store backends, selected by
* The following dynamo tables have GSIs that do not exist in w3infra that need to be added:
* `consumer` - `consumerV3` and `customerV2`
* Using `cid.Cid` in new code over `ipld.Link` to ease transition to UCAN 1.0 when it comes.
* `retrievalAuth` is now an array of CIDs - an explicit delegation chain.
* `/upload/add` now takes an optional `index` CID, allowing us to track/remove indexes.
6 changes: 3 additions & 3 deletions cmd/client/admin/provider/deregister.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package provider

import (
"github.com/fil-forge/go-ucanto/did"
"github.com/fil-forge/sprue/cmd/client/lib"
"github.com/fil-forge/ucantone/did"
"github.com/spf13/cobra"
)

Expand All @@ -15,12 +15,12 @@ var deregisterCmd = &cobra.Command{
}

func doDeregister(cmd *cobra.Command, args []string) error {
c, _, _, id := lib.InitClient(cmd)
c, _, _, _ := lib.InitClient(cmd)

providerID, err := did.Parse(args[0])
cobra.CheckErr(err)

_, err = c.AdminProviderDeregister(cmd.Context(), id.Signer, providerID)
_, err = c.AdminProviderDeregister(cmd.Context(), providerID)
cobra.CheckErr(err)

cmd.Println("Provider deregistered successfully")
Expand Down
6 changes: 3 additions & 3 deletions cmd/client/admin/provider/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ var listCmd = &cobra.Command{
}

func doList(cmd *cobra.Command, args []string) error {
c, _, _, id := lib.InitClient(cmd)
c, _, _, _ := lib.InitClient(cmd)

res, err := c.AdminProviderList(cmd.Context(), id.Signer)
res, _, err := c.AdminProviderList(cmd.Context())
cobra.CheckErr(err)

if len(res.Providers) == 0 {
Expand All @@ -29,7 +29,7 @@ func doList(cmd *cobra.Command, args []string) error {
table := lib.NewTable(cmd.OutOrStdout())
table.SetHeader([]string{"ID", "Weight", "Replication Weight", "URL"})
for _, p := range res.Providers {
table.Append([]string{p.ID.String(), fmt.Sprintf("%d", p.Weight), fmt.Sprintf("%d", p.ReplicationWeight), p.Endpoint})
table.Append([]string{p.Provider.String(), fmt.Sprintf("%d", p.Weight), fmt.Sprintf("%d", p.ReplicationWeight), p.Endpoint})
}
table.Render()

Expand Down
12 changes: 6 additions & 6 deletions cmd/client/admin/provider/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@ package provider
import (
"net/url"

"github.com/fil-forge/go-ucanto/core/delegation"
"github.com/fil-forge/sprue/cmd/client/lib"
"github.com/fil-forge/ucantone/did"
"github.com/spf13/cobra"
)

var registerCmd = &cobra.Command{
Use: "register <provider-url> <proof>",
Use: "register <provider-did> <provider-url>",
Aliases: []string{"add"},
Short: "Register a storage provider with the service",
Args: cobra.ExactArgs(2),
RunE: doRegister,
}

func doRegister(cmd *cobra.Command, args []string) error {
c, _, _, id := lib.InitClient(cmd)
c, _, _, _ := lib.InitClient(cmd)

endpoint, err := url.Parse(args[0])
id, err := did.Parse(args[0])
cobra.CheckErr(err)

proof, err := delegation.Parse(args[1])
endpoint, err := url.Parse(args[1])
cobra.CheckErr(err)

_, err = c.AdminProviderRegister(cmd.Context(), id.Signer, endpoint.String(), proof)
_, err = c.AdminProviderRegister(cmd.Context(), id, endpoint.String())
cobra.CheckErr(err)

cmd.Println("Provider registered successfully")
Expand Down
6 changes: 3 additions & 3 deletions cmd/client/admin/provider/weight/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package weight
import (
"strconv"

"github.com/fil-forge/go-ucanto/did"
"github.com/fil-forge/sprue/cmd/client/lib"
"github.com/fil-forge/ucantone/did"
"github.com/spf13/cobra"
)

Expand All @@ -16,7 +16,7 @@ var setCmd = &cobra.Command{
}

func doSet(cmd *cobra.Command, args []string) error {
c, _, _, id := lib.InitClient(cmd)
c, _, _, _ := lib.InitClient(cmd)

providerID, err := did.Parse(args[0])
cobra.CheckErr(err)
Expand All @@ -27,7 +27,7 @@ func doSet(cmd *cobra.Command, args []string) error {
replicationWeight, err := strconv.ParseInt(args[2], 10, 0)
cobra.CheckErr(err)

_, err = c.AdminProviderWeightSet(cmd.Context(), id.Signer, providerID, int(weight), int(replicationWeight))
_, err = c.AdminProviderWeightSet(cmd.Context(), providerID, int(weight), int(replicationWeight))
cobra.CheckErr(err)

cmd.Println("Provider weight set successfully")
Expand Down
9 changes: 5 additions & 4 deletions cmd/client/lib/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package lib

import (
"fmt"
"net/url"

"github.com/fil-forge/sprue/internal/config"
"github.com/fil-forge/sprue/internal/fx"
Expand All @@ -25,10 +26,10 @@ func InitClient(cmd *cobra.Command) (*client.Client, *config.Config, *zap.Logger
id, err := fx.NewIdentity(cfg, logger)
cobra.CheckErr(err)

c, err := client.New(
id.Signer.DID(),
client.WithServiceURL(fmt.Sprintf("http://%s:%d", cfg.Server.Host, cfg.Server.Port)),
)
endpoint, err := url.Parse(fmt.Sprintf("http://%s:%d", cfg.Server.Host, cfg.Server.Port))
Comment thread
alanshaw marked this conversation as resolved.
cobra.CheckErr(err)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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


c, err := client.New(id.Signer.DID(), endpoint, id.Signer, logger)
cobra.CheckErr(err)
return c, cfg, logger, id
}
6 changes: 3 additions & 3 deletions cmd/identity/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"io"
"os"

signer "github.com/fil-forge/go-ucanto/principal/ed25519/signer"
verifier "github.com/fil-forge/go-ucanto/principal/ed25519/verifier"
signer "github.com/fil-forge/ucantone/principal/ed25519"
verifier "github.com/fil-forge/ucantone/principal/ed25519/verifier"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -61,7 +61,7 @@ var parseCmd = &cobra.Command{
return fmt.Errorf("PKCS#8 private key does not implement ed25519")
}

key, err := signer.FromRaw(ed25519SK)
key, err := signer.FromRaw(ed25519SK.Seed())
if err != nil {
return fmt.Errorf("decoding ed25519 private key: %w", err)
}
Expand Down
96 changes: 30 additions & 66 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,20 @@ module github.com/fil-forge/sprue
go 1.25.3

require (
github.com/alanshaw/dag-json-gen v0.0.5
github.com/aws/aws-sdk-go-v2 v1.41.3
github.com/aws/aws-sdk-go-v2/config v1.32.11
github.com/aws/aws-sdk-go-v2/credentials v1.19.11
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.20.34
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.56.1
github.com/aws/aws-sdk-go-v2/service/s3 v1.96.4
github.com/fil-forge/go-libstoracha v0.0.0-20260507180245-218ac18ff773
github.com/fil-forge/go-ucanto v0.0.0-20260507172450-5cb5d073f8ab
github.com/docker/docker v28.5.2+incompatible
github.com/fil-forge/libforge v0.0.0-20260521215559-0f7fa19c9ebc
github.com/fil-forge/ucantone v0.0.0-20260521210642-84d8c533075b
github.com/google/uuid v1.6.0
github.com/ipfs/go-cid v0.6.0
github.com/ipfs/go-log/v2 v2.9.1
github.com/ipld/go-ipld-prime v0.22.0
github.com/jackc/pgx/v5 v5.9.1
github.com/ipfs/go-cid v0.6.1
github.com/jackc/pgx/v5 v5.8.0
github.com/labstack/echo/v4 v4.14.0
github.com/multiformats/go-multiaddr v0.16.1
github.com/multiformats/go-multibase v0.2.0
github.com/multiformats/go-multihash v0.2.3
github.com/olekukonko/tablewriter v0.0.5
github.com/pressly/goose/v3 v3.27.0
Expand All @@ -29,24 +27,10 @@ require (
github.com/testcontainers/testcontainers-go/modules/dynamodb v0.41.0
github.com/testcontainers/testcontainers-go/modules/minio v0.40.0
github.com/testcontainers/testcontainers-go/modules/postgres v0.42.0
github.com/whyrusleeping/cbor-gen v0.3.1
go.uber.org/fx v1.24.0
go.uber.org/zap v1.27.1
)

require (
github.com/ipfs/boxo v0.34.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/mfridman/interpolate v0.0.2 // indirect
github.com/moby/moby/api v1.54.1 // indirect
github.com/moby/moby/client v0.4.0 // indirect
github.com/moby/sys/atomicwriter v0.1.0 // indirect
github.com/sethvargo/go-retry v0.3.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0 // indirect
go.opentelemetry.io/otel/sdk v1.43.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.43.0 // indirect
golang.org/x/sync v0.20.0 // indirect
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da
)

require (
Expand Down Expand Up @@ -79,75 +63,56 @@ require (
github.com/containerd/platforms v0.2.1 // indirect
github.com/cpuguy83/dockercfg v0.3.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/docker v28.5.2+incompatible
github.com/docker/go-connections v0.6.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/ebitengine/purego v0.10.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/filecoin-project/go-data-segment v0.0.1 // indirect
github.com/filecoin-project/go-fil-commcid v0.2.0 // indirect
github.com/filecoin-project/go-fil-commp-hashhash v0.2.0 // indirect
github.com/filecoin-project/go-state-types v0.18.0 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/ipfs/bbloom v0.0.4 // indirect
github.com/ipfs/go-block-format v0.2.3 // indirect
github.com/ipfs/go-blockservice v0.5.2 // indirect
github.com/ipfs/go-datastore v0.9.1 // indirect
github.com/ipfs/go-ipfs-blockstore v1.3.1 // indirect
github.com/ipfs/go-ipfs-ds-help v1.1.1 // indirect
github.com/ipfs/go-ipfs-exchange-interface v0.2.1 // indirect
github.com/ipfs/go-ipfs-util v0.0.3 // indirect
github.com/ipfs/go-ipld-cbor v0.2.0 // indirect
github.com/ipfs/go-ipld-format v0.6.3 // indirect
github.com/ipfs/go-ipld-legacy v0.2.2 // indirect
github.com/ipfs/go-log v1.0.5 // indirect
github.com/ipfs/go-merkledag v0.11.0 // indirect
github.com/ipfs/go-metrics-interface v0.3.0 // indirect
github.com/ipfs/go-verifcid v0.0.3 // indirect
github.com/ipld/go-car v0.6.2 // indirect
github.com/ipld/go-codec-dagpb v1.7.0 // indirect
github.com/ipni/go-libipni v0.7.5 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/klauspost/compress v1.18.5 // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/labstack/gommon v0.4.2 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/libp2p/go-libp2p v0.47.0 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/magiconair/properties v1.8.10 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.19 // indirect
github.com/mfridman/interpolate v0.0.2 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/go-archive v0.2.0 // indirect
github.com/moby/moby/api v1.54.1 // indirect
github.com/moby/moby/client v0.4.0 // indirect
github.com/moby/patternmatcher v0.6.1 // indirect
github.com/moby/sys/atomicwriter v0.1.0 // indirect
github.com/moby/sys/sequential v0.6.0 // indirect
github.com/moby/sys/user v0.4.0 // indirect
github.com/moby/sys/userns v0.1.0 // indirect
github.com/moby/term v0.5.2 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/mr-tron/base58 v1.3.0 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect
github.com/multiformats/go-multicodec v0.10.0 // indirect
github.com/multiformats/go-multibase v0.3.0 // indirect
github.com/multiformats/go-varint v0.1.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/polydawn/refmt v0.89.1-0.20231129105047-37766d95467a // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/sethvargo/go-retry v0.3.0 // indirect
github.com/shirou/gopsutil/v4 v4.26.3 // indirect
github.com/sirupsen/logrus v1.9.4 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
Expand All @@ -158,30 +123,29 @@ require (
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tklauser/go-sysconf v0.3.16 // indirect
github.com/tklauser/numcpus v0.11.0 // indirect
github.com/ucan-wg/go-ucan v0.0.0-20240916120445-37f52863156c // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/whyrusleeping/cbor-gen v0.3.1 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect
gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 // indirect
go.opentelemetry.io/otel v1.43.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0 // indirect
go.opentelemetry.io/otel/metric v1.43.0 // indirect
go.opentelemetry.io/otel/sdk v1.43.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.43.0 // indirect
go.opentelemetry.io/otel/trace v1.43.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/dig v1.19.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.49.0 // indirect
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa // indirect
golang.org/x/crypto v0.50.0 // indirect
golang.org/x/net v0.52.0 // indirect
golang.org/x/sys v0.42.0 // indirect
golang.org/x/text v0.35.0 // indirect
golang.org/x/sync v0.20.0 // indirect
golang.org/x/sys v0.43.0 // indirect
golang.org/x/text v0.36.0 // indirect
golang.org/x/time v0.14.0 // indirect
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9 // indirect
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.4.1 // indirect
pitr.ca/jsontokenizer v0.3.0 // indirect
)
Loading
Loading