Skip to content

Commit 594744b

Browse files
authored
Merge pull request #21 from b-open-io/opl-328-caps
OPL-328 caps
2 parents d34a848 + eb88dd0 commit 594744b

22 files changed

+228
-225
lines changed

auth/peer_test.go

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ func CreatePeerPair(t *testing.T) (*Peer, *Peer, *wallet.MockWallet, *wallet.Moc
129129
hmacBytes[i] = byte(i)
130130
}
131131

132-
aliceWallet.MockCreateHmac = func(ctx context.Context, args wallet.CreateHmacArgs, originator string) (*wallet.CreateHmacResult, error) {
133-
return &wallet.CreateHmacResult{Hmac: hmacBytes}, nil
132+
aliceWallet.MockCreateHMAC = func(ctx context.Context, args wallet.CreateHMACArgs, originator string) (*wallet.CreateHMACResult, error) {
133+
return &wallet.CreateHMACResult{HMAC: hmacBytes}, nil
134134
}
135-
bobWallet.MockCreateHmac = func(ctx context.Context, args wallet.CreateHmacArgs, originator string) (*wallet.CreateHmacResult, error) {
136-
return &wallet.CreateHmacResult{Hmac: hmacBytes}, nil
135+
bobWallet.MockCreateHMAC = func(ctx context.Context, args wallet.CreateHMACArgs, originator string) (*wallet.CreateHMACResult, error) {
136+
return &wallet.CreateHMACResult{HMAC: hmacBytes}, nil
137137
}
138138

139139
aliceWallet.MockDecrypt = func(ctx context.Context, args wallet.DecryptArgs, originator string) (*wallet.DecryptResult, error) {
@@ -554,11 +554,11 @@ func TestPeerCertificateExchange(t *testing.T) {
554554
hmacBytes[i] = byte(i)
555555
}
556556

557-
aliceWallet.MockCreateHmac = func(ctx context.Context, args wallet.CreateHmacArgs, originator string) (*wallet.CreateHmacResult, error) {
558-
return &wallet.CreateHmacResult{Hmac: hmacBytes}, nil
557+
aliceWallet.MockCreateHMAC = func(ctx context.Context, args wallet.CreateHMACArgs, originator string) (*wallet.CreateHMACResult, error) {
558+
return &wallet.CreateHMACResult{HMAC: hmacBytes}, nil
559559
}
560-
bobWallet.MockCreateHmac = func(ctx context.Context, args wallet.CreateHmacArgs, originator string) (*wallet.CreateHmacResult, error) {
561-
return &wallet.CreateHmacResult{Hmac: hmacBytes}, nil
560+
bobWallet.MockCreateHMAC = func(ctx context.Context, args wallet.CreateHMACArgs, originator string) (*wallet.CreateHMACResult, error) {
561+
return &wallet.CreateHMACResult{HMAC: hmacBytes}, nil
562562
}
563563

564564
// Set up transport with logging
@@ -766,11 +766,11 @@ func TestPeerMultiDeviceAuthentication(t *testing.T) {
766766
hmacBytes1[i] = byte(i)
767767
}
768768

769-
aliceWallet1.MockCreateHmac = func(ctx context.Context, args wallet.CreateHmacArgs, originator string) (*wallet.CreateHmacResult, error) {
770-
return &wallet.CreateHmacResult{Hmac: hmacBytes1}, nil
769+
aliceWallet1.MockCreateHMAC = func(ctx context.Context, args wallet.CreateHMACArgs, originator string) (*wallet.CreateHMACResult, error) {
770+
return &wallet.CreateHMACResult{HMAC: hmacBytes1}, nil
771771
}
772-
aliceWallet2.MockCreateHmac = func(ctx context.Context, args wallet.CreateHmacArgs, originator string) (*wallet.CreateHmacResult, error) {
773-
return &wallet.CreateHmacResult{Hmac: hmacBytes1}, nil
772+
aliceWallet2.MockCreateHMAC = func(ctx context.Context, args wallet.CreateHMACArgs, originator string) (*wallet.CreateHMACResult, error) {
773+
return &wallet.CreateHMACResult{HMAC: hmacBytes1}, nil
774774
}
775775

776776
aliceWallet1.MockDecrypt = func(ctx context.Context, args wallet.DecryptArgs, originator string) (*wallet.DecryptResult, error) {
@@ -803,8 +803,8 @@ func TestPeerMultiDeviceAuthentication(t *testing.T) {
803803
hmacBytes2[i] = byte(i)
804804
}
805805

806-
bobWallet.MockCreateHmac = func(ctx context.Context, args wallet.CreateHmacArgs, originator string) (*wallet.CreateHmacResult, error) {
807-
return &wallet.CreateHmacResult{Hmac: hmacBytes2}, nil
806+
bobWallet.MockCreateHMAC = func(ctx context.Context, args wallet.CreateHMACArgs, originator string) (*wallet.CreateHMACResult, error) {
807+
return &wallet.CreateHMACResult{HMAC: hmacBytes2}, nil
808808
}
809809
bobWallet.MockDecrypt = func(ctx context.Context, args wallet.DecryptArgs, originator string) (*wallet.DecryptResult, error) {
810810
return &wallet.DecryptResult{Plaintext: []byte("decrypted")}, nil
@@ -1041,11 +1041,11 @@ func TestPartialCertificateAcceptance(t *testing.T) {
10411041
hmacBytes[i] = byte(i)
10421042
}
10431043

1044-
aliceWallet.MockCreateHmac = func(ctx context.Context, args wallet.CreateHmacArgs, originator string) (*wallet.CreateHmacResult, error) {
1045-
return &wallet.CreateHmacResult{Hmac: hmacBytes}, nil
1044+
aliceWallet.MockCreateHMAC = func(ctx context.Context, args wallet.CreateHMACArgs, originator string) (*wallet.CreateHMACResult, error) {
1045+
return &wallet.CreateHMACResult{HMAC: hmacBytes}, nil
10461046
}
1047-
bobWallet.MockCreateHmac = func(ctx context.Context, args wallet.CreateHmacArgs, originator string) (*wallet.CreateHmacResult, error) {
1048-
return &wallet.CreateHmacResult{Hmac: hmacBytes}, nil
1047+
bobWallet.MockCreateHMAC = func(ctx context.Context, args wallet.CreateHMACArgs, originator string) (*wallet.CreateHMACResult, error) {
1048+
return &wallet.CreateHMACResult{HMAC: hmacBytes}, nil
10491049
}
10501050

10511051
// Create mocked transports
@@ -1320,11 +1320,11 @@ func TestLibraryCardVerification(t *testing.T) {
13201320
hmacBytes[i] = byte(i)
13211321
}
13221322

1323-
aliceWallet.MockCreateHmac = func(ctx context.Context, args wallet.CreateHmacArgs, originator string) (*wallet.CreateHmacResult, error) {
1324-
return &wallet.CreateHmacResult{Hmac: hmacBytes}, nil
1323+
aliceWallet.MockCreateHMAC = func(ctx context.Context, args wallet.CreateHMACArgs, originator string) (*wallet.CreateHMACResult, error) {
1324+
return &wallet.CreateHMACResult{HMAC: hmacBytes}, nil
13251325
}
1326-
bobWallet.MockCreateHmac = func(ctx context.Context, args wallet.CreateHmacArgs, originator string) (*wallet.CreateHmacResult, error) {
1327-
return &wallet.CreateHmacResult{Hmac: hmacBytes}, nil
1326+
bobWallet.MockCreateHMAC = func(ctx context.Context, args wallet.CreateHMACArgs, originator string) (*wallet.CreateHMACResult, error) {
1327+
return &wallet.CreateHMACResult{HMAC: hmacBytes}, nil
13281328
}
13291329

13301330
// Create mocked transports
@@ -1647,11 +1647,11 @@ func TestNonmatchingCertificateRejection(t *testing.T) {
16471647
for i := range hmacBytes {
16481648
hmacBytes[i] = byte(i)
16491649
}
1650-
aliceWallet.MockCreateHmac = func(ctx context.Context, args wallet.CreateHmacArgs, originator string) (*wallet.CreateHmacResult, error) {
1651-
return &wallet.CreateHmacResult{Hmac: hmacBytes}, nil
1650+
aliceWallet.MockCreateHMAC = func(ctx context.Context, args wallet.CreateHMACArgs, originator string) (*wallet.CreateHMACResult, error) {
1651+
return &wallet.CreateHMACResult{HMAC: hmacBytes}, nil
16521652
}
1653-
bobWallet.MockCreateHmac = func(ctx context.Context, args wallet.CreateHmacArgs, originator string) (*wallet.CreateHmacResult, error) {
1654-
return &wallet.CreateHmacResult{Hmac: hmacBytes}, nil
1653+
bobWallet.MockCreateHMAC = func(ctx context.Context, args wallet.CreateHMACArgs, originator string) (*wallet.CreateHMACResult, error) {
1654+
return &wallet.CreateHMACResult{HMAC: hmacBytes}, nil
16551655
}
16561656

16571657
// Setup transports

auth/utils/completed_proto_wallet.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,14 @@ func (c *CompletedProtoWallet) GetHeaderForHeight(ctx context.Context, args wall
130130
return nil, nil
131131
}
132132

133-
// CreateHmac delegates to the embedded ProtoWallet
134-
func (c *CompletedProtoWallet) CreateHmac(ctx context.Context, args wallet.CreateHmacArgs, originator string) (*wallet.CreateHmacResult, error) {
135-
return c.ProtoWallet.CreateHmac(ctx, args, originator)
133+
// CreateHMAC delegates to the embedded ProtoWallet
134+
func (c *CompletedProtoWallet) CreateHMAC(ctx context.Context, args wallet.CreateHMACArgs, originator string) (*wallet.CreateHMACResult, error) {
135+
return c.ProtoWallet.CreateHMAC(ctx, args, originator)
136136
}
137137

138-
// VerifyHmac delegates to the embedded ProtoWallet
139-
func (c *CompletedProtoWallet) VerifyHmac(ctx context.Context, args wallet.VerifyHmacArgs, originator string) (*wallet.VerifyHmacResult, error) {
140-
return c.ProtoWallet.VerifyHmac(ctx, args, originator)
138+
// VerifyHMAC delegates to the embedded ProtoWallet
139+
func (c *CompletedProtoWallet) VerifyHMAC(ctx context.Context, args wallet.VerifyHMACArgs, originator string) (*wallet.VerifyHMACResult, error) {
140+
return c.ProtoWallet.VerifyHMAC(ctx, args, originator)
141141
}
142142

143143
// CreateSignature delegates to the embedded ProtoWallet

auth/utils/create_nonce.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ func CreateNonce(ctx context.Context, w wallet.KeyOperations, counterparty walle
1919
return "", fmt.Errorf("failed to generate random bytes: %w", err)
2020
}
2121

22-
// Create encryption arguments for the wallet's CreateHmac function
23-
args := wallet.CreateHmacArgs{
22+
// Create encryption arguments for the wallet's CreateHMAC function
23+
args := wallet.CreateHMACArgs{
2424
EncryptionArgs: wallet.EncryptionArgs{
2525
ProtocolID: wallet.Protocol{
2626
SecurityLevel: wallet.SecurityLevelEveryApp,
@@ -33,13 +33,13 @@ func CreateNonce(ctx context.Context, w wallet.KeyOperations, counterparty walle
3333
}
3434

3535
// Create an HMAC for the random data using the wallet's key
36-
hmac, err := w.CreateHmac(ctx, args, "")
36+
hmac, err := w.CreateHMAC(ctx, args, "")
3737
if err != nil {
3838
return "", fmt.Errorf("failed to create HMAC: %w", err)
3939
}
4040

4141
// Combine the random data and the HMAC
42-
combined := append(randomBytes, hmac.Hmac...)
42+
combined := append(randomBytes, hmac.HMAC...)
4343

4444
// Encode as base64
4545
nonce := base64.StdEncoding.EncodeToString(combined)

auth/utils/verify_nonce.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ func VerifyNonce(
3232
data := nonceBytes[:16]
3333
hmac := nonceBytes[16:]
3434

35-
// Create args for wallet VerifyHmac
36-
args := wallet.VerifyHmacArgs{
35+
// Create args for wallet VerifyHMAC
36+
args := wallet.VerifyHMACArgs{
3737
EncryptionArgs: wallet.EncryptionArgs{
3838
ProtocolID: wallet.Protocol{
3939
SecurityLevel: wallet.SecurityLevelEveryApp,
@@ -43,11 +43,11 @@ func VerifyNonce(
4343
Counterparty: counterparty,
4444
},
4545
Data: data,
46-
Hmac: hmac,
46+
HMAC: hmac,
4747
}
4848

4949
// Verify the hmac
50-
result, err := w.VerifyHmac(ctx, args, "")
50+
result, err := w.VerifyHMAC(ctx, args, "")
5151
if err != nil {
5252
return false, fmt.Errorf("failed to verify HMAC: %w", err)
5353
}

registry/mock.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ func (m *MockRegistry) Decrypt(ctx context.Context, args wallet.DecryptArgs, ori
107107
return nil, nil
108108
}
109109

110-
func (m *MockRegistry) CreateHmac(ctx context.Context, args wallet.CreateHmacArgs, originator string) (*wallet.CreateHmacResult, error) {
111-
require.Fail(m.T, "CreateHmac mock not implemented")
110+
func (m *MockRegistry) CreateHMAC(ctx context.Context, args wallet.CreateHMACArgs, originator string) (*wallet.CreateHMACResult, error) {
111+
require.Fail(m.T, "CreateHMAC mock not implemented")
112112
return nil, nil
113113
}
114114

115-
func (m *MockRegistry) VerifyHmac(ctx context.Context, args wallet.VerifyHmacArgs, originator string) (*wallet.VerifyHmacResult, error) {
116-
require.Fail(m.T, "VerifyHmac mock not implemented")
115+
func (m *MockRegistry) VerifyHMAC(ctx context.Context, args wallet.VerifyHMACArgs, originator string) (*wallet.VerifyHMACResult, error) {
116+
require.Fail(m.T, "VerifyHMAC mock not implemented")
117117
return nil, nil
118118
}
119119

wallet/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ type KeyOperations interface {
114114
GetPublicKey(ctx context.Context, args GetPublicKeyArgs, originator string) (*GetPublicKeyResult, error)
115115
Encrypt(ctx context.Context, args EncryptArgs, originator string) (*EncryptResult, error)
116116
Decrypt(ctx context.Context, args DecryptArgs, originator string) (*DecryptResult, error)
117-
CreateHmac(ctx context.Context, args CreateHmacArgs, originator string) (*CreateHmacResult, error)
118-
VerifyHmac(ctx context.Context, args VerifyHmacArgs, originator string) (*VerifyHmacResult, error)
117+
CreateHMAC(ctx context.Context, args CreateHMACArgs, originator string) (*CreateHMACResult, error)
118+
VerifyHMAC(ctx context.Context, args VerifyHMACArgs, originator string) (*VerifyHMACResult, error)
119119
CreateSignature(ctx context.Context, args CreateSignatureArgs, originator string) (*CreateSignatureResult, error)
120120
VerifySignature(ctx context.Context, args VerifySignatureArgs, originator string) (*VerifySignatureResult, error)
121121
}

wallet/interfaces.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,8 @@ type KeyOperations interface {
346346
GetPublicKey(ctx context.Context, args GetPublicKeyArgs, originator string) (*GetPublicKeyResult, error)
347347
Encrypt(ctx context.Context, args EncryptArgs, originator string) (*EncryptResult, error)
348348
Decrypt(ctx context.Context, args DecryptArgs, originator string) (*DecryptResult, error)
349-
CreateHmac(ctx context.Context, args CreateHmacArgs, originator string) (*CreateHmacResult, error)
350-
VerifyHmac(ctx context.Context, args VerifyHmacArgs, originator string) (*VerifyHmacResult, error)
349+
CreateHMAC(ctx context.Context, args CreateHMACArgs, originator string) (*CreateHMACResult, error)
350+
VerifyHMAC(ctx context.Context, args VerifyHMACArgs, originator string) (*VerifyHMACResult, error)
351351
CreateSignature(ctx context.Context, args CreateSignatureArgs, originator string) (*CreateSignatureResult, error)
352352
VerifySignature(ctx context.Context, args VerifySignatureArgs, originator string) (*VerifySignatureResult, error)
353353
}

wallet/mock.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ type MockWallet struct {
3333
ProveCertificateError error
3434
GetPublicKeyResult *GetPublicKeyResult
3535
GetPublicKeyError error
36-
CreateHmacResult *CreateHmacResult
37-
CreateHmacError error
36+
CreateHMACResult *CreateHMACResult
37+
CreateHMACError error
3838
CreateSignatureResult *CreateSignatureResult
3939
CreateSignatureError error
4040
VerifySignatureResult *VerifySignatureResult
@@ -49,7 +49,7 @@ type MockWallet struct {
4949
MockDiscoverByAttributes func(ctx context.Context, args DiscoverByAttributesArgs, originator string) (*DiscoverCertificatesResult, error)
5050
MockGetPublicKey func(ctx context.Context, args GetPublicKeyArgs, originator string) (*GetPublicKeyResult, error)
5151
MockCreateSignature func(ctx context.Context, args CreateSignatureArgs, originator string) (*CreateSignatureResult, error)
52-
MockCreateHmac func(ctx context.Context, args CreateHmacArgs, originator string) (*CreateHmacResult, error)
52+
MockCreateHMAC func(ctx context.Context, args CreateHMACArgs, originator string) (*CreateHMACResult, error)
5353
MockDecrypt func(ctx context.Context, args DecryptArgs, originator string) (*DecryptResult, error)
5454
MockVerifySignature func(ctx context.Context, args VerifySignatureArgs, originator string) (*VerifySignatureResult, error)
5555
MockListCertificates func(ctx context.Context, args ListCertificatesArgs, originator string) (*ListCertificatesResult, error)
@@ -191,23 +191,23 @@ func (m *MockWallet) RevealSpecificKeyLinkage(ctx context.Context, args RevealSp
191191
return nil, errors.New("RevealSpecificKeyLinkage mock not implemented")
192192
}
193193

194-
func (m *MockWallet) CreateHmac(ctx context.Context, args CreateHmacArgs, originator string) (*CreateHmacResult, error) {
195-
if m.MockCreateHmac != nil {
196-
return m.MockCreateHmac(ctx, args, originator)
194+
func (m *MockWallet) CreateHMAC(ctx context.Context, args CreateHMACArgs, originator string) (*CreateHMACResult, error) {
195+
if m.MockCreateHMAC != nil {
196+
return m.MockCreateHMAC(ctx, args, originator)
197197
}
198-
if m.CreateHmacResult == nil {
199-
require.Fail(m.T, "CreateHmac mock called but CreateHmacResult not set")
200-
return nil, errors.New("CreateHmac mock result not configured")
198+
if m.CreateHMACResult == nil {
199+
require.Fail(m.T, "CreateHMAC mock called but CreateHMACResult not set")
200+
return nil, errors.New("CreateHMAC mock result not configured")
201201
}
202-
if m.CreateHmacError != nil {
203-
return nil, m.CreateHmacError
202+
if m.CreateHMACError != nil {
203+
return nil, m.CreateHMACError
204204
}
205-
return m.CreateHmacResult, nil
205+
return m.CreateHMACResult, nil
206206
}
207207

208-
func (m *MockWallet) VerifyHmac(ctx context.Context, args VerifyHmacArgs, originator string) (*VerifyHmacResult, error) {
209-
require.Fail(m.T, "VerifyHmac mock not implemented")
210-
return nil, errors.New("VerifyHmac mock not implemented")
208+
func (m *MockWallet) VerifyHMAC(ctx context.Context, args VerifyHMACArgs, originator string) (*VerifyHMACResult, error) {
209+
require.Fail(m.T, "VerifyHMAC mock not implemented")
210+
return nil, errors.New("VerifyHMAC mock not implemented")
211211
}
212212

213213
func (m *MockWallet) VerifySignature(ctx context.Context, args VerifySignatureArgs, originator string) (*VerifySignatureResult, error) {

wallet/proto_wallet.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -277,13 +277,13 @@ func (p *ProtoWallet) VerifySignature(
277277
}, nil
278278
}
279279

280-
// CreateHmac generates an HMAC (Hash-based Message Authentication Code) for the provided data
280+
// CreateHMAC generates an HMAC (Hash-based Message Authentication Code) for the provided data
281281
// using a symmetric key derived from the protocol, key ID, and counterparty.
282-
func (p *ProtoWallet) CreateHmac(
282+
func (p *ProtoWallet) CreateHMAC(
283283
ctx context.Context,
284-
args CreateHmacArgs,
284+
args CreateHMACArgs,
285285
originator string,
286-
) (*CreateHmacResult, error) {
286+
) (*CreateHMACResult, error) {
287287
if p.keyDeriver == nil {
288288
return nil, errors.New("keyDeriver is undefined")
289289
}
@@ -311,16 +311,16 @@ func (p *ProtoWallet) CreateHmac(
311311
mac.Write(args.Data)
312312
hmacValue := mac.Sum(nil)
313313

314-
return &CreateHmacResult{Hmac: hmacValue}, nil
314+
return &CreateHMACResult{HMAC: hmacValue}, nil
315315
}
316316

317-
// VerifyHmac verifies that the provided HMAC matches the expected value for the given data.
317+
// VerifyHMAC verifies that the provided HMAC matches the expected value for the given data.
318318
// The verification uses the same protocol, key ID, and counterparty that were used to create the HMAC.
319-
func (p *ProtoWallet) VerifyHmac(
319+
func (p *ProtoWallet) VerifyHMAC(
320320
ctx context.Context,
321-
args VerifyHmacArgs,
321+
args VerifyHMACArgs,
322322
originator string,
323-
) (*VerifyHmacResult, error) {
323+
) (*VerifyHMACResult, error) {
324324
if p.keyDeriver == nil {
325325
return nil, errors.New("keyDeriver is undefined")
326326
}
@@ -346,12 +346,12 @@ func (p *ProtoWallet) VerifyHmac(
346346
// Create expected HMAC
347347
mac := hmac.New(sha256.New, key.ToBytes())
348348
mac.Write(args.Data)
349-
expectedHmac := mac.Sum(nil)
349+
expectedHMAC := mac.Sum(nil)
350350

351351
// Verify HMAC
352-
if !hmac.Equal(expectedHmac, args.Hmac) {
353-
return &VerifyHmacResult{Valid: false}, nil
352+
if !hmac.Equal(expectedHMAC, args.HMAC) {
353+
return &VerifyHMACResult{Valid: false}, nil
354354
}
355355

356-
return &VerifyHmacResult{Valid: true}, nil
356+
return &VerifyHMACResult{Valid: true}, nil
357357
}

wallet/serializer/create_hmac.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/bsv-blockchain/go-sdk/wallet"
88
)
99

10-
func SerializeCreateHmacArgs(args *wallet.CreateHmacArgs) ([]byte, error) {
10+
func SerializeCreateHMACArgs(args *wallet.CreateHMACArgs) ([]byte, error) {
1111
w := util.NewWriter()
1212

1313
// Encode key related params (protocol, key, counterparty, privileged)
@@ -34,9 +34,9 @@ func SerializeCreateHmacArgs(args *wallet.CreateHmacArgs) ([]byte, error) {
3434
return w.Buf, nil
3535
}
3636

37-
func DeserializeCreateHmacArgs(data []byte) (*wallet.CreateHmacArgs, error) {
37+
func DeserializeCreateHMACArgs(data []byte) (*wallet.CreateHMACArgs, error) {
3838
r := util.NewReaderHoldError(data)
39-
args := &wallet.CreateHmacArgs{}
39+
args := &wallet.CreateHMACArgs{}
4040

4141
// Decode key related params
4242
params, err := decodeKeyRelatedParams(r)
@@ -58,34 +58,34 @@ func DeserializeCreateHmacArgs(data []byte) (*wallet.CreateHmacArgs, error) {
5858

5959
r.CheckComplete()
6060
if r.Err != nil {
61-
return nil, fmt.Errorf("error deserializing CreateHmac args: %w", r.Err)
61+
return nil, fmt.Errorf("error deserializing CreateHMAC args: %w", r.Err)
6262
}
6363

6464
return args, nil
6565
}
6666

67-
func SerializeCreateHmacResult(result *wallet.CreateHmacResult) ([]byte, error) {
67+
func SerializeCreateHMACResult(result *wallet.CreateHMACResult) ([]byte, error) {
6868
w := util.NewWriter()
6969
w.WriteByte(0) // errorByte = 0 (success)
70-
w.WriteBytes(result.Hmac)
70+
w.WriteBytes(result.HMAC)
7171
return w.Buf, nil
7272
}
7373

74-
func DeserializeCreateHmacResult(data []byte) (*wallet.CreateHmacResult, error) {
74+
func DeserializeCreateHMACResult(data []byte) (*wallet.CreateHMACResult, error) {
7575
r := util.NewReaderHoldError(data)
76-
result := &wallet.CreateHmacResult{}
76+
result := &wallet.CreateHMACResult{}
7777

7878
// Read error byte (0 = success)
7979
errorByte := r.ReadByte()
8080
if errorByte != 0 {
81-
return nil, fmt.Errorf("createHmac failed with error byte %d", errorByte)
81+
return nil, fmt.Errorf("createHMAC failed with error byte %d", errorByte)
8282
}
8383

8484
// Read hmac (remaining bytes)
85-
result.Hmac = r.ReadRemaining()
85+
result.HMAC = r.ReadRemaining()
8686

8787
if r.Err != nil {
88-
return nil, fmt.Errorf("error deserializing CreateHmac result: %w", r.Err)
88+
return nil, fmt.Errorf("error deserializing CreateHMAC result: %w", r.Err)
8989
}
9090

9191
return result, nil

0 commit comments

Comments
 (0)