Skip to content

Commit

Permalink
Merge pull request #395 from 0xPolygonID/develop
Browse files Browse the repository at this point in the history
Intermediate release with Amoy network support
  • Loading branch information
Emanuel Muroni authored Apr 16, 2024
2 parents c374ec4 + a133c1d commit 5f806b4
Show file tree
Hide file tree
Showing 183 changed files with 9,319 additions and 2,136 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/polygonid_flutter_sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup Flutter SDK
uses: subosito/flutter-action@v2
with:
flutter-version: '3.10.4'
flutter-version: '3.19.3'
channel: 'stable'
cache: true
# instead of "channel: stable", you could be more precise by specifying the exact version of Flutter you're using:
Expand All @@ -37,6 +37,10 @@ jobs:
env:
ENV_POLYGON_MUMBAI: ${{ secrets.ENV_POLYGON_MUMBAI }}
ENV_POLYGON_MAINNET: ${{ secrets.ENV_POLYGON_MUMBAI }}
DEFAULT_ENV: ${{ secrets.DEFAULT_ENV }}
STACKTRACE_ENCRYPTION_KEY: ${{ secrets.STACKTRACE_ENCRYPTION }}
PINATA_GATEWAY: ${{ secrets.PINATA_GATEWAY }}
PINATA_GATEWAY_TOKEN: ${{ secrets.PINATA_GATEWAY_TOKEN }}
run: cd example&&flutter clean&&flutter pub get&&dart run build_runner build --delete-conflicting-outputs

- name: Format
Expand Down Expand Up @@ -72,7 +76,7 @@ jobs:
- name: Setup Flutter SDK
uses: subosito/flutter-action@v2
with:
flutter-version: '3.10.4'
flutter-version: '3.19.3'
channel: 'stable'
cache: true
# instead of "channel: stable", you could be more precise by specifying the exact version of Flutter you're using:
Expand Down
1 change: 0 additions & 1 deletion AUTH.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ This document provides an explanation on how to authenticate with the Polygon ID
blockchain: "polygon",
network: "mumbai",
web3Url: "https://polygon-mumbai.infura.io/v3/",
web3RdpUrl: "wss://polygon-mumbai.infura.io/v3/",
web3ApiKey: "YOUR_API_KEY"
idStateContract: 0x134B1BE34911E39A8397ec6289782989729807a4),
```
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 2.3.0
- New operators for circuit V3 beta 1
- On-chain credential fetch
- Credential proposal objects
- Added support to Polygon Amoy testnet
- Updated environment object
- Update core libraries

## 2.2.9
- Multiple circuits download and circuit V3 support
- Credential rawValue field on the claimDTO and claimEntity
Expand Down
48 changes: 26 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Polygon ID Flutter SDK

[![pub package](https://img.shields.io/badge/pub-2.2.9-blueviolet)](https://pub.dev/packages/polygonid_flutter_sdk)
[![pub package](https://img.shields.io/badge/pub-2.3.0-blueviolet)](https://pub.dev/packages/polygonid_flutter_sdk)
[![build](https://github.com/iden3/polygonid-flutter-sdk/workflows/polygonid_flutter_sdk/badge.svg)](https://github.com/iden3/polygonid-flutter-sdk/actions?query=workflow%3Apolygonid_flutter_sdk)
[![codecov](https://codecov.io/gh/iden3/polygonid-flutter-sdk/branch/develop/graph/badge.svg?token=0SI0XWGXKL)](https://codecov.io/gh/iden3/polygonid-flutter-sdk)
[![license](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://github.com/iden3/polygonid-flutter-sdk/blob/master/LICENSE-APACHE)
Expand Down Expand Up @@ -56,16 +56,22 @@ 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: 'YOUR-INFURA-API-KEY',
idStateContract: '0x134B1BE34911E39A8397ec6289782989729807a4',
await PolygonIdSdk.init(
env: EnvEntity.v1(
pushUrl: 'https://push-staging.polygonid.com/api/v1',
ipfsUrl: "https://[YOUR-IPFS-API-KEY]:[YOUR-IPFS-API-KEY-SECRET]@ipfs.infura.io:5001",
));
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());
}
```
Expand All @@ -90,9 +96,8 @@ You can either set the environment during initialization (with `env` parameter)
The environment object is [EnvEntity](lib/common/domain/entities/env_entity.dart) 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 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)
Expand All @@ -101,15 +106,14 @@ The environment object is [EnvEntity](lib/common/domain/entities/env_entity.dart

### Supported Environments

| Environment | Polygon Mumbai | Polygon Main |
|----------------|:------------------------------------------:|:-------------:|
| blockchain | polygon | polygon |
| network | mumbai | main |
| web3Url | https://polygon-mumbai.infura.io/v3/ | https://polygon-mainnet.infura.io/v3/ |
| web3RdpUrl | wss://polygon-mumbai.infura.io/v3/ | wss://polygon-mainnet.infura.io/v3/ |
| idStateContract | 0x134B1BE34911E39A8397ec6289782989729807a4 | 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 |
| 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](https://docs.iden3.io/contracts/state/).

Expand Down
2 changes: 1 addition & 1 deletion android/sdk.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ext {
sdkVersion = '2.2.9'
sdkVersion = '2.3.0'
}
73 changes: 49 additions & 24 deletions android/src/main/jniLibs/arm64-v8a/libpolygonid.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ extern "C" {
#endif

extern GoUint8 PLGNAuthV2InputsMarshal(char** jsonResponse, char* in, PLGNStatus** status);

// Deprecated: Use PLGNNewGenesisID instead. It supports environment
// configuration, giving the ability to register custom DID methods.
//
extern GoUint8 PLGNCalculateGenesisID(char** jsonResponse, char* in, PLGNStatus** status);
extern GoUint8 PLGNNewGenesisID(char** jsonResponse, char* in, char* cfg, PLGNStatus** status);
extern GoUint8 PLGNCreateClaim(char** jsonResponse, char* in, PLGNStatus** status);

// PLGNIDToInt returns the ID as a big int string
Expand All @@ -110,13 +115,9 @@ extern GoUint8 PLGNProfileID(char** jsonResponse, char* in, PLGNStatus** status)
// Additional configuration may be required for Reverse Hash Service
// revocation validation. In other case cfg may be nil.
//
// Sample configuration:
// The configuration example may be found in the [README.md] file.
//
// {
// "ethereumUrl": "http://localhost:8545",
// "stateContractAddr": "0xEA9aF2088B4a9770fC32A12fD42E61BDD317E655",
// "reverseHashServiceUrl": "http://localhost:8003"
// }
// [README.md]: https://github.com/0xPolygonID/c-polygonid/blob/main/README.md#configuration
//
extern GoUint8 PLGNAtomicQuerySigV2Inputs(char** jsonResponse, char* in, char* cfg, PLGNStatus** status);

Expand All @@ -134,13 +135,9 @@ extern GoUint8 PLGNSigV2Inputs(char** jsonResponse, char* in, PLGNStatus** statu
// Additional configuration may be required for Reverse Hash Service
// revocation validation. In other case cfg may be nil.
//
// Sample configuration:
// The configuration example may be found in the [README.md] file.
//
// {
// "ethereumUrl": "http://localhost:8545",
// "stateContractAddr": "0xEA9aF2088B4a9770fC32A12fD42E61BDD317E655",
// "reverseHashServiceUrl": "http://localhost:8003"
// }
// [README.md]: https://github.com/0xPolygonID/c-polygonid/blob/main/README.md#configuration
//
extern GoUint8 PLGNAtomicQueryMtpV2Inputs(char** jsonResponse, char* in, char* cfg, PLGNStatus** status);

Expand All @@ -158,13 +155,9 @@ extern GoUint8 PLGNMtpV2Inputs(char** jsonResponse, char* in, PLGNStatus** statu
// Additional configuration may be required for Reverse Hash Service
// revocation validation. In other case cfg may be nil.
//
// Sample configuration:
// The configuration example may be found in the [README.md] file.
//
// {
// "ethereumUrl": "http://localhost:8545",
// "stateContractAddr": "0xEA9aF2088B4a9770fC32A12fD42E61BDD317E655",
// "reverseHashServiceUrl": "http://localhost:8003"
// }
// [README.md]: https://github.com/0xPolygonID/c-polygonid/blob/main/README.md#configuration
//
extern GoUint8 PLGNAtomicQuerySigV2OnChainInputs(char** jsonResponse, char* in, char* cfg, PLGNStatus** status);

Expand All @@ -174,13 +167,9 @@ extern GoUint8 PLGNAtomicQuerySigV2OnChainInputs(char** jsonResponse, char* in,
// Additional configuration may be required for Reverse Hash Service
// revocation validation. In other case cfg may be nil.
//
// Sample configuration:
// The configuration example may be found in the [README.md] file.
//
// {
// "ethereumUrl": "http://localhost:8545",
// "stateContractAddr": "0xEA9aF2088B4a9770fC32A12fD42E61BDD317E655",
// "reverseHashServiceUrl": "http://localhost:8003"
// }
// [README.md]: https://github.com/0xPolygonID/c-polygonid/blob/main/README.md#configuration
//
extern GoUint8 PLGNAtomicQueryMtpV2OnChainInputs(char** jsonResponse, char* in, char* cfg, PLGNStatus** status);

Expand All @@ -197,6 +186,42 @@ extern void PLGNFreeStatus(PLGNStatus* status);
extern GoUint8 PLGNCleanCache(PLGNStatus** status);
extern GoUint8 PLGNCacheCredentials(char* in, char* cfg, PLGNStatus** status);

// PLGNW3CCredentialFromOnchainHex returns a verifiable credential from an onchain data hex string.
//
// Sample input:
//
// {
// "issuerDID": "did:polygonid:polygon:mumbai:2qCU58EJgrEMJvPfhUCnFCwuKQTkX8VmJX2sJCH6C8",
// "hexdata": "0x0...",
// "version": "0.0.1"
// }
//
// The configuration example may be found in the [README.md] file.
//
// [README.md]: https://github.com/0xPolygonID/c-polygonid/blob/main/README.md#configuration
//
extern GoUint8 PLGNW3CCredentialFromOnchainHex(char** jsonResponse, char* in, char* cfg, PLGNStatus** status);

// PLGNDescribeID parses ID and return it in different representations.
// Request example:
//
// {"id":"31Akw5AB2xBrwqmbDUA2XoSGCfTepz52q9jmFE4mXA"}
//
// {"idAsInt":"24460059377712687587111979692736628604804094576108957842967948238113620738"}
//
// There is possible to pass both id & idAsInt fields in the request. But if the
// resulted ID would not be equal, error returns.
//
// Response example:
//
// {
// "did": "did:polygonid:linea:testnet:31Akw5AB2xBrwqmbDUA2XoSGCfTepz52q9jmFE4mXA",
// "id": "31Akw5AB2xBrwqmbDUA2XoSGCfTepz52q9jmFE4mXA",
// "idAsInt": "24460059377712687587111979692736628604804094576108957842967948238113620738",
// }
//
extern GoUint8 PLGNDescribeID(char** jsonResponse, char* in, char* cfg, PLGNStatus** status);

#ifdef __cplusplus
}
#endif
Loading

0 comments on commit 5f806b4

Please sign in to comment.