Commit f567bb01 authored by Andrei Mihu's avatar Andrei Mihu
Browse files

Add extended wallet functions to Lua runtime. (#183)

parent 5fd576fc
Loading
Loading
Loading
Loading
+40 −40
Original line number Diff line number Diff line
@@ -314,44 +314,44 @@ var _Console_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("console/console.proto", fileDescriptor0) }

var fileDescriptor0 = []byte{
	// 616 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x41, 0x4f, 0xd4, 0x40,
	0x14, 0xc7, 0xb3, 0x45, 0x58, 0x1d, 0xb2, 0x04, 0x07, 0x90, 0xb2, 0x48, 0xa8, 0xc5, 0x18, 0xdc,
	0x40, 0xc7, 0x94, 0x1b, 0x07, 0xe3, 0x82, 0x68, 0x48, 0x14, 0x4d, 0xf1, 0xe4, 0xc5, 0x74, 0xdb,
	0x47, 0xb7, 0xd0, 0x9d, 0x57, 0x66, 0xa6, 0xa0, 0x31, 0x5c, 0x3c, 0x7b, 0xd2, 0xcf, 0xe5, 0xc9,
	0xaf, 0xe0, 0xc9, 0x2f, 0xe0, 0xd5, 0xb4, 0x33, 0xc5, 0xc2, 0x46, 0xe3, 0x61, 0xd3, 0xcc, 0xfc,
	0x7f, 0xff, 0xf7, 0xde, 0xcc, 0xfe, 0x87, 0x2c, 0x44, 0xc8, 0x25, 0x66, 0xc0, 0xcc, 0xd7, 0xcb,
	0x05, 0x2a, 0xa4, 0x33, 0x3c, 0x3c, 0x09, 0x47, 0xa1, 0x67, 0x76, 0xbb, 0xbd, 0x24, 0x55, 0xc3,
	0x62, 0xe0, 0x45, 0x38, 0x62, 0x43, 0x10, 0x98, 0x46, 0x59, 0x38, 0x90, 0x4c, 0x53, 0x2c, 0xcc,
	0xd3, 0xf2, 0xa7, 0xbd, 0xdd, 0xbb, 0x09, 0x62, 0x92, 0x81, 0xde, 0xe5, 0x1c, 0x55, 0xa8, 0x52,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 0x8c, 0x58,
	0xf6, 0x47, 0x21, 0x9d, 0x07, 0xce, 0x2e, 0x72, 0x25, 0xd2, 0x41, 0xa1, 0x50, 0x48, 0x7a, 0x7f,
	0xa8, 0x54, 0x2e, 0xb7, 0x19, 0xfb, 0xd7, 0xa3, 0xee, 0xce, 0x0f, 0x21, 0xcb, 0xf0, 0xc9, 0x1f,
	0xa1, 0xe4, 0xfc, 0x09, 0xdf, 0x7b, 0xd4, 0x6b, 0xb5, 0xfc, 0xd9, 0x30, 0xcf, 0x33, 0x13, 0x3d,
	0x76, 0x2c, 0x91, 0x6f, 0x8f, 0xed, 0x88, 0x1d, 0xb2, 0x66, 0x06, 0x91, 0x20, 0xce, 0x40, 0x5c,
	0x0e, 0x1b, 0x63, 0x54, 0x8c, 0x80, 0xeb, 0xd7, 0x4c, 0x97, 0xeb, 0x71, 0xae, 0xb6, 0x62, 0x31,
	0x46, 0xf2, 0x6d, 0xdb, 0x78, 0x06, 0x53, 0x55, 0x04, 0xb6, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff,
	0xba, 0xdd, 0x43, 0x43, 0xb1, 0x04, 0x00, 0x00,
	// 618 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xc1, 0x4f, 0xd4, 0x4e,
	0x14, 0xc7, 0xd3, 0xf2, 0x83, 0xfd, 0x39, 0x64, 0x09, 0x0e, 0xa0, 0xb5, 0x48, 0x28, 0xc5, 0x28,
	0x6e, 0xa0, 0x63, 0xca, 0x8d, 0x83, 0x71, 0x41, 0x34, 0x24, 0x8a, 0xa6, 0x78, 0xf2, 0x62, 0xba,
	0xed, 0xa3, 0x5b, 0xe8, 0xce, 0xab, 0x33, 0xd3, 0x45, 0x62, 0xb8, 0x78, 0xf6, 0xa4, 0x7f, 0x9a,
	0x67, 0x6f, 0x9e, 0xfc, 0x07, 0xbc, 0x9a, 0xb6, 0x53, 0xdc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f7, 0x41, 0xd5, 0x73, 0x8d, 0xae,
	0x5e, 0xd7, 0x93, 0x41, 0x1d, 0xc2, 0x13, 0x32, 0xfd, 0x02, 0x93, 0x94, 0xd3, 0xf5, 0x89, 0x82,
	0x93, 0x57, 0x6f, 0xdf, 0xbe, 0x0a, 0xe9, 0x0b, 0x75, 0xd7, 0xab, 0x7e, 0x2b, 0xee, 0xf8, 0x19,
	0x47, 0x2a, 0xec, 0x18, 0x9d, 0xdd, 0x5f, 0xc6, 0x97, 0xee, 0x4f, 0x83, 0x5e, 0x90, 0xa5, 0xc3,
	0xaa, 0x8a, 0xa3, 0x41, 0xa7, 0xfb, 0xfa, 0xc0, 0x19, 0xfa, 0xee, 0x3b, 0xb2, 0xf6, 0xa6, 0x0f,
	0x8e, 0x16, 0xcb, 0xfe, 0x28, 0xa4, 0x73, 0xdf, 0xd9, 0x43, 0xae, 0x44, 0xda, 0x2b, 0x14, 0x0a,
	0x49, 0xef, 0xf5, 0x95, 0xca, 0xe5, 0x0e, 0x63, 0x7f, 0x7b, 0xe4, 0xf6, 0x62, 0x1f, 0xb2, 0x0c,
	0x9f, 0xfc, 0x11, 0x4a, 0xce, 0x9f, 0xf2, 0xbd, 0x47, 0x1d, 0xc3, 0xf0, 0xe7, 0xc3, 0x3c, 0xcf,
	0x74, 0x14, 0xd9, 0x89, 0x44, 0xbe, 0x33, 0xb1, 0x23, 0x76, 0xc9, 0xba, 0x1e, 0x44, 0x82, 0x18,
	0x82, 0xb8, 0x1c, 0x36, 0xc6, 0xa8, 0x18, 0x00, 0xaf, 0x5f, 0x37, 0x5d, 0x6e, 0xc6, 0x19, 0x6f,
	0xc5, 0x62, 0x8c, 0xe4, 0xdb, 0x96, 0xf6, 0xf4, 0x66, 0xaa, 0x48, 0x6c, 0xff, 0x0e, 0x00, 0x00,
	0xff, 0xff, 0x5b, 0x4f, 0x96, 0xe3, 0xc1, 0x04, 0x00, 0x00,
}
+3 −3
Original line number Diff line number Diff line
@@ -226,11 +226,11 @@ func RegisterConsoleHandlerClient(ctx context.Context, mux *runtime.ServeMux, cl
}

