auth

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthService_GenerateAuthChallenge_FullMethodName = "/auth.AuthService/GenerateAuthChallenge"
	AuthService_GenerateAuthTokens_FullMethodName    = "/auth.AuthService/GenerateAuthTokens"
	AuthService_RefreshAccessToken_FullMethodName    = "/auth.AuthService/RefreshAccessToken"
)

Variables

View Source
var (
	Role_name = map[int32]string{
		0: "RELAYER",
		1: "SEARCHER",
		2: "VALIDATOR",
		3: "SHREDSTREAM_SUBSCRIBER",
	}
	Role_value = map[string]int32{
		"RELAYER":                0,
		"SEARCHER":               1,
		"VALIDATOR":              2,
		"SHREDSTREAM_SUBSCRIBER": 3,
	}
)

Enum value maps for Role.

View Source
var AuthService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "auth.AuthService",
	HandlerType: (*AuthServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GenerateAuthChallenge",
			Handler:    _AuthService_GenerateAuthChallenge_Handler,
		},
		{
			MethodName: "GenerateAuthTokens",
			Handler:    _AuthService_GenerateAuthTokens_Handler,
		},
		{
			MethodName: "RefreshAccessToken",
			Handler:    _AuthService_RefreshAccessToken_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "auth.proto",
}

AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterAuthServiceServer

func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer)

Types

type AuthServiceClient

type AuthServiceClient interface {
	// / Returns a challenge, client is expected to sign this challenge with an appropriate keypair in order to obtain access tokens.
	GenerateAuthChallenge(ctx context.Context, in *GenerateAuthChallengeRequest, opts ...grpc.CallOption) (*GenerateAuthChallengeResponse, error)
	// / Provides the client with the initial pair of auth tokens for API access.
	GenerateAuthTokens(ctx context.Context, in *GenerateAuthTokensRequest, opts ...grpc.CallOption) (*GenerateAuthTokensResponse, error)
	// / Call this method with a non-expired refresh token to obtain a new access token.
	RefreshAccessToken(ctx context.Context, in *RefreshAccessTokenRequest, opts ...grpc.CallOption) (*RefreshAccessTokenResponse, error)
}

AuthServiceClient is the client API for AuthService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

/ This service is responsible for issuing auth tokens to clients for API access.

type AuthServiceServer

type AuthServiceServer interface {
	// / Returns a challenge, client is expected to sign this challenge with an appropriate keypair in order to obtain access tokens.
	GenerateAuthChallenge(context.Context, *GenerateAuthChallengeRequest) (*GenerateAuthChallengeResponse, error)
	// / Provides the client with the initial pair of auth tokens for API access.
	GenerateAuthTokens(context.Context, *GenerateAuthTokensRequest) (*GenerateAuthTokensResponse, error)
	// / Call this method with a non-expired refresh token to obtain a new access token.
	RefreshAccessToken(context.Context, *RefreshAccessTokenRequest) (*RefreshAccessTokenResponse, error)
	// contains filtered or unexported methods
}

AuthServiceServer is the server API for AuthService service. All implementations must embed UnimplementedAuthServiceServer for forward compatibility.

/ This service is responsible for issuing auth tokens to clients for API access.

type GenerateAuthChallengeRequest

