The content of the QR code provided by the Issuer or Verifier will change with the actual release of the Issuer node. Please check the IDEN3MESSAGE_PARSER.md file for more information on how to parse the new QR code content.
This is a Flutter plugin for the Privado ID SDK, which allows you to integrate Privado ID identity system into your Flutter apps.
Please see the example app included in the repository and follow the Privado ID Wallet SDK Documentation.
To use this plugin, add polygonid_flutter_sdk
as a dependency in your pubspec.yaml
file like this
dependencies:
polygonid_flutter_sdk: ^x.y.z
This will get you the latest version.
If you want to test a specific branch of the repository, pull polygonid_flutter_sdk
like this
dependencies:
polygonid_flutter_sdk:
git:
url: ssh://[email protected]/0xPolygonID/polygonid-flutter-sdk.git
ref: branchPathName
To integrate Privado ID Flutter SDK into your Flutter app, follow these steps:
- Import the
polygonid_flutter_sdk
package:
import 'package:polygonid_flutter_sdk/sdk/polygon_id_sdk.dart';
- Initialize the Privado ID Flutter SDK with your environment:
import 'package:flutter/material.dart';
import 'package:polygonid_flutter_sdk/sdk/polygon_id_sdk.dart';
Future<void> main() async {
await PolygonIdSdk.init(
env: EnvEntity(
pushUrl: 'https://push-staging.polygonid.com/api/v1',
ipfsUrl:
"https://[YOUR-IPFS-API-KEY]:[YOUR-IPFS-API-KEY-SECRET]@ipfs.infura.io:5001",
chainConfigs: {
"80002": ChainConfigEntity(
blockchain: 'polygon',
network: 'amoy',
rpcUrl: 'https://rpc-amoy.polygon.technology/',
stateContractAddr: '0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124',
)
},
didMethods: [],
),
);
runApp(const App());
}
See below for details about setting up the environment.
- To be able to authenticate with issuers or verifiers, fetch credentials and generate proofs, you need to download the proof circuit files.
Stream<DownloadInfo> stream =
await PolygonIdSdk.I.proof.initCircuitsDownloadAndGetInfoStream;
For more information on how to use the Privado ID Flutter SDK, please check the example app included in the repository and follow the Privado ID Wallet SDK Documentation
You need to set the environment you are working on in the SDK.
You can either set the environment during initialization (with env
parameter) or later with PolygonIdSdk.setEnv().
The environment object is EnvEntity with:
final String blockchain; # The name of the blockchain (eg: polygon)
final String network; # The network of the blockchain (eg: amoy)
final String web3Url; # URL of the blockchain (eg: https://polygon-amoy.infura.io/v3/)
final String web3ApiKey; # The API key of the web3 URL service (eg: YOUR-INFURA-API-KEY)
final String idStateContract; # The ID state contract (eg: 0x134B1BE34911E39A8397ec6289782989729807a4)
final String pushUrl; # The push notification URL (eg: https://push-staging.polygonid.com/api/v1)
final String ipfsUrl; # The ipfs API URL (eg: https://[YOUR-IPFS-API-KEY]:[YOUR-IPFS-API-KEY-SECRET]@ipfs.infura.io:5001)
Environment | Polygon Amoy | Polygon Main |
---|---|---|
blockchain | polygon | polygon |
network | amoy | main |
web3Url | https://polygon-amoy.infura.io/v3/ | https://polygon-mainnet.infura.io/v3/ |
idStateContract | 0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124 | 0x624ce98D2d27b20b8f8d521723Df8fC4db71D79D |
pushUrl | https://push-staging.polygonid.com/api/v1 | https://push-staging.polygonid.com/api/v1 |
ipfsUrl | https://[YOUR-IPFS-API-KEY]:[YOUR-IPFS-API-KEY-SECRET]@ipfs.infura.io:5001 | https://[YOUR-IPFS-API-KEY]:[YOUR-IPFS-API-KEY-SECRET]@ipfs.infura.io:5001 |
If you want to deploy your own State Contract, please check the contract documentation.
You can get the current env using PolygonIdSdk.I.getEnv().
- Clone this repository.
- Run
build_runner
to generate.g.dart
files:
dart run build_runner build lib test example --delete-conflicting-outputs
For iOS only:
- Add to your app's Podfile the following post_install code:
post_install do |installer|
installer.pods_project.targets.each do |target|
...
end
# polygonid-setup
target.build_configurations.each do |config|
cflags = config.build_settings['OTHER_CFLAGS'] || ['$(inherited)']
cflags << '-fembed-bitcode'
config.build_settings['OTHER_CFLAGS'] = cflags
config.build_settings['SWIFT_VERSION'] = '5.0'
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'
config.build_settings['STRIP_STYLE'] = 'non-global'
end
if target.name == "Pods-Runner"
puts "Updating #{target.name} OTHER_LDFLAGS"
target.build_configurations.each do |config|
xcconfig_path = config.base_configuration_reference.real_path
xcconfig = File.read(xcconfig_path)
new_xcconfig = xcconfig.sub('OTHER_LDFLAGS = $(inherited)', 'OTHER_LDFLAGS = $(inherited) -force_load "${PODS_ROOT}/../.symlinks/plugins/polygonid_flutter_sdk/ios/libwitnesscalc_authV2.a" -force_load "${PODS_ROOT}/../.symlinks/plugins/polygonid_flutter_sdk/ios/libwitnesscalc_credentialAtomicQueryMTPV2.a" -force_load "${PODS_ROOT}/../.symlinks/plugins/polygonid_flutter_sdk/ios/libwitnesscalc_credentialAtomicQuerySigV2.a" -force_load "${PODS_ROOT}/../.symlinks/plugins/polygonid_flutter_sdk/ios/libwitnesscalc_credentialAtomicQueryMTPV2OnChain.a" -force_load "${PODS_ROOT}/../.symlinks/plugins/polygonid_flutter_sdk/ios/libwitnesscalc_credentialAtomicQuerySigV2OnChain.a" -force_load "${PODS_ROOT}/../.symlinks/plugins/polygonid_flutter_sdk/ios/libpolygonid.a" -force_load "${PODS_ROOT}/../.symlinks/plugins/polygonid_flutter_sdk/ios/libbabyjubjub.a"')
File.open(xcconfig_path, "w") { |file| file << new_xcconfig }
end
end
end
end
If you encounter any issues with this SDK, please file an issue. Contributions are also welcome - simply fork this repository, make your changes, and submit a pull request.