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 didmailto/did.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ func Email(d did.DID) (string, error) {
return fmt.Sprintf("%s@%s", emailLocal, domain), nil
}

// Parse parses a mailto DID from a string. This is the same as [did.Parse],
// with validation that the DID is a mailto DID.
func Parse(str string) (did.DID, error) {
d, err := did.Parse(str)
if err != nil {
Expand Down
58 changes: 0 additions & 58 deletions ucan/attestations.go

This file was deleted.

183 changes: 0 additions & 183 deletions ucan/attestations_test.go

This file was deleted.

26 changes: 2 additions & 24 deletions ucan/proof_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,15 @@ type ProofStore interface {
// in strict sequence where the aud of the previous Delegation matches the iss
// of the next Delegation.
ProofChain(ctx context.Context, aud did.DID, cmd ucan.Command, sub did.DID) ([]ucan.Delegation, []cid.Cid, error)
// ProofAttestations returns a list of attestations for proofs that need them.
// i.e. if a proof is signed with a non-standard signature this function will
// fetch an attestation for it, and fail if it cannot. The authority parameter
// is the DID of the service we trust to be issuing attestations.
ProofAttestations(ctx context.Context, proofs []ucan.Delegation, authority did.DID) ([]ucan.Invocation, error)
}

// ContainerProofStore is a proof store backed by an in-memory container.
type ContainerProofStore struct {
container ucan.Container
}

var _ ProofStore = (*ContainerProofStore)(nil)

// NewContainerProofStore creates a proof store backed by an in-memory container.
func NewContainerProofStore(ct ucan.Container) *ContainerProofStore {
return &ContainerProofStore{container: ct}
Expand All @@ -38,10 +35,6 @@ func (cps *ContainerProofStore) ProofChain(ctx context.Context, aud did.DID, cmd
return ProofChain(ctx, cps.matchDelegations, aud, cmd, sub)
}

func (cps *ContainerProofStore) ProofAttestations(ctx context.Context, proofs []ucan.Delegation, authority did.DID) ([]ucan.Invocation, error) {
return ProofAttestations(ctx, cps.listInvocations, proofs, authority)
}

func (ps *ContainerProofStore) listDelegations(ctx context.Context, aud did.DID, cmd ucan.Command, sub did.DID) iter.Seq2[ucan.Delegation, error] {
return func(yield func(ucan.Delegation, error) bool) {
if ps.container == nil {
Expand All @@ -60,18 +53,3 @@ func (ps *ContainerProofStore) listDelegations(ctx context.Context, aud did.DID,
func (ps *ContainerProofStore) matchDelegations(ctx context.Context, aud did.DID, cmd ucan.Command, sub did.DID) iter.Seq2[ucan.Delegation, error] {
return NewDelegationMatcher(ps.listDelegations)(ctx, aud, cmd, sub)
}

func (ps *ContainerProofStore) listInvocations(ctx context.Context, aud did.DID, cmd ucan.Command, sub did.DID) iter.Seq2[ucan.Invocation, error] {
return func(yield func(ucan.Invocation, error) bool) {
if ps.container == nil {
return
}
for _, d := range ps.container.Invocations() {
if d.Audience() == aud && d.Command() == cmd && d.Subject() == sub {
if !yield(d, nil) {
return
}
}
}
}
}
Loading
Loading