Documentation
¶
Overview ¶
Package jwt provides JWT signing and verification methods for the Cosmos SDK. It includes functionality for creating and verifying JWT tokens using the ES256K signing method.
Index ¶
- Variables
- func ParseWithClaims(tokenString string, claims Claims, keyFunc jwt.Keyfunc, ...) (*jwt.Token, error)
- type AccessType
- type Claims
- func (c Claims) AuthorizeDeploymentIDForPermissionScope(did dtypes.DeploymentID, provider sdk.Address, scope PermissionScope) bool
- func (c Claims) AuthorizeForDeploymentID(did dtypes.DeploymentID, provider sdk.Address) bool
- func (c Claims) AuthorizeForLeaseID(lid mtypes.LeaseID) bool
- func (c Claims) AuthorizeForProvider(acc sdk.Address) bool
- func (c Claims) AuthorizeLeaseIDForPermissionScope(lid mtypes.LeaseID, scope PermissionScope) bool
- func (c Claims) IssuerAddress() sdk.Address
- func (c *Claims) Validate() error
- type JWT
- type Leases
- type Permission
- type PermissionDeployment
- type PermissionScope
- type PermissionScopes
- type Permissions
- type Signer
- type SignerI
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrJWTValidation = fmt.Errorf("jwt: validation error")
)
View Source
var (
SigningMethodES256K *signer
)
Functions ¶
Types ¶
type AccessType ¶
type AccessType string
const ( AccessTypeFull AccessType = "full" AccessTypeGranular AccessType = "granular" AccessTypeScoped AccessType = "scoped" AccessTypeNone AccessType = "none" )
type Claims ¶
type Claims struct {
jwt.RegisteredClaims
Version string `json:"version"`
Leases Leases `json:"leases"`
// contains filtered or unexported fields
}
func (Claims) AuthorizeDeploymentIDForPermissionScope ¶
func (c Claims) AuthorizeDeploymentIDForPermissionScope(did dtypes.DeploymentID, provider sdk.Address, scope PermissionScope) bool
func (Claims) AuthorizeForDeploymentID ¶
func (Claims) AuthorizeLeaseIDForPermissionScope ¶
func (c Claims) AuthorizeLeaseIDForPermissionScope(lid mtypes.LeaseID, scope PermissionScope) bool
func (Claims) IssuerAddress ¶
type Leases ¶
type Leases struct {
Access AccessType `json:"access"`
Scope PermissionScopes `json:"scope,omitempty"`
Permissions Permissions `json:"permissions,omitempty"`
}
type Permission ¶
type Permission struct {
Provider sdk.AccAddress `json:"provider"`
Access AccessType `json:"access"`
Scope PermissionScopes `json:"scope,omitempty"`
Deployments []PermissionDeployment `json:"deployments,omitempty"`
}
type PermissionDeployment ¶
type PermissionDeployment struct {
Scope PermissionScopes `json:"scope"`
DSeq uint64 `json:"dseq,omitempty"`
GSeq uint32 `json:"gseq,omitempty"`
OSeq uint32 `json:"oseq,omitempty"`
Services []string `json:"services,omitempty"`
}
type PermissionScope ¶
type PermissionScope string
const ( PermissionScopeSendManifest PermissionScope = "send-manifest" PermissionScopeGetManifest PermissionScope = "get-manifest" PermissionScopeLogs PermissionScope = "logs" PermissionScopeShell PermissionScope = "shell" PermissionScopeEvents PermissionScope = "events" PermissionScopeStatus PermissionScope = "status" PermissionScopeRestart PermissionScope = "restart" PermissionScopeHostnameMigrate PermissionScope = "hostname-migrate" PermissionScopeIPMigrate PermissionScope = "ip-migrate" )
func (PermissionScope) String ¶
func (s PermissionScope) String() string
type PermissionScopes ¶
type PermissionScopes []PermissionScope
func (PermissionScopes) Has ¶
func (c PermissionScopes) Has(scope PermissionScope) bool
func (PermissionScopes) Validate ¶
func (c PermissionScopes) Validate() error
type Permissions ¶
type Permissions []Permission
func (Permissions) Validate ¶
func (p Permissions) Validate() error
Click to show internal directories.
Click to hide internal directories.