Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEP-10 Multisig Support #107

Merged
merged 13 commits into from
Jan 31, 2020
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ django-model-utils = "*"
djangorestframework = "*"
whitenoise = "*"
psycopg2-binary = "*"
stellar-sdk = "==2.0.0"
stellar-sdk = "==2.1.1"
django-cors-headers = "*"
toml = "*"
pyjwt = "*"
Expand Down
20 changes: 10 additions & 10 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ environment or included in ``PROJECT_ROOT/.env``.
STELLAR_NETWORK_PASSPHRASE="Test SDF Network ; September 2015"
HORIZON_URI="https://horizon-testnet.stellar.org/"
SERVER_JWT_KEY="yoursupersecretjwtkey"
HOST_URL="https://example.com"

Polaris supports anchoring one or multiple assets on the Stellar network. ``ASSETS``
should be a comma-separated list of asset codes such as "USD", "ETH", or "MYCOIN".
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ environment or included in ``PROJECT_ROOT/.env``.
STELLAR_NETWORK_PASSPHRASE="Test SDF Network ; September 2015"
HORIZON_URI="https://horizon-testnet.stellar.org/"
SERVER_JWT_KEY="yoursupersecretjwtkey"
HOST_URL="https://example.com"

Polaris supports anchoring one or multiple assets on the Stellar network. ``ASSETS``
should be a comma-separated list of asset codes such as "USD", "ETH", or "MYCOIN".
Expand Down
4 changes: 4 additions & 0 deletions polaris/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ SIGNING_SEED="SCY4F6VEIIPXPLTNQSFT5427H64YK3H3LB27H7WAOVDQSV2UACRWTPGM"
# "Public Global Stellar Network ; September 2015" or a custom passphrase
# if you're using a private network.
STELLAR_NETWORK_PASSPHRASE="Test SDF Network ; September 2015"

# HORIZON_URI can point to a custom Horizon URI. It currently points
# to the testnet URL.
HORIZON_URI="https://horizon-testnet.stellar.org/"

SERVER_JWT_KEY="secret"

HOST_URL="https://example.com"
3 changes: 2 additions & 1 deletion polaris/polaris/helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module defines helpers for various endpoints."""
import os
import logging
import codecs
import time
Expand Down Expand Up @@ -109,7 +110,7 @@ def validate_jwt_request(request: Request) -> str:
except InvalidTokenError as e:
raise ValueError(str(e))

if jwt_dict["iss"] != request.build_absolute_uri("/auth"):
if jwt_dict["iss"] != os.path.join(settings.HOST_URL, "auth"):
raise ValueError("'jwt' has incorrect 'issuer'")
current_time = time.time()
if current_time < jwt_dict["iat"] or current_time > jwt_dict["exp"]:
Expand Down
6 changes: 3 additions & 3 deletions polaris/polaris/management/commands/check_trustlines.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import time

from polaris import settings
from django.core.management.base import BaseCommand
from django.core.management import call_command
from stellar_sdk.exceptions import BaseHorizonError

from polaris import settings
from polaris.deposit.utils import create_stellar_deposit
from polaris.models import Transaction
from polaris.helpers import Logger

Expand Down Expand Up @@ -68,4 +68,4 @@ def check_trustlines(self):
f"Account {account['id']} has established a trustline for {asset_code}, "
f"initiating deposit for {transaction.id}"
)
call_command("create_stellar_deposit", transaction.id)
create_stellar_deposit(transaction.id)
4 changes: 2 additions & 2 deletions polaris/polaris/sep10auth/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""This module defines the URL patterns for the `/auth` endpoint."""
from django.urls import path
from polaris.sep10auth.views import auth
from polaris.sep10auth.views import SEP10Auth

urlpatterns = [path("", auth)]
urlpatterns = [path("", SEP10Auth.as_view())]
Loading