Giter Club home page Giter Club logo

polygonid-flutter-sdk's Introduction

Polygon ID Flutter SDK

pub package build codecov license

Description

This is a Flutter Plugin for Polygon ID Mobile SDK (https://polygon.technology/polygon-id) This plugin provides a cross-platform tool (iOS, Android) to communicate with the PolygonID platform.

Installation

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]/iden3/polygonid-flutter-sdk.git
        ref: branchPathName

Environment

App side

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: mumbai)
  final String web3Url; # URL of the blockchain (eg: https://polygon-mumbai.infura.io/v3/)
  final String web3RdpUrl; # RDP URL (eg: wss://polygon-mumbai.infura.io/v3/)
  final String web3ApiKey; # The API key of the web3 URL service (eg: a536514602ea4e22a2e9007b6e9dbc63)
  final String idStateContract; # The ID state contract (eg: 0x453A1BC32122E39A8398ec6288783389730807a5)
  final String pushUrl; # The push notification URL (eg: https://push.service.io/api/v1)

An example of initialization:

import 'package:flutter/material.dart';
import 'package:polygonid_flutter_sdk/sdk/polygon_id_sdk.dart';

Future<void> main() async {
  await PolygonIdSdk.init(env: EnvEntity(
      blockchain: 'polygon',
      network: 'mumbai',
      web3Url: 'https://polygon-mumbai.infura.io/v3/'
      web3RdpUrl: 'wss://polygon-mumbai.infura.io/v3/'
      web3ApiKey: 'a536514602ea4e22a2e9007b6e9dbc63'
      idStateContract: '0x453A1BC32122E39A8398ec6288783389730807a5'
      pushUrl: 'https://push.service.io/api/v1',
  ));
  runApp(const App());
}

You can get the current env using PolygonIdSdk.getEnv().

Deploy and check

Deploy

  1. Clone this repository.
  2. Run build_runner to generate .g.dart files:
flutter pub run build_runner build --delete-conflicting-outputs

For iOS only:

  1. Add to your app's Podfile the following post_install code:
post_install do |installer|  
  installer.pods_project.targets.each do |target|
    ...
    end
    # polygon-setup
    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/librapidsnark.a" -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/libgmp.a" -force_load "${PODS_ROOT}/../.symlinks/plugins/polygonid_flutter_sdk/ios/libpolygonid.a"')
                      File.open(xcconfig_path, "w") { |file| file << new_xcconfig }
         end
     end
  end
end

Features and bugs

Please file feature requests and bugs at the issue tracker.

Usage

To start using this package first import it in your Dart file.

import 'package:polygonid_flutter_sdk/sdk/polygon_id_sdk.dart';

Notes

P.S. Using iOS simulator for testing wallet sdk is right now under maintenance and will be available soon.

polygonid-flutter-sdk's People

Contributors

rauljareno avatar plumillon avatar plusema86 avatar demonsh avatar mmilenkovic avatar obrezhniev avatar vmidyllic avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.