var (
	pattern_Console_DeleteAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v2", "account", "id"}, ""))
	pattern_Console_DeleteAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "console", "account", "id"}, ""))

	pattern_Console_ExportAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v2", "account", "id", "export"}, ""))
	pattern_Console_ExportAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"v2", "console", "account", "id", "export"}, ""))

	pattern_Console_Login_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "account", "authenticate"}, ""))
	pattern_Console_Login_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "console", "authenticate"}, ""))
)

var (
+3 −3
Original line number Diff line number Diff line
@@ -51,18 +51,18 @@ option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
service Console {
  // Delete all information stored for a user account.
  rpc DeleteAccount (AccountIdRequest) returns (google.protobuf.Empty) {
    option (google.api.http).delete = "/v2/account/{id}";
    option (google.api.http).delete = "/v2/console/account/{id}";
  }

  // Export all information stored about a user account.
  rpc ExportAccount (AccountIdRequest) returns (AccountExport) {
    option (google.api.http).get = "/v2/account/{id}/export";
    option (google.api.http).get = "/v2/console/account/{id}/export";
  }

  // Authenticate a user with username+password.
  rpc Login (AuthenticateRequest) returns (Session) {
    option (google.api.http) = {
      post: "/v2/account/authenticate",
      post: "/v2/console/authenticate",
      body: "*"
    };
  }
+23 −23
Original line number Diff line number Diff line
@@ -19,26 +19,24 @@
    "application/json"
  ],
  "paths": {
    "/v2/account/authenticate": {
      "post": {
        "summary": "Authenticate a user with username+password.",
        "operationId": "Login",
    "/v2/console/account/{id}": {
      "delete": {
        "summary": "Delete all information stored for a user account.",
        "operationId": "DeleteAccount",
        "responses": {
          "200": {
            "description": "",
            "schema": {
              "$ref": "#/definitions/nakamaconsoleSession"
              "$ref": "#/definitions/protobufEmpty"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/definitions/consoleAuthenticateRequest"
            }
            "type": "string"
          }
        ],
        "tags": [
@@ -46,15 +44,15 @@
        ]
      }
    },
    "/v2/account/{id}": {
      "delete": {
        "summary": "Delete all information stored for a user account.",
        "operationId": "DeleteAccount",
    "/v2/console/account/{id}/export": {
      "get": {
        "summary": "Export all information stored about a user account.",
        "operationId": "ExportAccount",
        "responses": {
          "200": {
            "description": "",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
              "$ref": "#/definitions/consoleAccountExport"
            }
          }
        },
@@ -71,24 +69,26 @@
        ]
      }
    },
    "/v2/account/{id}/export": {
      "get": {
        "summary": "Export all information stored about a user account.",
        "operationId": "ExportAccount",
    "/v2/console/authenticate": {
      "post": {
        "summary": "Authenticate a user with username+password.",
        "operationId": "Login",
        "responses": {
          "200": {
            "description": "",
            "schema": {
              "$ref": "#/definitions/consoleAccountExport"
              "$ref": "#/definitions/nakamaconsoleSession"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "name": "body",
            "in": "body",
            "required": true,
            "type": "string"
            "schema": {
              "$ref": "#/definitions/consoleAuthenticateRequest"
            }
          }
        ],
        "tags": [
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ import (
func (s *ApiServer) GetAccount(ctx context.Context, in *empty.Empty) (*api.Account, error) {
	userID := ctx.Value(ctxUserIDKey{}).(uuid.UUID)

	user, err := GetAccount(s.db, s.logger, s.tracker, userID)
	user, err := GetAccount(s.logger, s.db, s.tracker, userID)
	if err != nil {
		return nil, status.Error(codes.Internal, "Error retrieving user account.")
	}
Loading