Skip to content

blockmatic-icebox/powerstack-common

Repository files navigation

PowerStack Auth

PowerStack JWT authentication server.

⚡️ PowerStack: a powerful fullstack development framework.

Disclaimer: This is a work in progress. Will be finalized soon.

Core Features:

  • 🔑 Multiple web2 and web3 sign-in methods.
  • ✨ Integrates with Hasura Engine permissions
  • 🔐 JWT tokens and refresh tokens.

Sign in methods:

  • Email and Password - simple email and password method.
  • Email - also called passwordless email or magic link.
  • Anonymous - sign in users without any method. Anonymous users can be converted to regular users.
  • Auth providers:
    • Metamask
    • Phantom
    • Anchor
    • GitHub
    • Twitter
    • GitLab
    • BitBucket
    • Facebook
    • Google

JWT and OAuth2

JSON Web Tokens are an open, industry standard RFC 7519 method for representing claims securely between two parties

jwt.io allows you to decode, verify and generate JWT.

OAuth 2.0 is the industry-standard protocol for authorization. Learn more at oauth.net/2/

image

JWT Payload Standard

{
  username: 'powerstack',
  address: '0x',
  auth_method: 'web3_solana',
  ['https://hasura.io/jwt/claims']: {
    'x-hasura-allowed-roles': ['user'],
    'x-hasura-default-role': 'user',
    'x-hasura-user-username': 'powerstack',
    'x-hasura-user-address': '0x',
    'x-hasura-user-auth-method': 'web3_solana',
  },
},

Docker

# Build the image
docker build -t powerstack-auth:local .

# Start a container
docker run --name powerstack-auth --env-file .env -p 4001:4001 -d powerstack-auth:local

# Get container ID
docker ps -aqf "name=^powerstack-auth$"

# Print app output
docker logs -f powerstack-auth

# Stop, start, restart, kill
docker stop powerstack-auth
docker start powerstack-auth
docker restart powerstack-auth
docker kill powerstack-auth

Contributing

We use a Discussions Board to gather thoughts, bug reports and feature requests from the community.

Follow the standard Github Flow for PRs. Contributing Guidelines.

Blockmatic

Blockmatic is building a robust ecosystem of people and tools for the development of blockchain applications.

blockmatic.io

Blockmatic Twitter Blockmatic Facebook Blockmatic Github