Skip to content

Commit

Permalink
fix(paseto): use new operation call contract
Browse files Browse the repository at this point in the history
Signed-off-by: Thibault Normand <me@zenithar.org>
  • Loading branch information
Zenithar committed Jan 19, 2023
1 parent a1ed244 commit 317caab
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/sdk/value/signature/paseto/transformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ func (d *pasetoTransformer) To(_ context.Context, input []byte) ([]byte, error)
}

var (
out []byte
out string
err error
)

switch sk := d.key.(type) {
case ed25519.PrivateKey:
out, err = pasetov4.Sign(input, sk, "", "")
out, err = pasetov4.Sign(input, sk, nil, nil)
case *ecdsa.PrivateKey:
out, err = pasetov3.Sign(input, sk, "", "")
out, err = pasetov3.Sign(input, sk, nil, nil)
default:
return nil, errors.New("paseto: key is not supported")
}
Expand All @@ -59,7 +59,7 @@ func (d *pasetoTransformer) To(_ context.Context, input []byte) ([]byte, error)
}

// No error
return out, nil
return []byte(out), nil
}

func (d *pasetoTransformer) From(_ context.Context, input []byte) ([]byte, error) {
Expand All @@ -70,9 +70,9 @@ func (d *pasetoTransformer) From(_ context.Context, input []byte) ([]byte, error

switch sk := d.key.(type) {
case ed25519.PublicKey:
payload, err = pasetov4.Verify(input, sk, "", "")
payload, err = pasetov4.Verify(string(input), sk, nil, nil)
case *ecdsa.PublicKey:
payload, err = pasetov3.Verify(input, sk, "", "")
payload, err = pasetov3.Verify(string(input), sk, nil, nil)
default:
return nil, errors.New("paseto: key is not supported")
}
Expand Down

0 comments on commit 317caab

Please sign in to comment.