type GenerateAuthChallengeRequest struct {

	// / Role the client is attempting to generate tokens for.
	Role Role `protobuf:"varint,1,opt,name=role,proto3,enum=auth.Role" json:"role,omitempty"`
	// / Client's 32 byte pubkey.
	Pubkey []byte `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
	// contains filtered or unexported fields
}

func (*GenerateAuthChallengeRequest) Descriptor deprecated

func (*GenerateAuthChallengeRequest) Descriptor() ([]byte, []int)

Deprecated: Use GenerateAuthChallengeRequest.ProtoReflect.Descriptor instead.

func (*GenerateAuthChallengeRequest) GetPubkey

func (x *GenerateAuthChallengeRequest) GetPubkey() []byte

func (*GenerateAuthChallengeRequest) GetRole

func (x *GenerateAuthChallengeRequest) GetRole() Role

func (*GenerateAuthChallengeRequest) ProtoMessage

func (*GenerateAuthChallengeRequest) ProtoMessage()

func (*GenerateAuthChallengeRequest) ProtoReflect

func (*GenerateAuthChallengeRequest) Reset

func (x *GenerateAuthChallengeRequest) Reset()

func (*GenerateAuthChallengeRequest) String

type GenerateAuthChallengeResponse

type GenerateAuthChallengeResponse struct {
	Challenge string `protobuf:"bytes,1,opt,name=challenge,proto3" json:"challenge,omitempty"`
	// contains filtered or unexported fields
}

func (*GenerateAuthChallengeResponse) Descriptor deprecated

func (*GenerateAuthChallengeResponse) Descriptor() ([]byte, []int)

Deprecated: Use GenerateAuthChallengeResponse.ProtoReflect.Descriptor instead.

func (*GenerateAuthChallengeResponse) GetChallenge

func (x *GenerateAuthChallengeResponse) GetChallenge() string

func (*GenerateAuthChallengeResponse) ProtoMessage

func (*GenerateAuthChallengeResponse) ProtoMessage()

func (*GenerateAuthChallengeResponse) ProtoReflect

func (*GenerateAuthChallengeResponse) Reset

func (x *GenerateAuthChallengeResponse) Reset()

func (*GenerateAuthChallengeResponse) String

type GenerateAuthTokensRequest

type GenerateAuthTokensRequest struct {

	// / The pre-signed challenge.
	Challenge string `protobuf:"bytes,1,opt,name=challenge,proto3" json:"challenge,omitempty"`
	// / The signing keypair's corresponding 32 byte pubkey.
	ClientPubkey []byte `protobuf:"bytes,2,opt,name=client_pubkey,json=clientPubkey,proto3" json:"client_pubkey,omitempty"`
	// / The 64 byte signature of the challenge signed by the client's private key. The private key must correspond to
	// the pubkey passed in the [GenerateAuthChallenge] method. The client is expected to sign the challenge token
	// prepended with their pubkey. For example sign(pubkey, challenge).
	SignedChallenge []byte `protobuf:"bytes,3,opt,name=signed_challenge,json=signedChallenge,proto3" json:"signed_challenge,omitempty"`
	// contains filtered or unexported fields
}

func (*GenerateAuthTokensRequest) Descriptor deprecated

func (*GenerateAuthTokensRequest) Descriptor() ([]byte, []int)

Deprecated: Use GenerateAuthTokensRequest.ProtoReflect.Descriptor instead.

func (*GenerateAuthTokensRequest) GetChallenge

func (x *GenerateAuthTokensRequest) GetChallenge() string

func (*GenerateAuthTokensRequest) GetClientPubkey

func (x *GenerateAuthTokensRequest) GetClientPubkey() []byte

func (*GenerateAuthTokensRequest) GetSignedChallenge

func (x *GenerateAuthTokensRequest) GetSignedChallenge() []byte

func (*GenerateAuthTokensRequest) ProtoMessage

func (*GenerateAuthTokensRequest) ProtoMessage()

func (*GenerateAuthTokensRequest) ProtoReflect

func (*GenerateAuthTokensRequest) Reset

func (x *GenerateAuthTokensRequest) Reset()

func (*GenerateAuthTokensRequest) String

func (x *GenerateAuthTokensRequest) String() string

type GenerateAuthTokensResponse

type GenerateAuthTokensResponse struct {

	// / The token granting access to resources.
	AccessToken *Token `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	// / The token used to refresh the access_token. This has a longer TTL than the access_token.
	RefreshToken *Token `protobuf:"bytes,2,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
	// contains filtered or unexported fields
}

func (*GenerateAuthTokensResponse) Descriptor deprecated

func (*GenerateAuthTokensResponse) Descriptor() ([]byte, []int)

Deprecated: Use GenerateAuthTokensResponse.ProtoReflect.Descriptor instead.

func (*GenerateAuthTokensResponse) GetAccessToken

func (x *GenerateAuthTokensResponse) GetAccessToken() *Token

func (*GenerateAuthTokensResponse) GetRefreshToken

func (x *GenerateAuthTokensResponse) GetRefreshToken() *Token

func (*GenerateAuthTokensResponse) ProtoMessage

func (*GenerateAuthTokensResponse) ProtoMessage()

func (*GenerateAuthTokensResponse) ProtoReflect

func (*GenerateAuthTokensResponse) Reset

func (x *GenerateAuthTokensResponse) Reset()

func (*GenerateAuthTokensResponse) String

func (x *GenerateAuthTokensResponse) String() string

type RefreshAccessTokenRequest

type RefreshAccessTokenRequest struct {

	// / Non-expired refresh token obtained from the [GenerateAuthTokens] method.
	RefreshToken string `protobuf:"bytes,1,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
	// contains filtered or unexported fields
}

