Skip to content

Commit

Permalink
Merge pull request #556 from 0xPolygonID/develop
Browse files Browse the repository at this point in the history
Release v2.3.2
  • Loading branch information
javip97 authored Nov 23, 2023
2 parents 0d3c8d6 + b168ae8 commit 6c19605
Show file tree
Hide file tree
Showing 25 changed files with 855 additions and 169 deletions.
28 changes: 28 additions & 0 deletions .github/issue-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Report a bug
about: Something with the issuer node is not working as expected
labels: 'bug'
---

#### Expected behaviour


#### Actual behaviour


#### Steps to reproduce the problem


### System information

Issuer node version: `vX.X.X`
OS & Version: `Windows/Linux/OSX`
Browser & Version: `Chrome/Firefox/Safari/Edge`

#### Logs (if needed)

````
[logs]
````

When submitting logs, please submit them as text and not as screenshots.
18 changes: 18 additions & 0 deletions .github/workflows/autoclose_stale_issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'Close stale issues and PR'
on:
schedule:
- cron: '00 05 * * *'

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v8
with:
exempt-issue-labels: "enhancement"
stale-issue-message: 'This issue is stale because it has been open 20 days with no activity. Remove stale label, add the enhancement label or comment to avoid closing it in 10 days.'
close-issue-message: 'This issue was closed because it has been stalled for 10 days with no activity.'
days-before-stale: 20
days-before-close: 10
days-before-pr-stale: -1
days-before-pr-close: -1
30 changes: 0 additions & 30 deletions Dockerfile-arm

This file was deleted.

42 changes: 20 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,34 +71,35 @@ run:

.PHONY: run-arm
run-arm:
$(eval DELETE_FILE = $(shell if [ -f ./.env-ui ]; then echo "false"; else echo "true"; fi))
@if [ -f ./.env-ui ]; then echo "false"; else touch ./.env-ui; fi
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_FILE="Dockerfile-arm" $(DOCKER_COMPOSE_CMD) up -d api pending_publisher
@if [ $(DELETE_FILE) = "true" ] ; then rm ./.env-ui; fi
@echo "WARN: Running ARM version is deprecated. 'make run' will be executed instead."
@make run

.PHONY: run-ui
run-ui: add-host-url-swagger
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_FILE="Dockerfile" $(DOCKER_COMPOSE_CMD) up -d api-ui ui notifications pending_publisher

.PHONY: run-ui-arm
run-ui-arm: add-host-url-swagger
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_FILE="Dockerfile-arm" $(DOCKER_COMPOSE_CMD) up -d api-ui ui notifications pending_publisher
@echo "WARN: Running ARM version is deprecated. 'make run-ui' will be executed instead."
@make run-ui

.PHONY: build
build:
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_FILE="Dockerfile" $(DOCKER_COMPOSE_CMD) build api pending_publisher

.PHONY: build-arm
build-arm:
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_FILE="Dockerfile-arm" $(DOCKER_COMPOSE_CMD) build api pending_publisher
@echo "WARN: Running ARM version is deprecated. 'make build' will be executed instead."
@make build

.PHONY: build-ui
build-ui:
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_FILE="Dockerfile" $(DOCKER_COMPOSE_CMD) build api-ui ui notifications pending_publisher

.PHONY: build-ui-arm
build-ui-arm:
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_FILE="Dockerfile-arm" $(DOCKER_COMPOSE_CMD) build api-ui ui notifications pending_publisher
@echo "WARN: Running ARM version is deprecated. 'make build-ui' will be executed instead."
@make build-ui

.PHONY: down
down:
Expand Down Expand Up @@ -176,22 +177,11 @@ generate-issuer-did: run-initializer
docker stop issuer-initializer-1
docker rm issuer-initializer-1

.PHONY: run-initializer-arm
run-initializer-arm:
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_FILE="Dockerfile-arm" $(DOCKER_COMPOSE_CMD) up -d initializer
sleep 5

.PHONY: generate-issuer-did-arm
generate-issuer-did-arm: run-initializer-arm
docker logs issuer-initializer-1
$(eval DID = $(shell docker logs -f --tail 1 issuer-initializer-1 | grep "did"))
@echo $(DID)
sed '/ISSUER_API_UI_ISSUER_DID/d' .env-api > .env-api.tmp
@echo ISSUER_API_UI_ISSUER_DID=$(DID) >> .env-api.tmp
mv .env-api.tmp .env-api
docker stop issuer-initializer-1
docker rm issuer-initializer-1
#make print-did
generate-issuer-did-arm:
@echo "WARN: Running ARM version is deprecated. 'make generate-issuer-did' will be executed instead."
@make generate-issuer-did

.PHONY: add-host-url-swagger
add-host-url-swagger:
Expand All @@ -208,7 +198,9 @@ rm-issuer-imgs: stop
restart-ui: rm-issuer-imgs up run run-ui

.PHONY: restart-ui-arm
restart-ui-arm: rm-issuer-imgs up run-arm run-ui-arm
restart-ui-arm:
@echo "WARN: Running ARM version is deprecated. 'make restart-ui' will be executed instead."
@make restart-ui

