@@ -2,7 +2,6 @@ package utils
22
33import (
44 "context"
5- "slices"
65 "testing"
76
87 "github.com/bsv-blockchain/go-sdk/auth/certificates"
@@ -38,7 +37,7 @@ func TestValidateCertificatesFunctionality(t *testing.T) {
3837 require .NoError (t , err )
3938 differentSubjectKey := differentSubject .PubKey ()
4039
41- anyCertifier := wallet . PubKey ( tu .GetByte33FromString ("any" ) )
40+ anyCertifier := tu .GetPKFromString ("any" )
4241
4342 var requestedType [32 ]byte
4443 copy (requestedType [:], "requested_type" )
@@ -95,36 +94,34 @@ func TestValidateCertificatesFunctionality(t *testing.T) {
9594 t .Run ("throws an error for unrequested certifier" , func (t * testing.T ) {
9695 // Create certificate request with different certifier
9796 certificatesRequested := & RequestedCertificateSet {
98- Certifiers : []wallet. PubKey {tu .GetByte33FromString ("another_certifier" )}, // Different from certifierHex
97+ Certifiers : []* ec. PublicKey {tu .GetPKFromString ("another_certifier" )},
9998 CertificateTypes : RequestedCertificateTypeIDAndFieldList {
10099 requestedType : []string {"field1" },
101100 },
102101 }
103102
104103 // Check certifier match logic
105- var certifierKey wallet.PubKey
106- copy (certifierKey [:], validCertifierKey .ToDER ())
107- assert .False (t , slices .Contains (certificatesRequested .Certifiers , certifierKey ))
104+ assert .False (t , CertifierInSlice (certificatesRequested .Certifiers , validCertifierKey ))
108105 // The logic in ValidateCertificates would have raised an error here
109106 })
110107
111108 t .Run ("accepts 'any' as a certifier match" , func (t * testing.T ) {
112109 // Create certificate request with "any" certifier
113110 certificatesRequested := & RequestedCertificateSet {
114- Certifiers : []wallet. PubKey {anyCertifier },
111+ Certifiers : []* ec. PublicKey {anyCertifier },
115112 CertificateTypes : RequestedCertificateTypeIDAndFieldList {
116113 requestedType : []string {"field1" },
117114 },
118115 }
119116
120117 // "any" should match any certifier value
121- assert .True (t , slices . Contains (certificatesRequested .Certifiers , anyCertifier ))
118+ assert .True (t , CertifierInSlice (certificatesRequested .Certifiers , anyCertifier ))
122119 })
123120
124121 t .Run ("throws an error for unrequested certificate type" , func (t * testing.T ) {
125122 // Create certificate request with different type
126123 certificatesRequested := & RequestedCertificateSet {
127- Certifiers : []wallet. PubKey {anyCertifier },
124+ Certifiers : []* ec. PublicKey {anyCertifier },
128125 CertificateTypes : RequestedCertificateTypeIDAndFieldList {
129126 anotherType : []string {"field1" }, // Different from "requested_type"
130127 },
@@ -138,7 +135,7 @@ func TestValidateCertificatesFunctionality(t *testing.T) {
138135 t .Run ("validate certificates request set validation" , func (t * testing.T ) {
139136 // Test empty certifiers
140137 req := & RequestedCertificateSet {
141- Certifiers : []wallet. PubKey {},
138+ Certifiers : []* ec. PublicKey {},
142139 CertificateTypes : RequestedCertificateTypeIDAndFieldList {
143140 type1 : []string {"field1" },
144141 },
@@ -149,7 +146,7 @@ func TestValidateCertificatesFunctionality(t *testing.T) {
149146
150147 // Test empty types
151148 req = & RequestedCertificateSet {
152- Certifiers : []wallet. PubKey {tu .GetByte33FromString ("certifier1" )},
149+ Certifiers : []* ec. PublicKey {tu .GetPKFromString ("certifier1" )},
153150 CertificateTypes : RequestedCertificateTypeIDAndFieldList {},
154151 }
155152 err = ValidateRequestedCertificateSet (req )
@@ -158,7 +155,7 @@ func TestValidateCertificatesFunctionality(t *testing.T) {
158155
159156 // Test empty type name
160157 req = & RequestedCertificateSet {
161- Certifiers : []wallet. PubKey {tu .GetByte33FromString ("certifier1" )},
158+ Certifiers : []* ec. PublicKey {tu .GetPKFromString ("certifier1" )},
162159 CertificateTypes : RequestedCertificateTypeIDAndFieldList {
163160 [32 ]byte {}: []string {"field1" },
164161 },
@@ -169,7 +166,7 @@ func TestValidateCertificatesFunctionality(t *testing.T) {
169166
170167 // Test empty fields
171168 req = & RequestedCertificateSet {
172- Certifiers : []wallet. PubKey {tu .GetByte33FromString ("certifier1" )},
169+ Certifiers : []* ec. PublicKey {tu .GetPKFromString ("certifier1" )},
173170 CertificateTypes : RequestedCertificateTypeIDAndFieldList {
174171 type1 : []string {},
175172 },
@@ -180,7 +177,7 @@ func TestValidateCertificatesFunctionality(t *testing.T) {
180177
181178 // Test valid request
182179 req = & RequestedCertificateSet {
183- Certifiers : []wallet. PubKey {tu .GetByte33FromString ("certifier1" )},
180+ Certifiers : []* ec. PublicKey {tu .GetPKFromString ("certifier1" )},
184181 CertificateTypes : RequestedCertificateTypeIDAndFieldList {
185182 type1 : []string {"field1" },
186183 },
0 commit comments