Skip to content

Commit 98fa352

Browse files
jakubmkowalskidorzepowskigithub-actions[bot]
authored
fix: integrate ts client with go middleware (#118)
Co-authored-by: Damian Orzepowski <damian.orzepowski@4chain.studio> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 388fdee commit 98fa352

File tree

23 files changed

+2363
-2071
lines changed

23 files changed

+2363
-2071
lines changed

examples/auth/basic/auth.go

Lines changed: 486 additions & 484 deletions
Large diffs are not rendered by default.

examples/auth/certificate/certificate.go

Lines changed: 493 additions & 481 deletions
Large diffs are not rendered by default.

examples/example-wallet/example_wallet.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,27 +80,20 @@ func (w *ExtendedProtoWallet) RevealSpecificKeyLinkage(ctx context.Context, args
8080

8181
// Certificate methods - implement basic functionality for demo
8282
func (w *ExtendedProtoWallet) AcquireCertificate(ctx context.Context, args wallet.AcquireCertificateArgs, originator string) (*wallet.Certificate, error) {
83-
if args.Type == "" || args.Certifier == "" {
83+
if len(args.Type) == 0 || args.Certifier == nil {
8484
return nil, fmt.Errorf("certificate type and certifier are required")
8585
}
8686

87-
// Get our identity key for the subject
8887
identityResult, err := w.GetPublicKey(ctx, wallet.GetPublicKeyArgs{IdentityKey: true}, originator)
8988
if err != nil {
9089
return nil, err
9190
}
9291

93-
// Parse certifier key
94-
certifierKey, err := ec.PublicKeyFromString(args.Certifier)
95-
if err != nil {
96-
return nil, err
97-
}
98-
9992
return &wallet.Certificate{
10093
Type: args.Type,
10194
SerialNumber: args.SerialNumber,
10295
Subject: identityResult.PublicKey,
103-
Certifier: certifierKey,
96+
Certifier: args.Certifier,
10497
RevocationOutpoint: args.RevocationOutpoint,
10598
Fields: args.Fields,
10699
Signature: args.Signature,
@@ -116,7 +109,7 @@ func (w *ExtendedProtoWallet) ListCertificates(ctx context.Context, args wallet.
116109
}
117110

118111
func (w *ExtendedProtoWallet) ProveCertificate(ctx context.Context, args wallet.ProveCertificateArgs, originator string) (*wallet.ProveCertificateResult, error) {
119-
if args.Certificate.Type == "" {
112+
if len(args.Certificate.Type) == 0 {
120113
return nil, fmt.Errorf("certificate type is required")
121114
}
122115

@@ -164,7 +157,7 @@ func (w *ExtendedProtoWallet) GetHeight(ctx context.Context, args any, originato
164157
}
165158

166159
func (w *ExtendedProtoWallet) GetHeaderForHeight(ctx context.Context, args wallet.GetHeaderArgs, originator string) (*wallet.GetHeaderResult, error) {
167-
return &wallet.GetHeaderResult{Header: "mock-header"}, nil
160+
return &wallet.GetHeaderResult{Header: []byte("mock-header")}, nil
168161
}
169162

170163
func (w *ExtendedProtoWallet) GetNetwork(ctx context.Context, args any, originator string) (*wallet.GetNetworkResult, error) {

examples/go.mod

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
11
module github.com/bsv-blockchain/go-bsv-middleware-examples
22

3-
go 1.24.0
3+
go 1.24.3
44

5-
require (
6-
github.com/bsv-blockchain/go-bsv-middleware v0.4.0
7-
github.com/bsv-blockchain/go-sdk v1.1.23
8-
github.com/go-resty/resty/v2 v2.16.5
9-
)
5+
require github.com/bsv-blockchain/go-sdk v1.2.1
106

117
require (
128
github.com/davecgh/go-spew v1.1.1 // indirect
139
github.com/pkg/errors v0.9.1 // indirect
1410
github.com/pmezard/go-difflib v1.0.0 // indirect
1511
github.com/stretchr/testify v1.10.0 // indirect
16-
golang.org/x/crypto v0.37.0 // indirect
17-
golang.org/x/net v0.39.0 // indirect
12+
golang.org/x/crypto v0.39.0 // indirect
1813
gopkg.in/yaml.v3 v3.0.1 // indirect
1914
)
2015

2116
// TODO: remove this when the module is published
2217
// Temporary until we publish the module in stable version
2318
replace github.com/bsv-blockchain/go-bsv-middleware => ../
24-
25-
replace github.com/bsv-blockchain/go-sdk => github.com/b-open-io/go-sdk v1.1.25-0.20250512182945-5fe49978cd05

examples/go.sum

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
github.com/b-open-io/go-sdk v1.1.25-0.20250512182945-5fe49978cd05 h1:2+YBTMU4J2Aq9YPJPx49BE8D+HHeY0sCsBxEOW1vwZ8=
2-
github.com/b-open-io/go-sdk v1.1.25-0.20250512182945-5fe49978cd05/go.mod h1:QdZvqgc69LQpnKUjejyUCFgbPeJcdJa0r6ptr4j7DCY=
1+
github.com/bsv-blockchain/go-sdk v1.2.1 h1:yQXHpHPIxoyvU+DERzaSuUEQF/ejVjcsdPhNV+z8OTI=
2+
github.com/bsv-blockchain/go-sdk v1.2.1/go.mod h1:v//5tDobbCNhhZvHlEyP8SvuE+N3UFpWToH0+lOw9QM=
33
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
44
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5-
github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM=
6-
github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA=
75
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
86
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
97
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
108
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
119
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
1210
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
13-
golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE=
14-
golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
15-
golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY=
16-
golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E=
17-
golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U=
18-
golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
11+
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
12+
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
1913
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
2014
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
2115
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

0 commit comments

Comments
 (0)