.PHONY: print-did
print-did:
Expand All @@ -221,6 +213,12 @@ delete-did:
docker exec issuer-vault-1 \
vault kv delete kv/did

# use this to add the did to vault. It will not be added to the database
# usage: make did=xxx add-did
.PHONY: add-did
add-did:
docker exec issuer-vault-1 \
vault kv put kv/did did=$(did)

# usage: make vault_token=xxx vault-export-keys
.PHONY: vault-export-keys
Expand Down
74 changes: 72 additions & 2 deletions api_ui/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,34 @@ paths:
$ref: '#/components/responses/500'

#authentication
/v1/authentication/sessions/{id}:
get:
summary: Get Authentication Connection
operationId: getAuthenticationConnection
description: get authentication connection
parameters:
- $ref: '#/components/parameters/id'
tags:
- Auth
- Connection
security:
- basicAuth: [ ]
responses:
'200':
description: ok
content:
application/json:
schema:
$ref: '#/components/schemas/GetAuthenticationConnectionResponse'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'404':
$ref: '#/components/responses/404'
'500':
$ref: '#/components/responses/500'

/v1/authentication/qrcode:
get:
summary: Get Connection QRCode
Expand Down Expand Up @@ -981,8 +1009,17 @@ components:
example: did:polygonid:polygon:mumbai:2qFpPHotk6oyaX1fcrpQFT4BMnmg8YszUwxYtaoGoe

QrCodeLinkShortResponse:
type: string
example: iden3comm://?request_uri=https%3A%2F%2Fissuer-demo.polygonid.me%2Fapi%2Fqr-store%3Fid%3Df780a169-8959-4380-9461-f7200e2ed3f4
type: object
required:
- qrCodeLink
- sessionID
properties:
qrCodeLink:
type: string
example: iden3comm://?request_uri=https%3A%2F%2Fissuer-demo.polygonid.me%2Fapi%2Fqr-store%3Fid%3Df780a169-8959-4380-9461-f7200e2ed3f4
sessionID:
$ref: '#/components/schemas/UUIDString'


QrCodeLinkWithSchemaTypeShortResponse:
type: object
Expand Down Expand Up @@ -1084,6 +1121,11 @@ components:
x-omitempty: false
example: c79c9c04-8c98-40f2-a7a0-5eeabf08d836

UUIDString:
type: string
x-omitempty: false
example: b7144f1c-d54e-4f67-a4f1-f2e7ff1beb07

GenericErrorMessage:
type: object
required:
Expand Down Expand Up @@ -1302,6 +1344,34 @@ components:
items:
$ref: '#/components/schemas/GetConnectionResponse'

AuthenticationConnection:
type: object
required:
- id
- userID
- issuerID
- createdAt
- modifiedAt
properties:
id:
$ref: '#/components/schemas/UUIDString'
userID:
$ref: '#/components/schemas/UUIDString'
issuerID:
$ref: '#/components/schemas/UUIDString'
createdAt:
$ref: '#/components/schemas/TimeUTC'
modifiedAt:
$ref: '#/components/schemas/TimeUTC'

GetAuthenticationConnectionResponse:
type: object
required:
- connection
properties:
connection:
$ref: '#/components/schemas/AuthenticationConnection'

GetConnectionResponse:
type: object
required:
Expand Down
35 changes: 22 additions & 13 deletions cmd/issuer_initializer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"context"
"errors"
"fmt"
"math/big"
"os"
Expand Down Expand Up @@ -81,16 +82,24 @@ func main() {
return
}

if cfg.VaultUserPassAuthEnabled {
did, err := providers.GetDID(ctx, vaultCli)
if err != nil {
log.Info(ctx, "did not found in vault, creating new one")
}

if did != "" {
log.Info(ctx, "did already created, skipping", "did", did)
did, err := providers.GetDID(ctx, vaultCli)
if err != nil {
if errors.Is(err, providers.VaultConnErr) {
log.Error(ctx, "cannot connect to vault", "err", err)
return
}
log.Info(ctx, "did not found in vault, creating new one")
}

if did != "" {
log.Info(ctx, "did already created, skipping", "info", "if you want to create new one, please remove did from vault: 'vault kv delete kv/did'")
//nolint:all
fmt.Printf("\n")
//nolint:all
fmt.Printf(did)
//nolint:all
fmt.Printf("\n")
return
}

keyStore, err := kms.Open(cfg.KeyStore.PluginIden3MountPath, vaultCli)
Expand Down Expand Up @@ -147,13 +156,13 @@ func main() {

log.Info(ctx, "identifier crated successfully")

if cfg.VaultUserPassAuthEnabled {
if err := providers.SaveDID(ctx, vaultCli, identity.Identifier); err != nil {
log.Error(ctx, "error saving identifier to vault", err)
return
}
if err := providers.SaveDID(ctx, vaultCli, identity.Identifier); err != nil {
log.Error(ctx, "error saving identifier to vault", err)
return
}

//nolint:all
fmt.Printf("\n")
//nolint:all
fmt.Printf(identity.Identifier)
//nolint:all
Expand Down
Loading

0 comments on commit 6c19605

Please sign in to comment.