resources

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorize

type Authorize struct {
	Key
	Attributes AuthorizeAttributes `json:"attributes"`
}

type AuthorizeAdmin added in v0.2.0

type AuthorizeAdmin struct {
	Key
	Attributes AuthorizeAdminAttributes `json:"attributes"`
}

type AuthorizeAdminAttributes added in v0.2.0

type AuthorizeAdminAttributes struct {
	// Password to get admin permissions
	Password string `json:"password"`
}

type AuthorizeAdminListRequest added in v0.2.0

type AuthorizeAdminListRequest struct {
	Data     []AuthorizeAdmin `json:"data"`
	Included Included         `json:"included"`
	Links    *Links           `json:"links"`
	Meta     json.RawMessage  `json:"meta,omitempty"`
}

func (*AuthorizeAdminListRequest) GetMeta added in v0.2.0

func (r *AuthorizeAdminListRequest) GetMeta(out interface{}) error

func (*AuthorizeAdminListRequest) PutMeta added in v0.2.0

func (r *AuthorizeAdminListRequest) PutMeta(v interface{}) (err error)

type AuthorizeAdminRequest added in v0.2.0

type AuthorizeAdminRequest struct {
	Data     AuthorizeAdmin `json:"data"`
	Included Included       `json:"included"`
}

type AuthorizeAttributes

type AuthorizeAttributes struct {
	// Query ZK passport verification proof.
	Proof types.ZKProof `json:"proof"`
}

type AuthorizeListRequest

type AuthorizeListRequest struct {
	Data     []Authorize     `json:"data"`
	Included Included        `json:"included"`
	Links    *Links          `json:"links"`
	Meta     json.RawMessage `json:"meta,omitempty"`
}

func (*AuthorizeListRequest) GetMeta

func (r *AuthorizeListRequest) GetMeta(out interface{}) error

func (*AuthorizeListRequest) PutMeta

func (r *AuthorizeListRequest) PutMeta(v interface{}) (err error)

type AuthorizeRequest

type AuthorizeRequest struct {
	Data     Authorize `json:"data"`
	Included Included  `json:"included"`
}

type Challenge

type Challenge struct {
	Key
	Attributes ChallengeAttributes `json:"attributes"`
}

type ChallengeAttributes

type ChallengeAttributes struct {
	// Base64 encoded challenge. Use it to generate Query ZK-proof. Decode base64 string and convert into big-endian decimal number.
	Challenge string `json:"challenge"`
}

type ChallengeListResponse

type ChallengeListResponse struct {
	Data     []Challenge     `json:"data"`
	Included Included        `json:"included"`
	Links    *Links          `json:"links"`
	Meta     json.RawMessage `json:"meta,omitempty"`
}

func (*ChallengeListResponse) GetMeta

func (r *ChallengeListResponse) GetMeta(out interface{}) error

func (*ChallengeListResponse) PutMeta

func (r *ChallengeListResponse) PutMeta(v interface{}) (err error)

type ChallengeResponse

type ChallengeResponse struct {
	Data     Challenge `json:"data"`
	Included Included  `json:"included"`
}

type Claim

type Claim struct {
	// Whether the user has a admin permissions
	IsAdmin bool `json:"is_admin"`
	// Whether the user has a scanned passport
	IsVerified bool `json:"is_verified"`
	// Nullifier authorized with
	Nullifier string `json:"nullifier"`
	// User shared hash
	SharedHash *string `json:"shared_hash,omitempty"`
}

Authorized user personal data

type Details

type Details json.RawMessage

func (Details) MarshalJSON

func (d Details) MarshalJSON() ([]byte, error)

MarshalJSON - casts Details to []byte

func (*Details) Scan

func (r *Details) Scan(src interface{}) error

Scan - implements db driver method for auto unmarshal

func (Details) String

func (d Details) String() string

func (*Details) UnmarshalJSON

func (d *Details) UnmarshalJSON(data []byte) error

UnmarshalJSON - casts data to Details

func (Details) Value

func (r Details) Value() (driver.Value, error)

Value - implements db driver method for auto marshal

type Flag

type Flag struct {
	Name  string `json:"name"`
	Value int32  `json:"value"`
}

type Flagger

type Flagger interface {
	IsFlag() bool
}

type Flags

type Flags struct {
	Mask   int32  `json:"mask"`
	Values []Flag `json:"flags"`
}

func FlagsFromMask

func FlagsFromMask(mask int32, allFlags map[int32]string) Flags

type Included

type Included struct {
	// contains filtered or unexported fields
}

Included - an array of Resource objects that are related to the primary data and/or each other (“included resources”).

func (*Included) Add

func (c *Included) Add(includes ...Resource)

Add - adds new include into collection. If one already present - skips it

func (Included) MarshalJSON

func (c Included) MarshalJSON() ([]byte, error)

MarshalJSON - marshals include collection as array of json objects

func (*Included) MustAuthorize

func (c *Included) MustAuthorize(key Key) *Authorize

MustAuthorize - returns Authorize from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustAuthorizeAdmin added in v0.2.0

func (c *Included) MustAuthorizeAdmin(key Key) *AuthorizeAdmin

MustAuthorizeAdmin - returns AuthorizeAdmin from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustChallenge

func (c *Included) MustChallenge(key Key) *Challenge

MustChallenge - returns Challenge from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustToken

func (c *Included) MustToken(key Key) *Token

MustToken - returns Token from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustValidationResult

func (c *Included) MustValidationResult(key Key) *ValidationResult

MustValidationResult - returns ValidationResult from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustVerifyPassport

func (c *Included) MustVerifyPassport(key Key) *VerifyPassport

MustVerifyPassport - returns VerifyPassport from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) UnmarshalJSON

func (c *Included) UnmarshalJSON(data []byte) error

UnmarshalJSON - unmarshal array of json objects into include collection

type Jwt

type Jwt struct {
	// Base64 encoded JWT
	Token     string `json:"token"`
	TokenType string `json:"token_type"`
}

JWT token

type Key

type Key struct {
	ID   string       `json:"id"`
	Type ResourceType `json:"type"`
}

func NewKeyInt64

func NewKeyInt64(id int64, resourceType ResourceType) Key

func (Key) AsRelation

func (r Key) AsRelation() *Relation

func (*Key) GetKey

func (r *Key) GetKey() Key

func (Key) GetKeyP

func (r Key) GetKeyP() *Key
type Links struct {
	First string `json:"first,omitempty"`
	Last  string `json:"last,omitempty"`
	Next  string `json:"next,omitempty"`
	Prev  string `json:"prev,omitempty"`
	Self  string `json:"self,omitempty"`
}

type Proof

type Proof struct {
	// User EVM address hex-encoded
	Address string `json:"address"`
	// JSON encoded ZK proof AuthV2 proof.
	Proof json.RawMessage `json:"proof"`
}

Auth proof

type Relation

type Relation struct {
	Data  *Key   `json:"data,omitempty"`
	Links *Links `json:"links,omitempty"`
}

type RelationCollection

type RelationCollection struct {
	Data  []Key  `json:"data"`
	Links *Links `json:"links,omitempty"`
}

func (RelationCollection) MarshalJSON

func (r RelationCollection) MarshalJSON() ([]byte, error)

type Resource

type Resource interface {
	//GetKey - returns key of the Resource
	GetKey() Key
}

type ResourceType

type ResourceType string
const (
	AUTHORIZE_ADMIN ResourceType = "authorize_admin"
	AUTHORIZE       ResourceType = "authorize"
	CHALLENGE       ResourceType = "challenge"
	TOKEN           ResourceType = "token"
	VALIDATION      ResourceType = "validation"
	AUTHORIZE_V2    ResourceType = "authorize_v2"
)

List of ResourceType

type Token

type Token struct {
	Key
	Attributes TokenAttributes `json:"attributes"`
}

type TokenAttributes

type TokenAttributes struct {
	AccessToken  Jwt `json:"access_token"`
	RefreshToken Jwt `json:"refresh_token"`
}

type TokenListResponse

type TokenListResponse struct {
	Data     []Token         `json:"data"`
	Included Included        `json:"included"`
	Links    *Links          `json:"links"`
	Meta     json.RawMessage `json:"meta,omitempty"`
}

func (*TokenListResponse) GetMeta

func (r *TokenListResponse) GetMeta(out interface{}) error

func (*TokenListResponse) PutMeta

func (r *TokenListResponse) PutMeta(v interface{}) (err error)

type TokenResponse

type TokenResponse struct {
	Data     Token    `json:"data"`
	Included Included `json:"included"`
}

type ValidationResult

type ValidationResult struct {
	Key
	Attributes ValidationResultAttributes `json:"attributes"`
}

type ValidationResultAttributes

type ValidationResultAttributes struct {
	Claims []Claim `json:"claims"`
}

type ValidationResultListResponse

type ValidationResultListResponse struct {
	Data     []ValidationResult `json:"data"`
	Included Included           `json:"included"`
	Links    *Links             `json:"links"`
	Meta     json.RawMessage    `json:"meta,omitempty"`
}

func (*ValidationResultListResponse) GetMeta

func (r *ValidationResultListResponse) GetMeta(out interface{}) error

func (*ValidationResultListResponse) PutMeta

func (r *ValidationResultListResponse) PutMeta(v interface{}) (err error)

type ValidationResultResponse

type ValidationResultResponse struct {
	Data     ValidationResult `json:"data"`
	Included Included         `json:"included"`
}

type VerifyPassport

type VerifyPassport struct {
	Key
	Attributes VerifyPassportAttributes `json:"attributes"`
}

type VerifyPassportAttributes

type VerifyPassportAttributes struct {
	// Query ZK passport verification proof.
	Proof types.ZKProof `json:"proof"`
}

type VerifyPassportListRequest

type VerifyPassportListRequest struct {
	Data     []VerifyPassport `json:"data"`
	Included Included         `json:"included"`
	Links    *Links           `json:"links"`
	Meta     json.RawMessage  `json:"meta,omitempty"`
}

func (*VerifyPassportListRequest) GetMeta

func (r *VerifyPassportListRequest) GetMeta(out interface{}) error

func (*VerifyPassportListRequest) PutMeta

func (r *VerifyPassportListRequest) PutMeta(v interface{}) (err error)

type VerifyPassportRequest

type VerifyPassportRequest struct {
	Data     VerifyPassport `json:"data"`
	Included Included       `json:"included"`
}

Jump to

Keyboard shortcuts

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