@@ -331,7 +331,7 @@ func TestEcdsaSign(t *testing.T) {
331
331
assert .Equal (t , acceptedKeys [0 ].KeyID , keyID , "unexpected keyid" )
332
332
}
333
333
334
- func TestB64Decode (t * testing.T ) {
334
+ func TestDecodeB64Payload (t * testing.T ) {
335
335
var want = make ([]byte , 256 )
336
336
for i := range want {
337
337
want [i ] = byte (i )
@@ -342,23 +342,35 @@ func TestB64Decode(t *testing.T) {
342
342
var b64StdErr = "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0-P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn-AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq-wsbKztLW2t7i5uru8vb6_wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t_g4eLj5OXm5-jp6uvs7e7v8PHy8_T19vf4-fr7_P3-_w"
343
343
344
344
t .Run ("Standard encoding" , func (t * testing.T ) {
345
- got , err := b64Decode (b64Std )
345
+ env := & Envelope {
346
+ Payload : b64Std ,
347
+ }
348
+ got , err := env .DecodeB64Payload ()
346
349
assert .Nil (t , err , "unexpected error" )
347
350
assert .Equal (t , want , got , "wrong data" )
348
351
})
349
352
t .Run ("URL encoding" , func (t * testing.T ) {
350
- got , err := b64Decode (b64Url )
353
+ env := & Envelope {
354
+ Payload : b64Url ,
355
+ }
356
+ got , err := env .DecodeB64Payload ()
351
357
assert .Nil (t , err , "unexpected error" )
352
358
assert .Equal (t , want , got , "wrong data" )
353
359
})
354
360
355
361
t .Run ("Standard encoding - error" , func (t * testing.T ) {
356
- got , err := b64Decode (b64StdErr )
362
+ env := & Envelope {
363
+ Payload : b64StdErr ,
364
+ }
365
+ got , err := env .DecodeB64Payload ()
357
366
assert .NotNil (t , err , "expected error" )
358
367
assert .Nil (t , got , "wrong data" )
359
368
})
360
369
t .Run ("URL encoding - error" , func (t * testing.T ) {
361
- got , err := b64Decode (b64UrlErr )
370
+ env := & Envelope {
371
+ Payload : b64UrlErr ,
372
+ }
373
+ got , err := env .DecodeB64Payload ()
362
374
assert .NotNil (t , err , "expected error" )
363
375
assert .Nil (t , got , "wrong data" )
364
376
})
0 commit comments