mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-07-09 19:46:58 +00:00
feat(rpc): add rpcs
This commit is contained in:
parent
cdafaa90db
commit
f31b32c54a
15 changed files with 516 additions and 0 deletions
29
src/rpc/auth/BUILD.bazel
Normal file
29
src/rpc/auth/BUILD.bazel
Normal file
|
@ -0,0 +1,29 @@
|
|||
load("@rules_proto//proto:defs.bzl", "proto_library")
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
|
||||
load("@rules_typescript_proto//:index.bzl", "typescript_proto_library")
|
||||
|
||||
proto_library(
|
||||
name = "auth_proto",
|
||||
srcs = ["shared.proto"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
go_proto_library(
|
||||
name = "auth_go_proto",
|
||||
importpath = "github.com/roleypoly/roleypoly/src/rpc/auth",
|
||||
proto = ":auth_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "auth",
|
||||
embed = [":auth_go_proto"],
|
||||
importpath = "github.com/roleypoly/roleypoly/src/rpc/auth",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
typescript_proto_library(
|
||||
name = "ts",
|
||||
proto = ":auth_proto",
|
||||
)
|
38
src/rpc/auth/backend/BUILD.bazel
Normal file
38
src/rpc/auth/backend/BUILD.bazel
Normal file
|
@ -0,0 +1,38 @@
|
|||
load("@rules_proto//proto:defs.bzl", "proto_library")
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
|
||||
load("@rules_typescript_proto//:index.bzl", "typescript_proto_library")
|
||||
|
||||
proto_library(
|
||||
name = "backend_proto",
|
||||
srcs = ["auth-backend.proto"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//src/rpc/auth:auth_proto",
|
||||
"//src/rpc/shared:shared_proto",
|
||||
],
|
||||
)
|
||||
|
||||
go_proto_library(
|
||||
name = "backend_go_proto",
|
||||
compilers = ["@io_bazel_rules_go//proto:go_grpc"],
|
||||
importpath = "github.com/roleypoly/roleypoly/src/rpc/auth/backend",
|
||||
proto = ":backend_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//src/rpc/auth",
|
||||
"//src/rpc/shared",
|
||||
],
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "backend",
|
||||
embed = [":backend_go_proto"],
|
||||
importpath = "github.com/roleypoly/roleypoly/src/rpc/auth/backend",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
typescript_proto_library(
|
||||
name = "ts",
|
||||
proto = ":backend_proto",
|
||||
)
|
13
src/rpc/auth/backend/auth-backend.proto
Normal file
13
src/rpc/auth/backend/auth-backend.proto
Normal file
|
@ -0,0 +1,13 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package roleypoly.auth.backend;
|
||||
option go_package = "github.com/roleypoly/roleypoly/src/rpc/auth/backend";
|
||||
|
||||
import "src/rpc/shared/internal.proto";
|
||||
import "src/rpc/shared/shared.proto";
|
||||
import "src/rpc/auth/shared.proto";
|
||||
|
||||
service AuthBackend {
|
||||
rpc GetNewAuthChallenge(roleypoly.IDQuery) returns (roleypoly.auth.AuthChallenge) {}
|
||||
rpc GetSession(roleypoly.auth.Token) returns (roleypoly.RoleypolySession) {}
|
||||
}
|
39
src/rpc/auth/client/BUILD.bazel
Normal file
39
src/rpc/auth/client/BUILD.bazel
Normal file
|
@ -0,0 +1,39 @@
|
|||
load("@rules_proto//proto:defs.bzl", "proto_library")
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
|
||||
load("@rules_typescript_proto//:index.bzl", "typescript_proto_library")
|
||||
|
||||
proto_library(
|
||||
name = "client_proto",
|
||||
srcs = ["auth-client.proto"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//src/rpc/auth:auth_proto",
|
||||
"//src/rpc/shared:shared_proto",
|
||||
"@com_google_protobuf//:empty_proto",
|
||||
],
|
||||
)
|
||||
|
||||
go_proto_library(
|
||||
name = "client_go_proto",
|
||||
compilers = ["@io_bazel_rules_go//proto:go_grpc"],
|
||||
importpath = "github.com/roleypoly/roleypoly/src/auth/client",
|
||||
proto = ":client_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//src/rpc/auth",
|
||||
"//src/rpc/shared",
|
||||
],
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "client",
|
||||
embed = [":client_go_proto"],
|
||||
importpath = "github.com/roleypoly/roleypoly/src/auth/client",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
typescript_proto_library(
|
||||
name = "ts",
|
||||
proto = ":client_proto",
|
||||
)
|
15
src/rpc/auth/client/auth-client.proto
Normal file
15
src/rpc/auth/client/auth-client.proto
Normal file
|
@ -0,0 +1,15 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package roleypoly.auth.client;
|
||||
option go_package = "github.com/roleypoly/roleypoly/src/auth/client";
|
||||
|
||||
import "src/rpc/shared/internal.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "src/rpc/auth/shared.proto";
|
||||
|
||||
service AuthClient {
|
||||
rpc GetClientToken(google.protobuf.Empty) returns (roleypoly.auth.Token) {}
|
||||
rpc GetUserSession(google.protobuf.Empty) returns (roleypoly.RoleypolySession) {}
|
||||
rpc ResolveSessionKey(roleypoly.auth.Token) returns (roleypoly.auth.Token) {}
|
||||
rpc AuthorizeChallenge(roleypoly.auth.AuthChallenge) returns (roleypoly.auth.Token) {}
|
||||
}
|
22
src/rpc/auth/shared.proto
Normal file
22
src/rpc/auth/shared.proto
Normal file
|
@ -0,0 +1,22 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package roleypoly.auth;
|
||||
option go_package = "github.com/roleypoly/roleypoly/src/rpc/auth";
|
||||
|
||||
message Token {
|
||||
string token = 1;
|
||||
Type type = 2;
|
||||
string state = 3;
|
||||
|
||||
enum Type {
|
||||
unknown = 0;
|
||||
sessionKey = 1;
|
||||
clientToken = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message AuthChallenge {
|
||||
string userID = 1;
|
||||
string magicUrl = 2;
|
||||
string magicWords = 3;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue