-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Web3 authorization support (#1)
* fix (docs): adjust docs to be compatible with authorization via user address * add (challenger): to sign with Metamask wallet and verify in service * fix (cli): to have graceful shutdown to catch signals and stop services via context * fix (jwt): adjust jwt generation to be compatible with address, clean code style * remove (zkp): redundant ZKP related code * fix (config): code style, remove zkp config initialization * update (resources): regenerate with new docs * update (service): removing ZKP related code, update some code style issues, add support for signature verification and JWT issuing by address * update (pkg): removing ZKP related staff, add compatibility with JWT by user address * fix: spelling errors, example config file * fix (CI/CD): build with skaffold instead of werf build * update (docs): adding admin authorization * update (docs): adding admin authorization path * update (resources): with admin authorization docs * add: supporting admin authorization
- Loading branch information
Showing
64 changed files
with
885 additions
and
821 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 was deleted.
Oops, something went wrong.
11 changes: 2 additions & 9 deletions
11
.github/workflows/deploy-gh-pages.yaml → .github/workflows/gh-pages.yaml
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 |
---|---|---|
@@ -1,9 +1,13 @@ | ||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+' | ||
|
||
env: | ||
CI_JOB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
jobs: | ||
converge: | ||
name: Converge | ||
|
@@ -15,20 +19,21 @@ jobs: | |
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install werf | ||
uses: werf/actions/[email protected] | ||
|
||
- name: Log in to registry | ||
# This is where you will update the personal access token to GITHUB_TOKEN | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | ||
|
||
- name: Run echo | ||
run: | | ||
werf version | ||
docker version | ||
echo $GITHUB_REPOSITORY | ||
echo $GITHUB_REF_NAME | ||
- name: Run Build | ||
run: | | ||
. $(werf ci-env github --as-file) | ||
werf export service --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_REF_NAME | ||
- name: Cache layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: "${{ github.workspace }}/.skaffold/cache" | ||
key: skaffold-${{ hashFiles('**/cache') }} | ||
restore-keys: | | ||
skaffold- | ||
- name: Run Skaffold pipeline as command | ||
uses: hiberbee/github-action-skaffold@latest | ||
id: build | ||
with: | ||
command: build --tag ${{ github.ref_name }} | ||
repository: ghcr.io/${{ github.repository_owner }} |
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 |
---|---|---|
@@ -1,17 +1,25 @@ | ||
FROM golang:1.20-alpine as buildbase | ||
FROM golang:1.21.0-alpine as buildbase | ||
|
||
RUN apk add git build-base | ||
ARG CI_JOB_TOKEN | ||
|
||
RUN apk add git build-base ca-certificates | ||
WORKDIR /go/src/github.com/rarimo/web3-auth-svc | ||
COPY vendor . | ||
COPY . . | ||
|
||
RUN GOOS=linux go build -o /usr/local/bin/web3-auth-svc /go/src/github.com/rarimo/web3-auth-svc | ||
RUN git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com".insteadOf https://gitlab.com | ||
RUN git config --global url."https://${CI_JOB_TOKEN}@github.com/".insteadOf https://github.com/ | ||
RUN go env -w GOPRIVATE=github.com/*,gitlab.com/* | ||
|
||
RUN go mod tidy && go mod vendor | ||
RUN CGO_ENABLED=1 GO111MODULE=on GOOS=linux go build -o /usr/local/bin/web3-auth-svc /go/src/github.com/rarimo/web3-auth-svc | ||
|
||
FROM alpine:3.9 | ||
|
||
FROM scratch | ||
COPY --from=alpine:3.9 /bin/sh /bin/sh | ||
COPY --from=alpine:3.9 /usr /usr | ||
COPY --from=alpine:3.9 /lib /lib | ||
|
||
COPY --from=buildbase /usr/local/bin/web3-auth-svc /usr/local/bin/web3-auth-svc | ||
RUN apk add --no-cache ca-certificates | ||
COPY --from=buildbase /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
|
||
ENTRYPOINT ["web3-auth-svc"] |
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,8 @@ | ||
in: path | ||
name: 'address' | ||
required: true | ||
schema: | ||
type: string | ||
example: "0x123...abc" | ||
pattern: '^0x[0-9a-fA-F]{40}$' | ||
description: User address 20 bytes |
This file was deleted.
Oops, something went wrong.
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,16 @@ | ||
allOf: | ||
- $ref: '#/components/schemas/AuthorizeKey' | ||
- type: object | ||
x-go-is-request: true | ||
required: | ||
- attributes | ||
properties: | ||
attributes: | ||
required: | ||
- password | ||
type: object | ||
properties: | ||
password: | ||
type: string | ||
example: whoami | ||
description: Password to get admin permissions |
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 |
---|---|---|
@@ -1,10 +1,15 @@ | ||
description: 'Authorized user personal data' | ||
type: object | ||
required: | ||
- nullifier | ||
- address | ||
- is_admin | ||
properties: | ||
nullifier: | ||
address: | ||
type: string | ||
example: "0x123...abc" | ||
pattern: '^0x[0-9a-fA-F]{64}$' | ||
description: Nullifier authorized with | ||
pattern: '^0x[0-9a-fA-F]{40}$' | ||
description: Address authorized with | ||
is_admin: | ||
type: bool | ||
example: false | ||
description: Whether the user has a admin permissions |
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
2 changes: 1 addition & 1 deletion
2
.../components/schemas/ValidationResult.yaml → docs/spec/components/schemas/Validation.yaml
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
File renamed without changes.
Oops, something went wrong.