-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from rarimo/fix/validate-credentials-params
Update: proof validation with additional configurable info
- Loading branch information
Showing
14 changed files
with
268 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
allOf: | ||
- $ref: '#/components/schemas/AirdropKey' | ||
- type: object | ||
required: | ||
- attributes | ||
properties: | ||
attributes: | ||
type: object | ||
required: | ||
- event_id | ||
- query_selector | ||
- started_at | ||
properties: | ||
event_id: | ||
type: string | ||
description: Event identifier that is generated during ZKP query creation | ||
example: "304351862882731539112827930982999985591702317710421481944329166111111129570" | ||
started_at: | ||
type: integer | ||
format: int64 | ||
description: Unix timestamp in seconds when airdrop event starts | ||
example: 1716381206 | ||
query_selector: | ||
type: string | ||
description: Query selector that is used for proof generation | ||
example: 123 |
17 changes: 17 additions & 0 deletions
17
docs/spec/paths/integrations@airdrop-svc@[email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
get: | ||
tags: | ||
- Airdrop | ||
summary: Get airdrop event parameters | ||
description: Get an airdrop parameters for integration. | ||
operationId: GetAirdropParams | ||
responses: | ||
200: | ||
content: | ||
application/vnd.api+json: | ||
schema: | ||
type: object | ||
required: | ||
- data | ||
properties: | ||
data: | ||
$ref: '#/components/schemas/AirdropParams' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package handlers | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/rarimo/airdrop-svc/resources" | ||
"gitlab.com/distributed_lab/ape" | ||
) | ||
|
||
func GetAirdropParams(w http.ResponseWriter, r *http.Request) { | ||
ape.Render(w, resources.AirdropParamsResponse{ | ||
Data: resources.AirdropParams{ | ||
Key: resources.Key{ | ||
Type: resources.AIRDROP, | ||
}, | ||
Attributes: resources.AirdropParamsAttributes{ | ||
EventId: AirdropParams(r).EventID, | ||
StartedAt: AirdropParams(r).AirdropStart, | ||
QuerySelector: AirdropParams(r).QuerySelector, | ||
}, | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* GENERATED. Do not modify. Your changes might be overwritten! | ||
*/ | ||
|
||
package resources | ||
|
||
import "encoding/json" | ||
|
||
type AirdropParams struct { | ||
Key | ||
Attributes AirdropParamsAttributes `json:"attributes"` | ||
} | ||
type AirdropParamsResponse struct { | ||
Data AirdropParams `json:"data"` | ||
Included Included `json:"included"` | ||
} | ||
|
||
type AirdropParamsListResponse struct { | ||
Data []AirdropParams `json:"data"` | ||
Included Included `json:"included"` | ||
Links *Links `json:"links"` | ||
Meta json.RawMessage `json:"meta,omitempty"` | ||
} | ||
|
||
func (r *AirdropParamsListResponse) PutMeta(v interface{}) (err error) { | ||
r.Meta, err = json.Marshal(v) | ||
return err | ||
} | ||
|
||
func (r *AirdropParamsListResponse) GetMeta(out interface{}) error { | ||
return json.Unmarshal(r.Meta, out) | ||
} | ||
|
||
// MustAirdropParams - returns AirdropParams 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 (c *Included) MustAirdropParams(key Key) *AirdropParams { | ||
var airdropParams AirdropParams | ||
if c.tryFindEntry(key, &airdropParams) { | ||
return &airdropParams | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* GENERATED. Do not modify. Your changes might be overwritten! | ||
*/ | ||
|
||
package resources | ||
|
||
type AirdropParamsAttributes struct { | ||
// Event identifier that is generated during ZKP query creation | ||
EventId string `json:"event_id"` | ||
// Query selector that is used for proof generation | ||
QuerySelector string `json:"query_selector"` | ||
// Unix timestamp in seconds when airdrop event starts | ||
StartedAt int64 `json:"started_at"` | ||
} |
Oops, something went wrong.