func (*RefreshAccessTokenRequest) Descriptor deprecated

func (*RefreshAccessTokenRequest) Descriptor() ([]byte, []int)

Deprecated: Use RefreshAccessTokenRequest.ProtoReflect.Descriptor instead.

func (*RefreshAccessTokenRequest) GetRefreshToken

func (x *RefreshAccessTokenRequest) GetRefreshToken() string

func (*RefreshAccessTokenRequest) ProtoMessage

func (*RefreshAccessTokenRequest) ProtoMessage()

func (*RefreshAccessTokenRequest) ProtoReflect

func (*RefreshAccessTokenRequest) Reset

func (x *RefreshAccessTokenRequest) Reset()

func (*RefreshAccessTokenRequest) String

func (x *RefreshAccessTokenRequest) String() string

type RefreshAccessTokenResponse

type RefreshAccessTokenResponse struct {

	// / Fresh access_token.
	AccessToken *Token `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	// contains filtered or unexported fields
}

func (*RefreshAccessTokenResponse) Descriptor deprecated

func (*RefreshAccessTokenResponse) Descriptor() ([]byte, []int)

Deprecated: Use RefreshAccessTokenResponse.ProtoReflect.Descriptor instead.

func (*RefreshAccessTokenResponse) GetAccessToken

func (x *RefreshAccessTokenResponse) GetAccessToken() *Token

func (*RefreshAccessTokenResponse) ProtoMessage

func (*RefreshAccessTokenResponse) ProtoMessage()

func (*RefreshAccessTokenResponse) ProtoReflect

func (*RefreshAccessTokenResponse) Reset

func (x *RefreshAccessTokenResponse) Reset()

func (*RefreshAccessTokenResponse) String

func (x *RefreshAccessTokenResponse) String() string

type Role

type Role int32
const (
	Role_RELAYER                Role = 0
	Role_SEARCHER               Role = 1
	Role_VALIDATOR              Role = 2
	Role_SHREDSTREAM_SUBSCRIBER Role = 3
)

func (Role) Descriptor

func (Role) Descriptor() protoreflect.EnumDescriptor

func (Role) Enum

func (x Role) Enum() *Role

func (Role) EnumDescriptor deprecated

func (Role) EnumDescriptor() ([]byte, []int)

Deprecated: Use Role.Descriptor instead.

func (Role) Number

func (x Role) Number() protoreflect.EnumNumber

func (Role) String

func (x Role) String() string

func (Role) Type

func (Role) Type() protoreflect.EnumType

type Token

type Token struct {

	// / The token.
	Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	// / When the token will expire.
	ExpiresAtUtc *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=expires_at_utc,json=expiresAtUtc,proto3" json:"expires_at_utc,omitempty"`
	// contains filtered or unexported fields
}

func (*Token) Descriptor deprecated

func (*Token) Descriptor() ([]byte, []int)

Deprecated: Use Token.ProtoReflect.Descriptor instead.

func (*Token) GetExpiresAtUtc

func (x *Token) GetExpiresAtUtc() *timestamppb.Timestamp

func (*Token) GetValue

func (x *Token) GetValue() string

func (*Token) ProtoMessage

func (*Token) ProtoMessage()

func (*Token) ProtoReflect

func (x *Token) ProtoReflect() protoreflect.Message

func (*Token) Reset

func (x *Token) Reset()

func (*Token) String

func (x *Token) String() string

type UnimplementedAuthServiceServer

type UnimplementedAuthServiceServer struct{}

UnimplementedAuthServiceServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedAuthServiceServer) GenerateAuthTokens

func (UnimplementedAuthServiceServer) RefreshAccessToken

type UnsafeAuthServiceServer

type UnsafeAuthServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeAuthServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to AuthServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL