security

package
v0.0.0-...-459ef6d Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package security implements a mechanism which is described here: https://www.filestack.com/docs/security/policies/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeSignature

func EncodeSignature(secret string, policyB64 string) string

EncodeSignature converts Security to base64 encoded string.

Types

type Policy

type Policy struct {
	Call      []string `json:"call,omitempty"`
	Container string   `json:"container,omitempty"`
	Expiry    int64    `json:"expiry"`
	Handle    string   `json:"handle,omitempty"`
	MaxSize   int64    `json:"maxSize,omitempty"`
	MinSize   int64    `json:"minSize,omitempty"`
	Path      string   `json:"path,omitempty"`
	URL       string   `json:"url,omitempty"`
}

Policy determines which actions are authorized.

func (*Policy) AsString

func (p *Policy) AsString() string

AsString represents Policy as a string.

func (*Policy) EncodeToB64

func (p *Policy) EncodeToB64() string

EncodeToB64 encodes policy string to base64 format.

type Security

type Security struct {
	PolicyB64 string
	Signature string
}

Security is used for requests authentication.

func NewSecurity

func NewSecurity(secret string, policy *Policy) *Security

NewSecurity creates a new Security based on your secret and policy. Both values can be obtained from dev portal.

func (*Security) AsString

func (s *Security) AsString() string

AsString converts Security to a string.

Jump to

Keyboard shortcuts

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