Skip to content

gridy-dart-client

Requirements

  • Dart 2.15.0+ or Flutter 2.8.0+
  • Dio >=4.0.1 <5.0.0 (https://pub.dev/packages/dio)

Installation & Usage

pub.dev

To use the package from pub.dev, please include the following in pubspec.yaml

dependencies:
  gridy_mfa_client: 1.0.0

Local development

To use the package from your local drive, please include the following in pubspec.yaml

dependencies:
  gridy_mfa_client:
    path: /path/to/gridy_mfa_client

Getting Started

Please follow the installation procedure and then run the following:

import 'package:gridy_mfa_client/gridyapi.dart';

final api = GridyClient()
    .setHmacAuth('<Your 9-digit API User ID>','<Your API Secret Key>')
    .getGridyIDServiceApi();

    ApiRequest request = ApiRequest( (r) =>
    r
      ..id = 'Your refernence ID'
      ..utcTime = DateTime.now()
          .toUtc().millisecondsSinceEpoch
          .toString()
      ..type = API_CHALLENGE_SEND
      ..apiUser = '<Your 9-digit Api User ID>'
      ..body = {
              "gridyUser": "<User Email Address>",
              "challengeType": <"UserKeyAndPattern"|"UserKeyPatternAndPin"|"UserKeyAndUserPin"|"UserKeyAndUserFace"|"UserKeyAndUserVoice" >,
                "challengeExpiry": <"ThreeMins"|"FiveMins"|"TenMins"|"FifteenMins"|"ThirtyMins"|"SixtyMins">,
                "enableQRCode": <true|false>,
                "enableAutoVerify": <true|false>,
                "profile": "<Your Assigned User Profile Reference>",
                "status": "NEW"
            }
    );

  try {
    final response = await api.challenge(apiRequest);
    final _dresponse = ApiResponse( (r) =>
    r
      ..id = _response.data?.id
      ..utcTime = _response.data?.utcTime
      ..status = _response.data?.status
      ..message = _response.data?.message
      ..code = _response.data?.code
      ..moreInfo = _response.data?.moreInfo
    );

    print(response);

  } catch on DioException (e) {
    print("Exception when calling GridyIDServiceApi->challenge: $e\n"); 
  }

Documentation & Examples for API Endpoints

All URIs are relative to https://api.gridy.io

Class Method HTTP request Description
GridyIdServiceApi challenge POST /v1/svc/challenge Send or Cancel a Gridy ID MFA challenge request.
GridyIdServiceApi verify POST /v1/svc/verify Verify a Gridy ID authentication code
GridyIdServiceApi status POST /v1/svc/status Check a Gridy ID MFA challenge status
GridyIdServiceApi time POST /v1/svc/time Get current UTC time
GridyIdServiceApi blocked POST /v1/svc/blocked Check API User defined Blocked Rule