Skip to content
Closed
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ The Storacha upload service in Go.
* 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/ucantone/did"
"github.com/spf13/cobra"
"github.com/storacha/go-ucanto/did"
"github.com/storacha/sprue/cmd/client/lib"
)

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/ucantone/did"
"github.com/spf13/cobra"
"github.com/storacha/go-ucanto/core/delegation"
"github.com/storacha/sprue/cmd/client/lib"
)

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/ucantone/did"
"github.com/spf13/cobra"
"github.com/storacha/go-ucanto/did"
"github.com/storacha/sprue/cmd/client/lib"
)

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/spf13/cobra"
"github.com/storacha/sprue/internal/config"
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))
cobra.CheckErr(err)

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,9 +8,9 @@ import (
"io"
"os"

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

var parseCmd = &cobra.Command{
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
67 changes: 17 additions & 50 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,32 @@ module github.com/storacha/sprue
go 1.25.3

require (
github.com/alanshaw/dag-json-gen v0.0.4
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/docker/docker v28.5.2+incompatible
github.com/fil-forge/libforge v0.0.0-20260511094037-80a019ef76b6
github.com/fil-forge/ucantone v0.0.0-20260507115308-bdd3b86f5b1b
github.com/google/uuid v1.6.0
github.com/ipfs/go-cid v0.6.0
github.com/ipfs/go-log/v2 v2.9.0
github.com/ipfs/go-cid v0.6.1
github.com/ipld/go-ipld-prime v0.21.1-0.20240917223228-6148356a4c2e
github.com/labstack/echo/v4 v4.14.0
github.com/multiformats/go-multiaddr v0.16.0
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/spf13/cobra v1.10.2
github.com/spf13/viper v1.21.0
github.com/storacha/go-libstoracha v0.7.5
github.com/storacha/go-ucanto v0.7.2
github.com/stretchr/testify v1.11.1
github.com/testcontainers/testcontainers-go v0.41.0
github.com/testcontainers/testcontainers-go/modules/dynamodb v0.41.0
github.com/testcontainers/testcontainers-go/modules/minio v0.40.0
github.com/whyrusleeping/cbor-gen v0.3.1
go.uber.org/fx v1.24.0
go.uber.org/zap v1.27.0
go.uber.org/zap v1.27.1
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da
)

require (
Expand Down Expand Up @@ -61,49 +62,22 @@ require (
github.com/cpuguy83/dockercfg v0.3.2 // indirect
github.com/creack/pty v1.1.24 // 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/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/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // 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.0 // indirect
github.com/ipfs/go-blockservice v0.5.2 // indirect
github.com/ipfs/go-datastore v0.9.0 // 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.1.0 // indirect
github.com/ipfs/go-ipld-format v0.6.0 // indirect
github.com/ipfs/go-ipld-legacy v0.2.1 // 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.0.1 // 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.6.0 // indirect
github.com/ipni/go-libipni v0.6.18 // indirect
github.com/klauspost/compress v1.18.2 // indirect
github.com/klauspost/cpuid/v2 v2.2.10 // 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.41.1 // 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
Expand All @@ -118,19 +92,15 @@ require (
github.com/moby/sys/userns v0.1.0 // indirect
github.com/moby/term v0.5.2 // indirect
github.com/morikuni/aec v1.0.0 // 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-multibase v0.3.0 // indirect
github.com/multiformats/go-multicodec v0.9.1 // 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/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pion/datachannel v1.6.0 // indirect
github.com/pion/logging v0.2.4 // indirect
github.com/pion/sctp v1.9.2 // indirect
github.com/pion/webrtc/v4 v4.2.9 // 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
Expand All @@ -146,32 +116,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.42.0 // indirect
go.opentelemetry.io/otel/metric v1.42.0 // indirect
go.opentelemetry.io/otel/trace v1.42.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.48.0 // indirect
golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa // indirect
golang.org/x/net v0.51.0 // indirect
golang.org/x/sync v0.20.0 // indirect
golang.org/x/sys v0.41.0 // indirect
golang.org/x/text v0.34.0 // indirect
golang.org/x/crypto v0.50.0 // indirect
golang.org/x/net v0.52.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-20260316172706-e463d84ca32d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260311181403-84a4fc48630c // indirect
google.golang.org/grpc v1.79.2 // 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