Support macaroons and TLS && Add arkd wallet cmds (#232)

* Update protos

* Update handlers

* Support macaroons and TLS

* Add arkd cli

* Minor fixes

* Update deps

* Fixes

* Update makefile

* Fixes

* Fix

* Fix

* Fix

* Remove trusted onboarding from client

* Completely remove trusted onboarding

* Fix compose files and add --no-macaroon flag to arkd cli

* Lint

* Remove e2e for trusted onboarding

* Add sleep time
This commit is contained in:
Pietralberto Mazza
2024-08-09 17:59:31 +02:00
committed by GitHub
parent 059e837794
commit 57ce08f239
105 changed files with 12111 additions and 1617 deletions

View File

@@ -0,0 +1,48 @@
package permissions_test
import (
"fmt"
"testing"
grpchealth "google.golang.org/grpc/health/grpc_health_v1"
"github.com/ark-network/ark/internal/interface/grpc/permissions"
"github.com/stretchr/testify/require"
arkv1 "github.com/ark-network/ark/api-spec/protobuf/gen/ark/v1"
)
func TestRestrictedMethods(t *testing.T) {
allMethods := make([]string, 0)
for _, m := range arkv1.AdminService_ServiceDesc.Methods {
allMethods = append(allMethods, fmt.Sprintf("/%s/%s", arkv1.AdminService_ServiceDesc.ServiceName, m.MethodName))
}
for _, m := range arkv1.WalletService_ServiceDesc.Methods {
allMethods = append(allMethods, fmt.Sprintf("/%s/%s", arkv1.WalletService_ServiceDesc.ServiceName, m.MethodName))
}
allPermissions := permissions.AllPermissionsByMethod()
for _, method := range allMethods {
_, ok := allPermissions[method]
require.True(t, ok, fmt.Sprintf("missing permission for %s", method))
}
}
func TestWhitelistedMethods(t *testing.T) {
allMethods := make([]string, 0)
for _, m := range arkv1.ArkService_ServiceDesc.Methods {
allMethods = append(allMethods, fmt.Sprintf("/%s/%s", arkv1.ArkService_ServiceDesc.ServiceName, m.MethodName))
}
for _, v := range arkv1.WalletInitializerService_ServiceDesc.Methods {
allMethods = append(allMethods, fmt.Sprintf("/%s/%s", arkv1.WalletInitializerService_ServiceDesc.ServiceName, v.MethodName))
}
allMethods = append(allMethods, fmt.Sprintf("/%s/%s", grpchealth.Health_ServiceDesc.ServiceName, "Check"))
whitelist := permissions.Whitelist()
for _, m := range allMethods {
_, ok := whitelist[m]
require.True(t, ok, fmt.Sprintf("missing %s in whitelist", m))
}
}