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.
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
- 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 Leases
- type Permission
- type PermissionDeployment
- type PermissionScope
- type PermissionScopes
- type Permissions
- type Signer
- type SignerI
- type Verify
- type VerifyI
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrJWTValidation = fmt.Errorf("jwt: validation error")
)
View Source
var (
SigningMethodES256K *signer
)
View Source
var (
SigningMethodES256KADR36 *signerADR36
)
Functions ¶
This section is empty.
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 GetSupportedScopes ¶ added in v0.0.83
func GetSupportedScopes() PermissionScopes
GetSupportedScopes returns the list of permission scopes recognised by the JWT package.
func (PermissionScopes) Has ¶
func (c PermissionScopes) Has(scope PermissionScope) bool
func (*PermissionScopes) UnmarshalCSV ¶ added in v0.0.80
func (c *PermissionScopes) UnmarshalCSV(val string) error
func (PermissionScopes) Validate ¶
func (c PermissionScopes) Validate() error
type Permissions ¶
type Permissions []Permission
func (Permissions) Validate ¶
func (p Permissions) Validate() error
type Verify ¶ added in v0.0.92
type Verify struct {
cryptotypes.PubKey
// contains filtered or unexported fields
}
func (Verify) GetAddress ¶ added in v0.0.92
func (Verify) Pubkey ¶ added in v0.0.92
func (v Verify) Pubkey() cryptotypes.PubKey
type VerifyI ¶ added in v0.0.92
type VerifyI interface {
Pubkey() cryptotypes.PubKey
GetAddress() sdk.Address
}
VerifyI wraps cosmos keyring and account info to provide a signer interface
func NewVerifier ¶ added in v0.0.92
func NewVerifier(pubkey cryptotypes.PubKey, addr sdk.Address) VerifyI
Click to show internal directories.
Click to hide internal directories.