remit2any_auth 0.0.4
remit2any_auth: ^0.0.4 copied to clipboard
A Flutter package for Remit2Any authentication.
Remit2Any Auth Flutter SDK #
A Flutter package for seamless AWS Cognito authentication via WebView for Remit2Any.
Features #
- WebView-based sign-in with Remit2Any
- Secure token storage using flutter_secure_storage
- Fetch user profile from Cognito
- Background token refresh
Installation #
Add to your pubspec.yaml:
dependencies:
remit2any_auth:
path: ../remit2any_auth # or use your published version
Configuration #
- Set your Cognito domain, region, and client ID in
auth_service.dart:- Replace
<your_domain>,<region>, and<CLIENT_ID>with your values.
- Replace
Usage #
import 'package:remit2any_auth/remit2any_auth.dart';
// Sign in (opens WebView)
await signIn();
// Get user info
final user = await getUser();
// Sign out
await signOut();
// Start background token refresh
startTokenRefreshLoop();
Example #
See the example/ app for a working demo.
Security #
- Tokens are stored securely using flutter_secure_storage.
- Only trusted domains are used for WebView.
Flutter Package Publishing #
Prerequisites #
- Dart/Flutter SDK: Ensure you have the latest stable version installed
- pub.dev Account: Create an account at pub.dev
- Google Account: Link your Google account to pub.dev
- Package Name: Ensure your package name is unique on pub.dev
Version Management #
Semantic Versioning
Follow semantic versioning (MAJOR.MINOR.PATCH):
- MAJOR: Breaking changes
- MINOR: New features (backward compatible)
- PATCH: Bug fixes (backward compatible)
Update Version in pubspec.yaml
name: remit2any_auth
description: A Flutter package for Remit2Any authentication
version: 1.0.0 # Update this before publishing
Pre-Publishing Checklist #
-
Update Documentation
- Ensure README.md is complete and accurate
- Update CHANGELOG.md with new changes
- Verify all code examples work
-
Code Quality
# Run static analysis dart analyze # Run tests flutter test # Check for issues flutter doctor -
Package Validation
# Validate package structure dart pub publish --dry-run -
Test the Package
# Test in a local project cd example flutter pub get flutter run
Publishing Steps #
1. Prepare for Publishing
# Navigate to package directory
cd remit2any_auth
# Update version in pubspec.yaml
# Edit pubspec.yaml and increment version number
# Update CHANGELOG.md
# Add entry for new version
2. Validate Package
# Run dry-run to check for issues
dart pub publish --dry-run
# Fix any issues reported
3. Publish to pub.dev
# Publish the package
dart pub publish
# Follow the prompts to authenticate
4. Verify Publication
- Check pub.dev for your package
- Verify all files are uploaded correctly
- Test installation in a new project
Post-Publishing #
1. Update Dependencies
After publishing, update the example app to use the published version:
# In example/pubspec.yaml
dependencies:
remit2any_auth: ^1.0.0 # Use published version
2. Tag Release
# Create git tag
git tag v1.0.0
git push origin v1.0.0
3. Update Documentation
- Update any references to use the published version
- Update installation instructions in README
Publishing Checklist #
- ❌ Update version in
pubspec.yaml - ❌ Update
CHANGELOG.md - ❌ Run
dart analyze(no issues) - ❌ Run
flutter test(all tests pass) - ❌ Run
dart pub publish --dry-run(no issues) - ❌ Test package in example app
- ❌ Publish with
dart pub publish - ❌ Verify package on pub.dev
- ❌ Create git tag
- ❌ Update documentation
Troubleshooting #
Common Issues
-
Package Name Already Taken
- Choose a unique package name
- Check availability on pub.dev
-
Authentication Issues
- Ensure you're logged into pub.dev
- Verify Google account is linked
-
Validation Errors
- Fix all
dart analyzeissues - Ensure all dependencies are compatible
- Fix all
-
Version Conflicts
- Check for version conflicts in dependencies
- Update dependencies if needed
Rollback Procedure
If you need to rollback a published version:
- Publish a new version with fixes
- Update documentation to reflect changes
- Communicate changes to users
Continuous Integration #
Consider setting up CI/CD for automated publishing:
# .github/workflows/publish.yml
name: Publish Package
on:
push:
tags:
- 'v*'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- run: dart analyze
- run: flutter test
- run: dart pub publish --force
License #
MIT