Skip to content

Commit 4b5d98d

Browse files
Refactor proto fixes (#219)
1 parent 0a318af commit 4b5d98d

16 files changed

Lines changed: 1223 additions & 1172 deletions

devops/CompileProtoFiles.ps1

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,15 @@ function Remove-Protofiles($protoPath)
2626

2727
function Update-Golang()
2828
{
29-
$GoPath = "../go/okapi_proto"
29+
$GoPath = "../go/okapi/proto"
3030
Remove-Protofiles($GoPath)
3131
protoc $( Get-ProtoPath ) `
3232
--go_out="$GoPath" `
3333
--go-grpc_out="$GoPath" `
34-
'--go_opt=paths=source_relative' `
35-
'--go-grpc_opt=paths=source_relative' `
34+
'--go_opt=module=github.com/trinsic-id/okapi' `
35+
'--go-grpc_opt=module=github.com/trinsic-id/okapi' `
3636
$( Get-ProtoFiles )
37-
38-
# flatten hierarchy
39-
Copy-Item -Path "$GoPath/pbmse/*" -Destination "$GoPath" -recurse -Force
40-
Remove-Item -Path "$GoPath/pbmse" -Force -Recurse
37+
Remove-Item "$GoPath/examples_grpc.pb.go"
4138
}
4239

4340
function Set-Require-Relative($filename)

go/okapi/DidComm.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package okapi
22

3-
import "github.com/trinsic-id/okapi/go/okapi_proto"
3+
import (
4+
okapi "github.com/trinsic-id/okapi/go/okapi/proto"
5+
)
46

57
type DidComm struct{}
68
type DidCommer interface {

go/okapi/DidKey.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package okapi
22

3-
import "github.com/trinsic-id/okapi/go/okapi_proto"
3+
import (
4+
okapi "github.com/trinsic-id/okapi/go/okapi/proto"
5+
)
46

57
type DidKey struct {}
68
type DidKeyer interface {

go/okapi/LdProofs.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package okapi
22

3-
import "github.com/trinsic-id/okapi/go/okapi_proto"
3+
import (
4+
okapi "github.com/trinsic-id/okapi/go/okapi/proto"
5+
)
46

57
type LdProofs struct {}
68
type LdProofer interface {

go/okapi/Oberon.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package okapi
22

3-
import okapi "github.com/trinsic-id/okapi/go/okapi_proto"
3+
import okapi "github.com/trinsic-id/okapi/go/okapi/proto"
44

55
type Oberon struct{}
66
type Oberoner interface {

go/okapi/didkey_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ import (
66
"fmt"
77
"github.com/btcsuite/btcutil/base58"
88
"github.com/stretchr/testify/assert"
9-
"github.com/trinsic-id/okapi/go/okapi_proto"
9+
okapi "github.com/trinsic-id/okapi/go/okapi/proto"
10+
1011
"testing"
1112
)
1213

1314
func TestGenerateKey(t *testing.T) {
1415
request := okapi.GenerateKeyRequest{}
15-
request.KeyType = okapi.KeyType_Ed25519
16+
request.KeyType = okapi.KeyType_KEY_TYPE_ED25519
1617
request.Seed = []byte{1, 2, 3}
1718

1819
response, err := DidKey{}.Generate(&request)
@@ -23,7 +24,7 @@ func TestGenerateKey(t *testing.T) {
2324

2425
func TestGenerateKeyNoSeed(t *testing.T) {
2526
request := okapi.GenerateKeyRequest{}
26-
request.KeyType = okapi.KeyType_Ed25519
27+
request.KeyType = okapi.KeyType_KEY_TYPE_ED25519
2728
response, err := DidKey{}.Generate(&request)
2829
assert.Nil(t, err)
2930
assertValidKeyGenerated(t, response)
@@ -54,10 +55,10 @@ type DataArgument struct {
5455
}
5556

5657
func TestGenerateKeyFromSeed(t *testing.T) {
57-
dataArguments := []DataArgument{{keyType: okapi.KeyType_Ed25519, keyTypeString: "Ed25519",
58+
dataArguments := []DataArgument{{keyType: okapi.KeyType_KEY_TYPE_ED25519, keyTypeString: "Ed25519",
5859
seed: "4f66b355aa7b0980ff901f2295b9c562ac3061be4df86703eb28c612faae6578",
5960
response: "6fioC1zcDPyPEL19pXRS2E4iJ46zH7xP6uSgAaPdwDrx"},
60-
{keyType: okapi.KeyType_X25519, keyTypeString: "X25519",
61+
{keyType: okapi.KeyType_KEY_TYPE_X25519, keyTypeString: "X25519",
6162
seed: "9b29d42b38ddd52ed39c0ff70b39572a6eb9b3cac201918dc6d6a84b4c88d2a5",
6263
response: "3EK9AYXoUV4Unn5AjvYY39hyK91n7gg4ExC8rKKSUQXJ"},
6364
}

go/okapi/ldproofs_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package okapi
22

33
import (
44
"github.com/stretchr/testify/assert"
5-
"github.com/trinsic-id/okapi/go/okapi_proto"
5+
okapi "github.com/trinsic-id/okapi/go/okapi/proto"
66
"google.golang.org/protobuf/types/known/structpb"
77
"log"
88
"testing"
@@ -18,7 +18,7 @@ func TestGenerateCapabilityInvocationProofWithJCS(t *testing.T) {
1818
},
1919
})
2020

21-
request := okapi.GenerateKeyRequest{KeyType: okapi.KeyType_Ed25519}
21+
request := okapi.GenerateKeyRequest{KeyType: okapi.KeyType_KEY_TYPE_ED25519}
2222
response, err := DidKey{}.Generate(&request)
2323
if err != nil {
2424
log.Fatalln(err)
@@ -33,7 +33,7 @@ func TestGenerateCapabilityInvocationProofWithJCS(t *testing.T) {
3333
signedCapability, err2 := LdProofs{}.CreateProof(&okapi.CreateProofRequest{
3434
Document: proofStruct,
3535
Key: signingKey,
36-
Suite: okapi.LdSuite_JcsEd25519Signature2020,
36+
Suite: okapi.LdSuite_LD_SUITE_JCSED25519SIGNATURE2020,
3737
})
3838
if err2 != nil {
3939
log.Fatalln(err2)

go/okapi/oberon_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package okapi
22

33
import (
44
"github.com/stretchr/testify/assert"
5-
"github.com/trinsic-id/okapi/go/okapi_proto"
5+
okapi "github.com/trinsic-id/okapi/go/okapi/proto"
66
"testing"
77
)
88

go/okapi/proto/examples.pb.go

Lines changed: 165 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)