Guidance for Authentication with Digital Wallets on AWS
Overview
How it works
This architecture diagram enables you to authenticate with your digital wallet and obtain AWS credentials. Those credentials can be used to access AWS services and to make secure API calls to third-party Web3 APIs.
Well-Architected Pillars
The architecture diagram above is an example of a Solution created with Well-Architected best practices in mind. To be fully Well-Architected, you should follow as many Well-Architected best practices as possible.
Operational Excellence
This Guidance uses the AWS Serverless Application Model (SAM) to define, build, and deploy architecture resources. If Lambda functions and API Gateway encounter failures or errors, you can set up Amazon CloudWatch alarms to address unexpected issues. Review this blog post for more information: How to get notified on specific Lambda function error patterns using CloudWatch.
Security
This Guidance employs a custom authentication flow where users sign a generated message with their digital wallet (crypto wallet) to answer an Amazon Cognito custom challenge, creating identities in the User Pool. Additionally, this Guidance demonstrates two authorization methods for API Gateway: using Amazon Cognito User Pool identity token or Amazon Cognito Identity Pool and AWS Identity and Access Management (IAM) roles for authenticated and unauthenticated users.
You can securely proxy API calls to third-party Web3 provider APIs, a principle applicable to any third-party API. API Gateway secures access to the backend by providing different authorization mechanisms. Data from third-party Web3 APIs is encrypted in transit as it travels through API Gateway to the client decentralized web dApp.
Reliability
This Guidance uses the highly available managed services, Amazon Cognito and API Gateway. Both services generate CloudWatch metrics that can invoke alarms, and detailed API Gateway logs provide visibility into received HTTP requests. These observability features help you monitor the health of the AWS Region in which you deploy the Guidance to support overall reliability of your workloads.
Performance Efficiency
The source code available on GitHub and the SAM template provided in the backend folder can serve as a boilerplate for your own project. You can then configure API Gateway to point to the desired backend API or to run your chosen Lambda function.
Cost Optimization
This Guidance uses Amazon Cognito and API Gateway, both serverless services that offer a free tier for getting started. Amazon Cognito charges are based on the number of monthly active users (MAU) in your User Pool, while API Gateway charges are based on the number of API calls received and the volume of data transferred out.
Sustainability
Wherever possible, this Guidance proxies API requests directly to backend integrations instead of initiating Lambda functions, reducing resource consumption. The Lambda functions involved run only for the required duration. This approach enables a sustainable and cost-effective solution, consuming resources only when necessary.
Disclaimer
Did you find what you were looking for today?
Let us know so we can improve the quality of the content on our pages