Ravi Chandra Asthana
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # gadi-ios-agent ## Requirements * Xcode 10+ ## Installation (**In iOS - objc**) * Clone this repo. * Copy the cloned folder inside the root folder of your project. * Add the following line in your Podfile ``` pod 'gadi-ios-agent', :path => './gadi-ios-agent/' ``` **Note:** in above line `path` can be set to the location of `.podspec` file if the sdk is added locally * Execute following commands at root project in terminal ``` 1. pod repo update 2. pod install ``` ## Methods **1. initSdk( NSString apiURL, int environment )** --- This method is initilize the SDK, without calling the method you can not use SDK functionality. `apiURL`: NSString - endpoint specifying the route where the JSON file is stored `environment`: int - Here we can pass environment type, like Dev, Stage, Prod, (0,1,2) **Example** ``` #import <GadiAgentModule.h> ... [[[GadiAgentModule alloc] init] initSdk:@"json file url" environment:"0"]; ``` **2. createDigitalAddress( NSString apiEndpoint, NSDictionary userDocuments ) -> NSString** --- This method sends an api request to `DAP` to create a digital address for the `Holder`. This method will return response in `NSString` `apiEndpoint`: NSString - endpoint specifying the route where the holder should request the `DAP` for creation of digital address. `userDocument`: NSDictionary - an array of holder documents to be sent to `DAP` as a post request payload. (**NOTE** Please send the `userDocument` as an empty array i.e, `[]`) **Example** ``` #import <GadiAgentModule.h> ... NSString *response = [[[GadiAgentModule alloc] init] createDigitalAddress:@"https://10.10.10.10:3000/da" userDocuments:@[]]; ``` **3. saveDigitalAddress(NSString digitalAddress) -> NSString** --- This method saves the digital address generated by `DAP` agent into local database. **Example** ``` #import <GadiAgentModule.h> ... NSString *response = [[[GadiAgentModule alloc] init] saveDigitalAddress:@"did:gadi:bba04f6985f560446c122d235ed2e51bf7c10864"]; ``` **4. getDigitalAddress() -> NSString** --- This method returns the digital address generated by DAP and saved in local database by createDigitalAddress method. **Example** ``` #import <GadiAgentModule.h> ... NSString *results = [[[GadiAgentModule alloc] init] getDigitalAddress]; ``` **5. getAgentUrl() -> NSString** --- This method returns the mediator agent url discovered from DAP and saved in local database. **Example** ``` #import <GadiAgentModule.h> ... NSString *results = [[[GadiAgentModule alloc] init] getMediatorAgentUrl]; ``` **6. registerDAP(NSString label, NSString digitalAddress) -> NSString** --- This method registers holder's digital address on mediator agent. **Example** ``` #import <GadiAgentModule.h> ... NSString *receive = [[[GadiAgentModule alloc] init] registerWithMediatorAgent:@"ANY RANDOM NAME" digitalAddress:@"DIGI ADDRESS RECEIVED FROM getDigitalAddress"]; ``` **7. storeCredentials(NSDictionary credDetails, NSString credTag) -> NSString** --- This method stores all the credentials which are issued or self attested. **Example** ``` #import <GadiAgentModule.h> ... NSString *storeResponse = [[[GadiAgentModule alloc] init] storeCredentials:@{@"name": @"john"} credentialsTag:@"SELF_ATTESTED"]; ``` **8. getCredentials() -> NSArray** --- This method returns all the credentials saved locally. **Example** ``` #import <GadiAgentModule.h> ... NSArray *getCreds = [[[GadiAgentModule alloc] init] getCredentials]; ``` **9. saveFcmToken() -> NSString** --- This method saves the generated FCM token to local db. **Example** ``` #import <GadiAgentModule.h> ... NSString *saveFCMToken = [[[GadiAgentModule alloc] init] saveFcmToken:@"YOUR_FCM_TOKEN"]; ``` **10. getFcmToken() -> NSString** --- This method returns the generated FCM token from local db. **Example** ``` #import <GadiAgentModule.h> ... NSString *getFCMToken = [[[GadiAgentModule alloc] init] getFcmToken]; ``` **11. getCredentialDetailsFromRecordID((NSString recordId, NSString digitalAddress, NSString endPointUrl)) -> NSDictionary** --- recordId: NSString - recordId will be received in a payload of notification. digitalAddress: NSString- digitalAddress will be received in a response of decodeQRcode() method. endPointUrl: NSString - endPointUrl will be received in a payload of notification. This method request to API to receive a credential detail. And this will be executed when the holder receives a notification of type as CREDENTIAL_ISSUED in notification payload. **Example** ``` #import <GadiAgentModule.h> ... NSDictionary *result = [[[GadiAgentModule alloc] init] getCredentialDetailsFromRecordID(recordId: "RECORD ID", digitalAddress: "DIGITAL ADDRESS", endPointUrl: "ENDPOINT URL")]; ``` **12. acceptConnectionInvitation(NSString digitalAddress, NSString invitationLink, NSString spOrg, int allowDuplicate ) -> NSDictionary** --- invitationLink: String- invitationLink: String- invitationLink will be received after scan a QR code.digitalAddress: String- digitalAddress will be received in a response of decodeQRcode() method/you can get from getDigitalAddress() method of sdk. allowDuplicate:int - allowDuplicate will be received after scan a QR code spOrg : String - spOrg will be received after scan a QR code This method accepts a connection invitation by using the Shared Agent API. And same time store connection in local DB using storeConnection() method. Example ``` #import <GadiAgentModule.h> … NSDictionary *acceptInvitationResponse = [[GadiAgentModule alloc] init] acceptConnectionInvitation:@“Invitation Link”,@“Digital Address”,@"spOrg",@"allowDuplicate value in int"]; ``` **13. storeConnection(NSDictionary *connection)-> NSString** --- This method stores details of connection in local DB. **Example** ``` #import <GadiAgentModule.h> NSString *storeResponse = [[[GadiAgentModule alloc] init] storeConnection:@"connection dictionary"]; ``` **14. getConnections() -> NSArray** --- This method returns a list of connections stored in local DB. **Example** ``` #import <GadiAgentModule.h> ... NSArray *getConnections = [[GadiAgentModule alloc] init] getConnections]; ``` **15. sendConsentForCredentialRequest(NSString endPointUrl, NSString recordId, NSString digitalAddress, Bool isAcceptConsent) -> NSDictionary** --- endPointUrl: NSString - endPointUrl specifying Shared Agent API, which will be receiving in a payload of notification as CONSENT_ENDPOINT . recordId: NSString - recordId will be receiving in a payload of notification. digitalAddress: NSString- digitalAddress will be receiving in a response of decodeQRcode() method. isAcceptConsent: Bool - boolean specifying an accept/decline consent. true/false This method sends consent to Shared Agent for issued Credential for the Holder. This method will return response in NSDictionary. **Example** ``` #import <GadiAgentModule.h> ... NSDictionary *acceptInvitationResponse = [[GadiAgentModule alloc] init] sendConsentForCredentialRequest:@"End Point Url",@"RecodId",@"Digital Address",@"true/false"]; ``` **16. sendConsentForProofRequest(NSString proofRecordId, NSString digitalAddress, NSString endPointUrl) -> NSDictionary** --- endPointUrl: NSString - endPointUrl specifying Shared Agent API, which will be receiving in a payload of notification as PROOF_REQUEST .recordId: NSString - recordId will be receiving in a payload of notification.digitalAddress: NSString- digitalAddress will be receiving in a response of decodeQRcode() method. This method sends consent to Shared Agent for proof request.This method will return response in NSDictionary. **Example** ``` #import <GadiAgentModule.h> ... NSDictionary *response = [[GadiAgentModule alloc] init] sendConsentForProofRequest:@"Proof Record ID",@"Digital Address",@"End Point Url"]; ``` **16. deleteConnection(NSString connectionId, NSString digitalAddress) -> NSString** --- NSString - connectionId , Need to pass connectionId to delete the specific connection record. NSString - digitalAddress will be receiving in a digital address from getDigitalAddress() Note: could not delete defult connection. **Example** ``` #import <GadiAgentModule.h> ... NSString *response = [[GadiAgentModule alloc] init] deleteConnection:@"connection ID",@"Digital Address"]; ``` **17. decodeQRcode(NSString encodedString) -> NSDictionary** --- This method returns the decoded value of QR code. **Example** ``` #import <GadiAgentModule.h> #import <Realm/Realm.h> ... NSDictionary *getDecodedValue = [[[GadiAgentModule alloc] init] decodeQRcode:@"ENCODED STRING"]; ``` **17. registerToken -> NSDictionary** --- This method registers a FCM token by using the Shared Agent API. This will help to receive a notification for issue credential, proof verification and etc. (NOTE Before executing this method, digital address and fcm token must be saved using saveDigitalAddress() and saveFcmToken() method respectively. ) **Example** ``` #import <GadiAgentModule.h> ... NSString *response = [[GadiAgentModule alloc] init] registerToken]; ``` **19. getConnectionInvitation(NSString endPointUrl, NSString recordID, NSString digitalAddress, NSString spOrg, NSNumber consent, int allowDuplicate) -> NSDictionary** --- endPointUrl: String - endPointUrl specifying Shared Agent API, which will be receiving in a payload of notification as CONNECTION_REQUEST . recordId: String - recordId will be receiving in a payload of notification. digitalAddress: String- digitalAddress will be receiving in a response of decodeQRcode() or getDigitalAddress() method. spOrg: String - orgName is organization name. It will be receiving in a payload of notification. consent: int - int specifying an accept/decline consent. Here, 1 for accept a consent and 0 for decline a consent. allowDuplicate: int- allowDuplicate will be received. Here, 1 for allow duplicate and 0 for not allow duplicate . (NOTE Please set a default 1 for allowDuplicate ) This method will be called once receive a notification of notification type CONNECTION_REQUEST. This method accepts a connection invitation by using the Shared Agent API. And same time store connection in local DB using storeConnection() method. **Example** ``` #import <GadiAgentModule.h> ... NSDictionary *response = [[GadiAgentModule alloc] init] getConnectionInvitation:@"API URL" recordId:@"RECORD ID" digitalAddress:@"DIGITAL ADDRESS" spOrg:@"ORG NAME" consent:[NSNumber numberWithInt:1] allowDuplicate:1]; ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully