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
16 changes: 16 additions & 0 deletions .github/workflows/workspace-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Workspace Test

on:
pull_request:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: workspace-test-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
workspace-test:
uses: fil-forge/libforge/.github/workflows/go-workspace-test.yml@v1
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build stage — native platform for fast cross-compilation
FROM --platform=$BUILDPLATFORM golang:1.25-bookworm AS build
FROM --platform=$BUILDPLATFORM golang:1.26-bookworm AS build

ARG TARGETARCH
ARG TARGETOS=linux
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Run: docker run -p 2345:2345 guppy:dev [args...]
# Connect debugger to localhost:2345

FROM --platform=$BUILDPLATFORM golang:1.25-bookworm AS build
FROM --platform=$BUILDPLATFORM golang:1.26-bookworm AS build

ARG TARGETARCH
ARG TARGETOS=linux
Expand Down
10 changes: 4 additions & 6 deletions cmd/gateway/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

contentcmds "github.com/fil-forge/libforge/commands/content"
"github.com/fil-forge/ucantone/did"
uted25519 "github.com/fil-forge/ucantone/principal/ed25519"
uted25519 "github.com/fil-forge/ucantone/multikey/ed25519"
"github.com/fil-forge/ucantone/ucan"
"github.com/ipfs/boxo/blockservice"
"github.com/ipfs/boxo/blockstore"
Expand Down Expand Up @@ -101,7 +101,6 @@ var serveCmd = &cobra.Command{
"Spaces can be specified by DID or by name.",
80),
RunE: func(cmd *cobra.Command, args []string) error {

cfg, err := config.Load[config.Config]()
if err != nil {
return fmt.Errorf("loading config: %w", err)
Expand All @@ -115,11 +114,10 @@ var serveCmd = &cobra.Command{

c := cmdutil.MustGetClient(cfg)

edSigner, ok := c.Issuer().(uted25519.Signer)
if !ok {
return fmt.Errorf("agent key is not ed25519")
if c.Issuer().Code() != uted25519.Code {
return fmt.Errorf("agent key is not ed25519 (got %s)", c.Issuer().Code())
}
goKey := ed25519.NewKeyFromSeed(edSigner.Raw())
goKey := ed25519.NewKeyFromSeed(c.Issuer().Raw())
pub, err := crypto.UnmarshalEd25519PublicKey(goKey.Public().(ed25519.PublicKey))
cobra.CheckErr(err)
peerID, err := peer.IDFromPublicKey(pub)
Expand Down
8 changes: 4 additions & 4 deletions cmd/identity/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"

"github.com/fil-forge/libforge/identity"
"github.com/fil-forge/ucantone/principal/ed25519"
"github.com/fil-forge/ucantone/multikey/ed25519"
"github.com/spf13/cobra"
)

Expand All @@ -20,17 +20,17 @@ The DID is printed to stderr for convenience.
`,
Example: "guppy identity generate > my-key.pem",
RunE: func(cmd *cobra.Command, args []string) error {
signer, err := ed25519.Generate()
issuer, err := ed25519.GenerateIssuer()
if err != nil {
return fmt.Errorf("generating ed25519 key: %w", err)
}
pem, err := identity.EncodeEd25519SignerToPEM(signer)
pem, err := identity.EncodeSignerToPEM(issuer)
if err != nil {
return fmt.Errorf("encoding key to PEM: %w", err)
}
cmd.SetOut(os.Stdout)
cmd.SetErr(os.Stderr)
cmd.PrintErrf("# %s\n", signer.DID())
cmd.PrintErrf("# %s\n", issuer.DID())
cmd.Print(string(pem))
return nil
},
Expand Down
9 changes: 5 additions & 4 deletions cmd/internal/upload/demo/demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import (
uploadcmds "github.com/fil-forge/libforge/commands/upload"
"github.com/fil-forge/libforge/digestutil"
"github.com/fil-forge/ucantone/did"
"github.com/fil-forge/ucantone/principal/ed25519"
"github.com/fil-forge/ucantone/multikey"
"github.com/fil-forge/ucantone/multikey/ed25519"
"github.com/ipfs/go-cid"
"github.com/multiformats/go-multihash"

Expand Down Expand Up @@ -200,9 +201,9 @@ func Demo(ctx context.Context, repo *sqlrepo.Repo, spaceName string, alterMetada
if err != nil {
return fmt.Errorf("creating space key: %w", err)
}
spaceDID := space.DID()
spaceDID := space.KeyDID()

service, err := ed25519.Generate()
service, err := ed25519.GenerateIssuer()
if err != nil {
return fmt.Errorf("creating service key: %w", err)
}
Expand Down Expand Up @@ -244,7 +245,7 @@ func Demo(ctx context.Context, repo *sqlrepo.Repo, spaceName string, alterMetada
// so the demo can exercise the full scan -> DAG -> shard -> upload pipeline
// without real credentials or a service.
type demoClient struct {
service ed25519.Signer
service multikey.Issuer
}

var _ storacha.Client = (*demoClient)(nil)
Expand Down
4 changes: 2 additions & 2 deletions cmd/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/fil-forge/guppy/internal/cmdutil"
"github.com/fil-forge/guppy/pkg/config"
"github.com/fil-forge/guppy/pkg/didmailto"
"github.com/fil-forge/libforge/attestation/didmailto"
)

var loginCmd = &cobra.Command{
Expand All @@ -36,7 +36,7 @@ var loginCmd = &cobra.Command{
ctx := cmd.Context()
email := cmd.Flags().Arg(0)

accountDid, err := didmailto.FromEmail(email)
accountDid, err := didmailto.New(email)
if err != nil {
cmd.SilenceUsage = false
return err
Expand Down
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/fil-forge/guppy/cmd/blob"
"github.com/fil-forge/guppy/cmd/unixfs"
"github.com/fil-forge/guppy/pkg/presets"
"github.com/fil-forge/ucantone/multikey/ed25519"
logging "github.com/ipfs/go-log/v2"
"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand All @@ -26,7 +27,6 @@ import (
"github.com/fil-forge/guppy/cmd/space"
"github.com/fil-forge/guppy/cmd/upload"
libid "github.com/fil-forge/libforge/identity"
"github.com/fil-forge/ucantone/principal/ed25519"
)

var (
Expand Down Expand Up @@ -151,7 +151,7 @@ func initConfig() {
if err != nil {
log.Fatalf("failed to generate identity: %v", err)
}
pem, err := libid.EncodeEd25519SignerToPEM(signer)
pem, err := libid.EncodeSignerToPEM(signer)
if err != nil {
log.Fatalf("failed to encode identity to PEM: %v", err)
}
Expand Down
7 changes: 4 additions & 3 deletions cmd/space/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import (
"github.com/fil-forge/guppy/pkg/config"
"github.com/fil-forge/guppy/pkg/didmailto"
"github.com/fil-forge/ucantone/did"
"github.com/fil-forge/ucantone/principal/ed25519"
"github.com/fil-forge/ucantone/multikey/ed25519"
"github.com/fil-forge/ucantone/ucan"
"github.com/fil-forge/ucantone/ucan/command"
"github.com/fil-forge/ucantone/ucan/delegation"
)
Expand Down Expand Up @@ -42,7 +43,7 @@ var generateCmd = &cobra.Command{
"local store.",
80),
RunE: func(cmd *cobra.Command, args []string) error {
space, err := ed25519.Generate()
space, err := ed25519.GenerateIssuer()
if err != nil {
cmd.SilenceUsage = false
return fmt.Errorf("generating signer for space: %w", err)
Expand Down Expand Up @@ -129,7 +130,7 @@ func pickAccount(cmd *cobra.Command, accounts []did.DID, flagValue, flagName str
// grant delegates full access to the space to both the agent (so it can act on
// the space locally) and the account (stored on the service via access/delegate),
// recording the space's name in the delegation metadata.
func grant(ctx context.Context, c *client.Client, space ed25519.Signer, account did.DID, name string) error {
func grant(ctx context.Context, c *client.Client, space ucan.Issuer, account did.DID, name string) error {
opts := []delegation.Option{delegation.WithNoExpiration()}
if name != "" {
opts = append(opts, delegation.WithMetadata(client.SpaceNameMetadata(name)))
Expand Down
4 changes: 2 additions & 2 deletions cmd/whoami.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ var whoamiCmd = &cobra.Command{
if err != nil {
return err
}
id, err := identity.DecodeEd25519SignerFromPEM(pem)
id, err := identity.DecodeSignerFromPEM(pem)
if err != nil {
return err
}
cmd.Println(id.DID())
cmd.Println(id.KeyDID())
return nil
},
}
6 changes: 4 additions & 2 deletions examples/byoidentity/byoidentity.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ import (
"github.com/fil-forge/guppy/pkg/tokenstore"
uploadcmds "github.com/fil-forge/libforge/commands/upload"
"github.com/fil-forge/ucantone/did"
"github.com/fil-forge/ucantone/principal/ed25519"
"github.com/fil-forge/ucantone/multikey"
"github.com/fil-forge/ucantone/multikey/ed25519"
"github.com/fil-forge/ucantone/ucan/container"
)

func main() {
// private key to sign invocation UCAN with
keybytes, _ := os.ReadFile("path/to/private.key")
agent, _ := ed25519.FromRaw(keybytes)
agentSigner, _ := ed25519.FromRaw(keybytes)
agent := multikey.KeyIssuer(agentSigner)

// UCAN proof that signer can list uploads in this space (a delegation chain)
prfContainerBytes, _ := os.ReadFile("path/to/proof.ucan")
Expand Down
4 changes: 2 additions & 2 deletions examples/loginflow/loginflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import (
"github.com/fil-forge/guppy/pkg/presets"
uploadcmds "github.com/fil-forge/libforge/commands/upload"
"github.com/fil-forge/ucantone/did"
"github.com/fil-forge/ucantone/principal/ed25519"
"github.com/fil-forge/ucantone/multikey/ed25519"
)

// Error handling omitted for brevity.

func main() {
ctx := context.Background()

agent, _ := ed25519.Generate()
agent, _ := ed25519.GenerateIssuer()

// space to list uploads from
space, _ := did.Parse("did:key:z6MkwDuRThQcyWjqNsK54yKAmzfsiH6BTkASyiucThMtHt1y")
Expand Down
Loading
Loading