Skip to content

Commit f258f0c

Browse files
Rename DecodePayload to DecodeB64Payload
1 parent 77f2aec commit f258f0c

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

dsse/sign.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ type Envelope struct {
3232
}
3333

3434
/*
35-
DecodePayload returns the serialized body, decoded
35+
DecodeB64Payload returns the serialized body, decoded
3636
from the envelope's payload field. A flexible
3737
decoder is used, first trying standard base64, then
3838
URL-encoded base64.
3939
*/
40-
func (e *Envelope) DecodePayload() ([]byte, error) {
40+
func (e *Envelope) DecodeB64Payload() ([]byte, error) {
4141
return b64Decode(e.Payload)
4242
}
4343

dsse/sign_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ func TestEcdsaSign(t *testing.T) {
331331
assert.Equal(t, acceptedKeys[0].KeyID, keyID, "unexpected keyid")
332332
}
333333

334-
func TestDecodePayload(t *testing.T) {
334+
func TestDecodeB64Payload(t *testing.T) {
335335
var want = make([]byte, 256)
336336
for i := range want {
337337
want[i] = byte(i)
@@ -345,15 +345,15 @@ func TestDecodePayload(t *testing.T) {
345345
env := &Envelope{
346346
Payload: b64Std,
347347
}
348-
got, err := env.DecodePayload()
348+
got, err := env.DecodeB64Payload()
349349
assert.Nil(t, err, "unexpected error")
350350
assert.Equal(t, want, got, "wrong data")
351351
})
352352
t.Run("URL encoding", func(t *testing.T) {
353353
env := &Envelope{
354354
Payload: b64Url,
355355
}
356-
got, err := env.DecodePayload()
356+
got, err := env.DecodeB64Payload()
357357
assert.Nil(t, err, "unexpected error")
358358
assert.Equal(t, want, got, "wrong data")
359359
})
@@ -362,15 +362,15 @@ func TestDecodePayload(t *testing.T) {
362362
env := &Envelope{
363363
Payload: b64StdErr,
364364
}
365-
got, err := env.DecodePayload()
365+
got, err := env.DecodeB64Payload()
366366
assert.NotNil(t, err, "expected error")
367367
assert.Nil(t, got, "wrong data")
368368
})
369369
t.Run("URL encoding - error", func(t *testing.T) {
370370
env := &Envelope{
371371
Payload: b64UrlErr,
372372
}
373-
got, err := env.DecodePayload()
373+
got, err := env.DecodeB64Payload()
374374
assert.NotNil(t, err, "expected error")
375375
assert.Nil(t, got, "wrong data")
376376
})

dsse/verify.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (ev *EnvelopeVerifier) Verify(e *Envelope) ([]AcceptedKey, error) {
4141
}
4242

4343
// Decode payload (i.e serialized body)
44-
body, err := e.DecodePayload()
44+
body, err := e.DecodeB64Payload()
4545
if err != nil {
4646
return nil, err
4747
}

0 commit comments

Comments
 (0)