# NB Orbit Edge SDK NB Orbit Edge SDK is an easy-to-use SDK to build an SSI Wallet. In this document, you will find the full list of methods that will help you build your Mobile Wallet. ## Agent Setup ```typescript agentSetup(agentConfig: AgentConfig) ``` **Description:** This method is used to start the Aries agent when the user sets up the onboarding process and begins the application. Parameters: **Parameters:** AgentConfig: object – Other config option like auto accept credential, auto accept connection response, register multiple ledgers etc. ```json { "label": string, "mediatorInvite": string, "walletId": string, "walletKey": string, "autoAcceptConnections": boolean, "autoAcceptCredentialOffers": boolean, "autoAcceptProofRequests": boolean, "indyLedgers": Array[], "defaultLanguage"?: string, } ``` **Return:** When called, this method will first create a wallet on the local device using a wallet secret. It will then create a pairwise DID to establish a connection with the mediator agent. Once the connection is completed, it will return an Aries agent instance that can be used to interact with the agent's functionality and data. If we don't pass `defaultLanguage` SDK will pickup english as default ```typescript nbAgent ``` --- ```typescript getAllSupportedLanguage() ``` **Description:** This method is used to get a list of supported languages in the SDK. **Parameters:** NA **Return:** This method will return a list of supported languages in JSON format. ```json [{ "language": "English", "code": "en" }, { "language": "French", "code": "fr" }] ``` --- ```typescript changeDefaultLanguage(languageCode: string) ``` **Description:** You can use this method to switch to a different language. **Parameters:** languageCode: string – pass language code that we want to set. Example EN, FR **Return:** void --- ## Connection ```typescript receiveInvitation(invitationUrl: string) ``` **Description:** This method is used to establish a connection with other Aries agents. **Parameters:** invitationUrl: string – String URL that containing a base64 encoded invitation. **Return:** This method will return a Connection record, which contains information about the established connection with another Aries agent. ```json { "outOfBandRecord": { "_tags": { "recipientKeyFingerprints": [ "z6MkmSH6FHyZosXaJDC9JsdYRoMZ8SdgiGBrwEfSe6a624MJ" ], "state": "initial", "invitationId": "8daf9ca9-a685-4924-b573-b61378fac8be", "role": "receiver" }, "metadata": {}, "id": "7f050c20-07eb-4154-84a2-514f85df630f", "createdAt": "2023-04-13T09:34:54.129Z", "outOfBandInvitation": { "@type": "https://didcomm.org/out-of-band/1.1/invitation", "@id": "8daf9ca9-a685-4924-b573-b61378fac8be", "label": "Northern Block", "accept": [ "didcomm/aip1", "didcomm/aip2;env=rfc19" ], "handshake_protocols": [ "https://didcomm.org/connections/1.0" ], "services": [ { "id": "#inline", "serviceEndpoint": "https://didcomm.demo.nborbit.id", "type": "did-communication", "recipientKeys": [ "did:key:z6MkmSH6FHyZosXaJDC9JsdYRoMZ8SdgiGBrwEfSe6a624MJ" ], "routingKeys": [] } ], "imageUrl": "https://i.imgur.com/g3abcCO.png" }, "role": "receiver", "state": "prepare-response", "autoAcceptConnection": true, "reusable": false }, "connectionRecord": { "_tags": {}, "metadata": {}, "id": "8414dc4b-1f2c-4bfe-aef1-27a00daa7b54", "createdAt": "2023-04-13T09:34:54.983Z", "did": "did:peer:1zQmZaAmCUhv11Gxu9XmHjo1uSY5pL2pZWBdBtaW2Ekg4FWu", "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kaWRjb21tLmRlbW8uYW5pbW8uaWQiLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWttU0g2Rkh5Wm9zWGFKREM5SnNkWVJvTVo4U2RnaUdCcndFZlNlNmE2MjRNSiN6Nk1rbVNINkZIeVpvc1hhSkRDOUpzZFlSb01aOFNkZ2lHQnJ3RWZTZTZhNjI0TUoiXSwiciI6W119", "theirLabel": "Northern Block", "state": "request-sent", "role": "requester", "autoAcceptConnection": true, "threadId": "6707bb93-20d2-42c9-85c6-06e7a7515c6a", "imageUrl": "https://i.imgur.com/g3abcCO.png", "protocol": "https://didcomm.org/connections/1.0", "outOfBandId": "7f050c20-07eb-4154-84a2-514f85df630f" } } ``` --- ```typescript getAllByQuery(connectionId?: string, state?: string) ``` **Description:** This method returns a connection record based on parameters. If we don't pass anything, it will return all the connection records. **Parameters:** connectionId?: string – Connection record id. state?: string – Connection states, such as 'invitation-sent', 'invitation-received', 'completed'. **Return:** This method will return all connection record. ```json [ { "_tags": { "did": "did:peer:1zQmS1ndBjyQp2DBTVqRaKddEauE2ZJcRfCJBJt6r97qhTqU", "role": "requester", "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9odHRwLW1lZGlhdG9yLm5ib3JiaXQuY29tIiwidCI6ImRpZC1jb21tdW5pY2F0aW9uIiwicHJpb3JpdHkiOjAsInJlY2lwaWVudEtleXMiOlsiZGlkOmtleTp6Nk1rbkRuR1RudlJWaU5GWUFOSkcyN01HWG5BUGtaZ1ltNFJrVU1ZOEFCZ1FzNVojejZNa25EbkdUbnZSVmlORllBTkpHMjdNR1huQVBrWmdZbTRSa1VNWThBQmdRczVaIl19", "state": "completed", "threadId": "8fe09f4c-7448-4463-b8a3-75eba7358276", "theirDid": "did:peer:1zQmYRMEuyj6rMKQasRKDCLxmBkzHiugXCAu93kgDFTuaCMS", "outOfBandId": "26be5924-0fba-437f-8ab7-e05db14149b0" }, "metadata": {}, "id": "2b6b0a47-412b-4b22-8b01-5ec09e56a403", "createdAt": "2023-04-13T09:34:13.836Z", "did": "did:peer:1zQmS1ndBjyQp2DBTVqRaKddEauE2ZJcRfCJBJt6r97qhTqU", "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9odHRwLW1lZGlhdG9yLm5ib3JiaXQuY29tIiwidCI6ImRpZC1jb21tdW5pY2F0aW9uIiwicHJpb3JpdHkiOjAsInJlY2lwaWVudEtleXMiOlsiZGlkOmtleTp6Nk1rbkRuR1RudlJWaU5GWUFOSkcyN01HWG5BUGtaZ1ltNFJrVU1ZOEFCZ1FzNVojejZNa25EbkdUbnZSVmlORllBTkpHMjdNR1huQVBrWmdZbTRSa1VNWThBQmdRczVaIl19", "theirLabel": "Mediator", "state": "completed", "role": "requester", "autoAcceptConnection": true, "threadId": "8fe09f4c-7448-4463-b8a3-75eba7358276", "protocol": "https://didcomm.org/connections/1.0", "outOfBandId": "26be5924-0fba-437f-8ab7-e05db14149b0", "theirDid": "did:peer:1zQmYRMEuyj6rMKQasRKDCLxmBkzHiugXCAu93kgDFTuaCMS" } ] ``` --- ```typescript deleteConnectionById(connectionId: string) ``` **Description:** This method will delete the connection record that matches the provided connection Id. **Parameters:** connectionId: string – Connection record id. **Return:** void --- ## Credential ```typescript isIssuerAuthorizedIssuer(didDocument: DidDocument, credDefId: string) ``` **Description:** This method is used to check whether the issuer is registered in the trust registry or not. **Parameters:** didDocument: json– DidDocument json object. credDefId: string– credential definition id. **Return:** When called, this method will return boolean value. ```typescript { "isAuthorizedIssuer":true, "isIssuerAllowToIssueCredential": true } ``` --- ```typescript acceptCredentialOffer(credentialRecordId: string, deleteConnection?: boolean) ``` **Description:** This method is used to accept a credential offer that was received from the issuer agent. **Parameters:** credentialRecordId: string – Credential record id. deleteConnection?: boolean – Once the offer is accepted, the connection record will be removed. Default value is false. **Return:** When called, this method will return a credential record, which contains information about an accepted credential. ```json { "_tags": { "state": "offer-received", "threadId": "784b19b3-7a2d-4ceb-940d-29d514a9f336", "connectionId": "8414dc4b-1f2c-4bfe-aef1-27a00daa7b54" }, "metadata": { "_internal/indyRequest": { "master_secret_blinding_data": { "v_prime": "15596710549845893255102044141584149851700357233227838588488665279742517601315488823109621898352262279104527158712473509582043063422793848408018403604399476867311611116467562309020943317682358014682151898137301073352926659475539970102275919477812495398993262090364511632340135573021501871606028330419789513923050099537666917871573056808234763737489029245506989260024549067966123794591708704448192774000706104958579390195230787860140755026853593677790112566628364431170950627706896016996741510514902272932577146713818159136795572413274211667720161759234534592728674008329395207710512263206298741835403481253191941072287324108711731971384116863", "vr_prime": null }, "nonce": "203619559393918156989758", "master_secret_name": "5cc09238-b081-46ca-a696-6eede04aec7d" }, "_internal/indyCredential": { "credentialDefinitionId": "Y75Xcr8rm2PGtzZAsZgTYC:3:CL:634386:Northern Block ID Card", "schemaId": "Y75Xcr8rm2PGtzZAsZgTYC:2:Northern Block ID:1.1" } }, "credentials": [], "id": "582482a9-bbd3-4fb1-b7a7-de047f58422b", "createdAt": "2023-04-13T09:41:32.549Z", "state": "request-sent", "connectionId": "8414dc4b-1f2c-4bfe-aef1-27a00daa7b54", "threadId": "784b19b3-7a2d-4ceb-940d-29d514a9f336", "protocolVersion": "v1", "credentialAttributes": [ { "mime-type": "text/plain", "name": "Name", "value": "Noah Müller" }, { "mime-type": "text/plain", "name": "Date of birth", "value": "19940904" }, { "mime-type": "text/plain", "name": "Street", "value": "Dorfstrasse 23" }, { "mime-type": "text/plain", "name": "City", "value": "Zürich" }, { "mime-type": "text/plain", "name": "Nationality", "value": "Switzerland" } ] } ``` --- ```typescript declineCredentialOffer(credentialRecordId: string, reason: string, deleteConnection?: boolean) ``` **Description:** This method is used to decline a credential offer that was received from the issuer agent. **Parameters:** credentialRecordId: string – credential record id. reason: string- reason for decline the offer deleteConnection?: boolean – Once the offer is declined, the connection record will be removed. Default value is false. **Return:** When called, this method will return a credential record with decline status. ```json { "_tags": { "state": "offer-received", "threadId": "c203f88d-d40d-4700-a1e9-7376aae998d6", "connectionId": "88eb9032-a5e7-4976-a63a-923a3a4167b9" }, "metadata": {}, "credentials": [], "id": "d4132775-328b-4116-b7b5-7a81edadcd49", "createdAt": "2023-04-13T09:51:57.057Z", "state": "declined", "connectionId": "88eb9032-a5e7-4976-a63a-923a3a4167b9", "threadId": "c203f88d-d40d-4700-a1e9-7376aae998d6", "protocolVersion": "v1" } ``` --- ```typescript secureMessageForCredential(credentialRecordId: string, message: string) ``` **Description:** This method is used to send secure message and chat for particular credential. **Parameters:** credentialRecordId: string – credential record id. message: string- reason for decline the offer **Return:** void --- ```typescript getSecureMessageForCredential(credentialRecordId: string) ``` **Description:** This method is used to fetch secure message history for particular credential offer. **Parameters:** credentialRecordId: string – credential record id. **Return:** Method will return chat history for particular credential offer ```json [{ "content": "Hi, Can you please help me?", "sentTime": "2023-04-13T10:09:52Z", "connectionId": "8414dc4b-1f2c-4bfe-aef1-27a00daa7b54", "threadId": "784b19b3-7a2d-4ceb-940d-29d514a9f336", "role": "sender", "parentThreadId": "687b19b3-7a2d-5ceb-111d-29d514a9f565", "tags": "SSI" }] ``` --- ```typescript getAllIssueCredentialByIssuer(publicDid: string) ``` **Description:** You can use this method to obtain a list of credentials that have been issued to the holder by the issuer. **Parameters:** publicDid: string – public Did of issuer. **Return:** When called, this method will return a credential list. ``` json [{ "credentialDefinitionId": "Y75Xcr8rm2PGtzZAsZgTYC:3:CL:634386:Northern Block Card", "schemaId": "Y75Xcr8rm2PGtzZAsZgTYC:2:Northern Block ID:1.1" "schemaName": "CREDEBL-PLA", "schemaVersion": "1.0", "schemaAttrNames": [ "Role", "Org Id", "Issue Date", "Email", "Full Name" ], "schemaSeqNo": 12 }] ``` --- ```typescript proposeCredential(option: ProposeCredentialOptions) ``` **Description:** This method is used to send credential proposal to issuer. **Parameters:** option: ProposeCredentialOptions – Additional configuration to use for the proposal. **Return:** When called, this method will return a credential record. ```json { "_tags": { "state": "proposal-sent", "connectionId": "c4fbcb7e-7f5a-42d3-8044-8150dbf519a4", "threadId": "88b42441-1689-4d38-b6b8-3041f7e90904" }, "metadata": { "_internal/indyRequest": { "master_secret_blinding_data": { "v_prime": "21892234403702853399528416626463017992608452268692574532352558301814516422357503270735120530955866169156459483416931449158088629063328913515899900160200218988446654056367883428502551501131003918610818675700189232819480332574907621872871696268530850037391581349797925129294564734763510612865337055682419577702162921162475636542159519896866810100363047246410901960521877244038772284898392240074697913428187101237715996180766182764331757894382399668249209287556779306671796570603297615849418751737901911500892880392354443266549887885240867136350836315842586129401521066734616648498073095637707066757567598412171378788887110535926245887287470368", "vr_prime": null }, "nonce": "16126304571475567215186", "master_secret_name": "d2878ff2-6664-4fd5-80d5-aa238a948faa" }, "_internal/indyCredential": { "credentialDefinitionId": "Y75Xcr8rm2PGtzZAsZgTYC:3:CL:634386:Northern Block ID Card", "schemaId": "Y75Xcr8rm2PGtzZAsZgTYC:2:Northern Block ID:1.1" } }, "credentials": [ { "credentialRecordType": "indy", "credentialRecordId": "034a2420-b057-46fa-a85a-8c1342aaa24f" } ], "id": "c6b5f243-9848-45df-b565-c54ba04457ee", "createdAt": "2023-04-13T09:56:10.324Z", "state": "proposal-sent", "connectionId": "c4fbcb7e-7f5a-42d3-8044-8150dbf519a4", "threadId": "88b42441-1689-4d38-b6b8-3041f7e90904", "protocolVersion": "v1", "credentialAttributes": [ { "mime-type": "text/plain", "name": "Name", "value": "Jan van Dalen" }, { "mime-type": "text/plain", "name": "Date of birth", "value": "19990101" }, { "mime-type": "text/plain", "name": "Street", "value": "Ambachtstraat 61" }, { "mime-type": "text/plain", "name": "City", "value": "Utrecht" }, { "mime-type": "text/plain", "name": "Nationality", "value": "The Netherlands" } ] } ``` --- ```typescript getAllByQuery(credentialRecordId?: string, state?: string) ``` **Description:** This method returns a credential record based on parameters. If we don't pass anything, it will return all the credential records. **Parameters:** connectionId?: string – Credential record id. state?: string – Credential states, such as offer-received, request-sent, credential-received. **Return:** This method will return credential records. ```typescript [ { "_tags": { "state": "request-sent", "connectionId": "c4fbcb7e-7f5a-42d3-8044-8150dbf519a4", "threadId": "88b42441-1689-4d38-b6b8-3041f7e90904" }, "metadata": { "_internal/indyRequest": { "master_secret_blinding_data": { "v_prime": "21892234403702853399528416626463017992608452268692574532352558301814516422357503270735120530955866169156459483416931449158088629063328913515899900160200218988446654056367883428502551501131003918610818675700189232819480332574907621872871696268530850037391581349797925129294564734763510612865337055682419577702162921162475636542159519896866810100363047246410901960521877244038772284898392240074697913428187101237715996180766182764331757894382399668249209287556779306671796570603297615849418751737901911500892880392354443266549887885240867136350836315842586129401521066734616648498073095637707066757567598412171378788887110535926245887287470368", "vr_prime": null }, "nonce": "16126304571475567215186", "master_secret_name": "d2878ff2-6664-4fd5-80d5-aa238a948faa" }, "_internal/indyCredential": { "credentialDefinitionId": "Y75Xcr8rm2PGtzZAsZgTYC:3:CL:634386:Northern Block ID Card", "schemaId": "Y75Xcr8rm2PGtzZAsZgTYC:2:Northern Block ID:1.1" } }, "credentials": [ { "credentialRecordType": "indy", "credentialRecordId": "034a2420-b057-46fa-a85a-8c1342aaa24f" } ], "id": "c6b5f243-9848-45df-b565-c54ba04457ee", "createdAt": "2023-04-13T09:56:10.324Z", "state": "done", "connectionId": "c4fbcb7e-7f5a-42d3-8044-8150dbf519a4", "threadId": "88b42441-1689-4d38-b6b8-3041f7e90904", "protocolVersion": "v1", "credentialAttributes": [ { "mime-type": "text/plain", "name": "Name", "value": "Jan van Dalen" }, { "mime-type": "text/plain", "name": "Date of birth", "value": "19990101" }, { "mime-type": "text/plain", "name": "Street", "value": "Ambachtstraat 61" }, { "mime-type": "text/plain", "name": "City", "value": "Utrecht" }, { "mime-type": "text/plain", "name": "Nationality", "value": "The Netherlands" } ] }, { "_tags": { "threadId": "c203f88d-d40d-4700-a1e9-7376aae998d6", "connectionId": "88eb9032-a5e7-4976-a63a-923a3a4167b9", "state": "declined" }, "metadata": {}, "credentials": [], "id": "d4132775-328b-4116-b7b5-7a81edadcd49", "createdAt": "2023-04-13T09:51:57.057Z", "state": "declined", "connectionId": "88eb9032-a5e7-4976-a63a-923a3a4167b9", "threadId": "c203f88d-d40d-4700-a1e9-7376aae998d6", "protocolVersion": "v1" } ] ``` --- ```typescript deleteCredentialRecordById(credentialRecordId: string) ``` **Description:** This method will delete the credential record that matches the provided credential Id. **Parameters:** credentialRecordId: string – credential record id **Return:** void --- ## Proof ```typescript isIssuerAuthorizedVerifier(didDocument: DidDocument, schemaId: string[], credDefId: string[]) ``` **Description:** This method is used to check whether the verifier is registered in the trust registry or not. **Parameters:** didDocument: json – DidDocument json object. schemaId: string[] - Array of schema id that requested into the proof request credDefId: string[] - Array of credential definition id that requested into the proof request **Return:** When called, this method will return boolean value. ```json { "isAuthorizedVerifier":true, "isAuthorizedVerifierForSchema": [{ "schema": "Y75Xcr8rm2PGtzZAsZgTYC:2:Northern Block ID:1.1", "isAuthorized": true }], "isAuthorizedVerifierForCredDef":{[ "CredDef": "Y75Xcr8rm2PGtzZAsZgTYC:3:CL:634386:Northern Block ID Card", "isAuthorized": true ]} } ``` --- ```typescript acceptProofRequest(proofRecordId: string, deleteConnection?: boolean) ``` **Description:** This method is used to accept a proof request that was received from the verifier agent. **Parameters:** proofRecordId: string – Proof record id. deleteConnection?: boolean – Once the proof request is accepted, the connection record will be removed. Default value is false. **Return:** When called, this method will return a proof record, which contains information about a proof detail. ```json { "_tags": { "connectionId": "0dcb1aee-d159-4cf3-8378-16de514b4f9a", "state": "request-received", "threadId": "b8ff755a-75c2-42f2-986c-41ace73833a4" }, "connectionId": "0dcb1aee-d159-4cf3-8378-16de514b4f9a", "createdAt": "2023-04-13T10:18:33.331Z", "id": "a60da42b-cce6-4f6e-9c48-5196e5209a11", "metadata": {}, "protocolVersion": "v1", "state": "presentation-sent", "threadId": "b8ff755a-75c2-42f2-986c-41ace73833a4" } ``` --- ```typescript declineProofRequest(proofRecordId: string, reason: string, deleteConnection?: boolean) ``` **Description:** This method is used to decline a proof request that was received from the verifier. **Parameters:** proofRecordId: string – Proof record id. reason: string- reason for decline the proof request. deleteConnection?: boolean – Once the proof request is declined, the connection record will be removed. Default value is false. **Return:** When called, this method will return a proof record. ```json { "_tags": { "connectionId": "90fee5d0-f69b-46a6-95ac-968e4f804de7", "threadId": "13cb2965-7f2c-4ae7-ab06-1b97df10d2f4", "state": "request-received" }, "metadata": {}, "id": "0601496c-f2c7-4ff8-9196-0d130f2a9a30", "createdAt": "2023-04-13T10:23:06.872Z", "protocolVersion": "v1", "state": "declined", "connectionId": "90fee5d0-f69b-46a6-95ac-968e4f804de7", "threadId": "13cb2965-7f2c-4ae7-ab06-1b97df10d2f4" } ``` --- ```typescript secureMessageForProfRequest(proofRecordId: string, message: string) ``` **Description:** This method is used to send secure message and chat for particular proof request. **Parameters:** proofRecordId: string – proof record id. message: string- reason for decline the offer **Return:** void --- ```typescript getSecureMessageForProfRequest(proofRecordId: string) ``` **Description:** This method is used to fetch secure message history for particular proof request. **Parameters:** proofRecordId: string – proof record id. **Return:** Method will return chat history for particular proof request. ```json [{ "content": "Hi, Can you please help me?", "sentTime": "2023-04-13T10:09:52Z", "connectionId": "8414dc4b-1f2c-4bfe-aef1-27a00daa7b54", "threadId": "784b19b3-7a2d-4ceb-940d-29d514a9f336", "role": "sender", "parentThreadId": "687b19b3-7a2d-5ceb-111d-29d514a9f565", "tags": "SSI" }] ``` --- ```typescript proposeProof(connectionId: string, protocolVersion: string, proposeProof: json) ``` **Description:** This method is used to send proof proposal to the verifier. **Parameters:** connectionId: string – connection id. ProtocolVersion: string – v1 or v2 proposeProof: json – proposal that contains requested attributes and requested predicates. **Return:** When called, this method will return a proof record. ```json { "_tags": { "connectionId": "0dcb1aee-d159-4cf3-8378-16de514b4f9a", "state": "request-received", "threadId": "b8ff755a-75c2-42f2-986c-41ace73833a4" }, "connectionId": "0dcb1aee-d159-4cf3-8378-16de514b4f9a", "presentationProposal": { "type": "https://didcomm.org/present-proof/1.0/presentation-preview", "attributes": [], "predicates": [{ "name": "age", "credentialDefinitionId": "Y75Xcr8rm2PGtzZAsZgTYC:3:CL:634386:Northern Block ID Card", "predicate": ">=", "value": 18 }] }, "createdAt": "2023-04-13T10:18:33.331Z", "id": "a60da42b-cce6-4f6e-9c48-5196e5209a11", "metadata": {}, "protocolVersion": "v1", "state": "proposal-sent", "threadId": "b8ff755a-75c2-42f2-986c-41ace73833a4" } ``` --- ```typescript getRequestedCredentialsForProofRequest(proofRecordId: string) ``` **Description:** This is used to fetch all the credentials that match the proof request. **Parameters:** proofRecordId: string – Proof record id. **Return:** This method will return list of credentials. ```json { "proofFormats": { "indy": { "requestedAttributes": { "Northern Block Card": [ { "credentialId": "034a2420-b057-46fa-a85a-8c1342aaa24f", "revealed": true, "credentialInfo": { "referent": "034a2420-b057-46fa-a85a-8c1342aaa24f", "attrs": { "Street": "Ambachtstraat 61", "Date of birth": "19990101", "City": "Utrecht", "Name": "Jan van Dalen", "Nationality": "The Netherlands" }, "schema_id": "Y75Xcr8rm2PGtzZAsZgTYC:2:Northern Block ID:1.1", "cred_def_id": "Y75Xcr8rm2PGtzZAsZgTYC:3:CL:634386:Northern Block ID Card", "rev_reg_id": null, "cred_rev_id": null } } ] }, "requestedPredicates": {} } } } ``` --- ```typescript autoSelectCredentialsForProofRequest (proofRecordId: string) ``` **Description:** This is used to auto select credentials for proof request. **Parameters:** proofRecordId: string – Proof record id. **Return:** This method will return credentials that match with the proof request. ```json { "proofFormats": { "indy": { "requested_attributes": { "Northern Block ID Card": { "cred_id": "034a2420-b057-46fa-a85a-8c1342aaa24f", "revealed": true } }, "requested_predicates": {}, "self_attested_attributes": {} } } } ``` --- ```typescript getAllByQuery(proofRecordId?: string, state?: string) ``` **Description:** This method returns a proof record based on parameters. If we don't pass anything, it will return all the proof records. **Parameters:** proofRecordId?: string – proof record id. state?: string – Proof states, such as request-received, presentation-sent, presentation -received. **Return:** This method will return proof records. ```json [ { "_tags": {}, "metadata": {}, "id": "a60da42b-cce6-4f6e-9c48-5196e5209a11", "createdAt": "2023-04-13T10:18:33.331Z", "protocolVersion": "v1", "state": "request-received", "connectionId": "0dcb1aee-d159-4cf3-8378-16de514b4f9a", "threadId": "b8ff755a-75c2-42f2-986c-41ace73833a4" }, { "_tags": { "state": "presentation-sent", "threadId": "76376875-4840-4d93-a9c5-907837adb564", "connectionId": "a693dba8-35d6-44d8-9b0b-360c7433ab23" }, "metadata": {}, "id": "f7c2131a-6676-4e14-8242-3e244863b40f", "createdAt": "2023-04-13T10:16:54.880Z", "protocolVersion": "v1", "state": "done", "connectionId": "a693dba8-35d6-44d8-9b0b-360c7433ab23", "threadId": "76376875-4840-4d93-a9c5-907837adb564" } ] ``` --- ```typescript deleteProofRecordById(proofRecordId: string) ``` **Description:** This method will delete the proof record that matches the provided proof record Id. **Parameters:** proofRecordId: string – Proof record id. **Return:** void --- ## Basic Message ```typescript sendMessage(connectionId: string, message: string) ``` **Description:** Send a message to the connection with the specified connection id. **Parameters:** connectionId: string – Connection record id. message: string – any text message **Return:** void --- ```typescript findAllByQuery(connectionId: string) ``` **Description:** Retrieve all basic message records by connection id. **Parameters:** connectionId: string – Connection record id. **Return:** List containing all basic message records ```json [{ "content": "Hi, Can you please help me?", "sentTime": "2023-04-13T10:09:52Z", "connectionId": "8414dc4b-1f2c-4bfe-aef1-27a00daa7b54", "threadId": "784b19b3-7a2d-4ceb-940d-29d514a9f336", "role": "sender", "parentThreadId": "687b19b3-7a2d-5ceb-111d-29d514a9f565", "tags": "SSI" }] ``` --- ```typescript deleteById(basicMessageRecordId: string) ``` **Description:** This method will delete the message that matches the provided id. **Parameters:** basicMessageRecordId: string – basic message record id. **Return:** void ---- ## OpenID4VC ```typescript requestCredentialUsingPreAuthorizedCode(options: PreAuthCodeFlowOptions) ``` **Description:** This method used to request open id verifiable credential using pre-authorized code. **Parameters:** options: json ```json { "issuerUri": string, "kid": string, "verifyRevocationState": boolean } ``` **Return:** Method will return open id VC credential record --- ```typescript requestCredential(options: RequestCredentialOptions) ``` **Description:** This method used to request open id verifiable credential. **Parameters:** options: json ```json { "issuerUri": string, "kid": string, "verifyRevocationState": boolean, "clientId": string, "authorizationCode": string, "codeVerifier": string redirectUri: string } ``` **Return:** Method will return open id VC credential record --- ## Activity History ```typescript saveHistoryRecord(record: HistoryRecord) ``` **Description:** This method logs the activity history, including connection added, credential accepted, proof sent, etc. **Parameters:** record: json ```json { "type": string, "message": string, "createdAt": date, "correspondenceId": string "correspondenceName": string } ``` **Return:** Method will return saved record --- ```typescript getAllHistory() ``` **Description:** This method retrieves all the activity history records that are stored in the wallet. **Parameters:** **Return:** Return all the activity history records. ```json [ { "content": { "message": "InformationSent", "id": "003d45b3-35e7-42ad-88ba-06a6c7083649", "createdAt": "2023-04-13T12:02:32.657Z", "type": "InformationSent", "correspondenceId": "af5f7822-d718-4ab7-9815-8b3090797758", "correspondenceName": "University of Law" } }, { "content": { "message": "CardAccepted", "id": "10d2e4ed-c530-4d4a-a8c1-0efb40695a00", "createdAt": "2023-04-13T12:01:42.812Z", "type": "CardAccepted", "correspondenceId": "1a030c5c-28c8-418a-a5f5-c978aa19b103", "correspondenceName": "Northern Block" } } ] ``` --- ```typescript deleteHistoryById(recordId: string) ``` **Description:** This method deletes a particular activity's history record from the wallet. **Parameters:** recordId: string - activity record id **Return:** void --- ## Other Agent Methods ```typescript receiveMessage(inboundMessage: unknown) ``` **Description:** This method is used to process any didcomm message, one of the examples is process the connection-less messages. **Parameters:** message: inboundMessage **Return:** When called, this method will return an Aries agent instance, which can be used to interact with the agent's functionality and data. --- ```typescript getAllNotifications() ``` **Description:** This method returns all notification records related to a credential offer, a proof request, and a revoked credential. **Parameters:** NA **Return:** This method will return all notification records. --- ## Identity Proofing ```typescript initializeIdProofing(subscriptionId: string, userName: string, connectUrl: string, faceIdUrl: string, passiveLivenessUrl: string) ``` **Description:** This method is initialized the identity proofing flow. **Parameters:** subscriptionId: subscription Id. userName: user id. connectUrl: Connect URL. faceIdUrl: Face id URL. passiveLivenessUrl: Passive liveness URL. **Return:** When called, this method will return instance id. ```json { "instanceId": "6e2f3ca8-3196-4e25-8581-c2d623d042dd" } ``` --- ```typescript postImage(instanceId: string, documentSide: number, blobData: string, isReUpload: boolean) ``` **Description:** This method is used for uploading the document image. **Parameters:** instanceId: string – After initializing the ID Proofing service, we received an Instance ID, which is a unique identifier for the instance of the service that we have created. documentSide: number - front side of document, 1 back side of document. blobData: string – Base64 data of captured image. isReUpload: boolean – Pass true if we are uploading image again after getting the error on first try. **Return:** This method will response with image data and other parameters. Method will also throw error if uploaded image quality is not up to the mark. ```json { "ClassificationDetails": { "Back": null, "Front": { "Class": 3, "ClassCode": null, "ClassName": "Drivers License", "CountryCode": "IND", "DocumentDataTypes": [], "GeographicRegions": [ "AsiaPacificJapan" ], "Id": "cd7ed302-b0fe-46c5-85d0-ca1714f2306d", "IsGeneric": false, "Issue": "2", "IssueType": "Gujarat State Driving Licence", "IssuerCode": "IND", "IssuerName": "India", "IssuerType": 1, "KeesingCode": null, "Name": "India (IND) Gujarat State Driving Licence", "ReferenceDocumentDataTypes": [], "Size": 1, } }, "Mode": 0, "OrientationChanged": false, "PresentationChanged": false, "Type": { "Class": 3, "ClassCode": null, "ClassName": "Drivers License", "CountryCode": "IND", "DocumentDataTypes": [], "GeographicRegions": [ "AsiaPacificJapan" ], "Id": "cd7ed302-b0fe-46c5-85d0-ca1714f2306d", "IsGeneric": false, "Issue": "2", "IssueType": "Gujarat State Driving Licence", "IssuerCode": "IND", "IssuerName": "India", "IssuerType": 1, "KeesingCode": null, "Name": "India (IND) Gujarat State Driving Licence", "ReferenceDocumentDataTypes": [], "Size": 1, } } ``` --- ```typescript uploadLivenessImage(blobData: string) ``` **Description:** This method is used to upload the liveness image. **Parameters:** blobData: string – Base64 data of captured image. **Return:** This method will response with image data and other parameters. --- ```typescript processFaceMatch(documentImage: string, liveImage: string) ``` **Description:** This method is used to compare the faces **Parameters:** documentImage: string – Base64 data of person photo that present into the document liveImage: string – Base64 data of captured image. **Return:** This method will response with compare result like liveness score, face match score etc. ```json { "LivenessResult": { "LivenessAssessment": "Live", "Score": 99 }, "TransactionId": "49a97000-3757-4cb4-8745-de5e7923a2f9" } ``` --- ```typescript getDocumentResult(instanceId: string) ``` **Description:** This method is used get result of document proofing. **Parameters:** instanceId: string – After initializing the ID Proofing service, we received an Instance ID, which is a unique identifier for the instance of the service that we have created. **Return:** This method will respond with the authentication status, data fields of the document, and the type of document. ```json { "Alerts": [{ "RegionKey": "Birth Date Valid", "RegionCode": 1, "Description": "Verified that the birth date is valid.", }], "DataFields": [{ "Name": "Address", "Type": "string", "Value": "A-210. SOMNATH APT. INDIRA NAGAR. HIRABAUG VARACHHA ROAD SURAT 395006 " }, { "Name": "Birth Date", "Type": "datetime", "Value": "/Date(702432000000)/" }, { "Name ": "Blood Type ", "Type ": "string ", "Value ": "BG Unk " }, { "Name ": "Document Number ", "Type ": "string ", "Value ": "GJ05 20110053710 " }, { "Name ": "Expiration Date ", "Type ": "datetime ", "Value ": " / Date(1955923200000) / " }, { "Name": "Full Name", "Type": "string", "Value": "AMIT PADMANI" }, { "Name": "Issue Date", "Type": "datetime", "Value": "/Date(1324857600000)/" }, { "Name": "Sex", "Type": "string", "Value": "M" }], "InstanceId": "6e2f3ca8-3196-4e25-8581-c2d623d042dd", "isDocumentVerified": true, "isTamperedProof": true, "matchScore": 70 } ``` --- ```typescript deleteInstance(instanceId: string) ``` **Description:** This method is used delete the inertance once the id proofing process is completed. **Parameters:** instanceId: string – After initializing the ID Proofing service, we received an Instance ID, which is a unique identifier for the instance of the service that we have created. **Return:** void ---- ## Keychain Services ```typescript storeWalletKey(key) ``` **Description:** This method is used to store the wallet pin in secure keystore storage with biometric authentication. **Parameters:** key: string – wallet key **Return:** void --- ```typescript getWalletKey() ``` **Description:** This method is used to fetch the wallet key hash from keystore storage using biometric authentication. **Parameters:** NA **Return:** Method will return the wallet key hash. ```json { "walletKey": "5994471abb01112afcc18159f6cc74b4f511b99806da59b3caf5a9c173cacfc5" } ``` --- Below methods are useful to detect biometric is change or not in device ```typescript storeBiometricPolicy() ``` **Description:** The method will store the current state of the biometric information in the keychain using a native module. Whenever the biometric information is changed, we can recall this method to update the biometric policy. **Parameters:** NA **Return:** void --- ```typescript verifyBiometricsChange() ``` **Description:** This method will check whether the biometric information has been changed. **Parameters:** NA **Return:** This method return true if biometric is changed else will return false. ```json { "isBiometricChanged": false } ``` --- ## Error Handling You can wrap method in a try-catch block to detect and handle errors. Any errors that occur within the try block will be caught by the catch block, where you can handle them appropriately. You can see the basic example ```typescript= try { await nbSDK.connections.deleteById(connectionId) } catch (e: NBSDKError) { console.log(‘Error code =’, e.code) console.log(‘Error message =’, e.message) } ``` --- ## UI Components #### Onboarding ```xml <Onboarding data={data} onProcessComplete={handleOnComplete} style={...style} /> ``` **Description:** Onboarding component is typically the first thing users see when they open the app and provide a brief introduction to the app's purpose and features. **Props:** data: json ```json { "image": string, "title": string, "description": string } ``` style?: style – apply background color, font color onProcessComplete: return method --- #### TermsAndConditions ```xml <TermsAndConditions text={'Lorem Ipsum is simply dummy text of the printing industry.'} onAccept={handleOnAccept} style={...style} /> ``` **Description:** This component useful to displays the terms and conditions of using the application or service **Props:** text: string- terms and conditions text onAccept: return method style?: style – apply background color, font color --- #### PrivacyPolicy ```xml <PrivacyPolicy text={'Lorem Ipsum is simply dummy text of the printing industry.'} onAccept={handleOnAccept} style={...style} /> ``` **Description:** This component useful to displays the privacy policy of using the application or service **Props:** text: string- privacy policy text onAccept: return method style?: style – apply background color, font color --- #### PinScreen ```xml <Pinscreen onSetCancel={onSetCancel} onEnterSuccess={onEnterSuccess(pin)} onResetSuccess={onResetSuccess} options={{ pinLength: 6, maxAttempt: 4, lockDuration: 10000, allowedReset: true, disableLock: false, }} styles={customStyles} /> ``` **Description:** This component useful to set wallet and verify the wallet pin, **Props:** onSetCancel: return method when user cancel onEnterSuccess: return method called when user enter the pin onResetSuccess: retuen when user enter wrong password options: json - set the PIN length, maximum attempt count, and also lock out the wallet if the maximum attempt limit is exceeded. style?: style – apply background color, font color --- #### BiometricAuth ```xml <BiometricAuth onSuccess={onSuccess} onError={onError} styles={customStyles} /> ``` **Description:** This component useful for biometric authentication. **Props:** onSuccess: method - return when biometric successfully authenticated onError: method - return error when biometric authentication failed style?: style – apply background color, font color --- #### QRCodeScanner ```xml <QRCodeScanner onQRCodeScanned={handleQRcodeData} isTorchLightOn={false} hit={'Lorem Ipsum'} style={...style} /> ``` **Description:** This component use to enables users to scan and read QR codes. The component uses the device's camera to scan the QR code and then extracts the information contained within the code. **Props:** onQRCodeScanned: return method isTorchLightOn?: boolean- help to turn on/off torch light hit?: string – small piece of information or a clue that provides guidance or assistance style?: style – apply background color, font color --- #### ConnectionRequest ```xml <ConnectionRequest invitation={'didcomm://aries_connection_invitation?c_i=eyJAdHlRpZDpz...'} style={...style} /> ``` **Description:** This component displays the connection information once we scan any connection invitation QR code. **Parameters:** invitation: string- base64 connection invitation string style?: style – apply background color, font color --- #### CredentialOffer ```xml <CredentialOffer credentialRecordId={credentialRecordId} message={'You have received the credential offer from the issuer.'} oca={ocaJSON} style={...style} /> ``` **Description:** This component is useful for displaying the credential offer. The user can view the credential attributes, connection label, etc. **Parameters:** credentialRecordId: string – credential record id message?: string - any message or hint to user style?: style – apply background color, font color oca?: json – OCA object for credential branding, If we don’t pass card will show the default OCA that config in SDK ```json { "type": string, "logo": { "src": string }, "primaryBackgroundColor": string, "secondaryBackgroundColor": string, "backgroundImage": { "src": string } } ``` --- #### ProofRequest ```xml <ProofRequest proofRecordId={proofRecordId} message={'You have received the verification request'} autoSelectCredential={true} style={...style} /> ``` **Description:** This component is useful for displaying the proof request that is received from the verifier. The user can view the proof request details, selection option of multiple credentials is present in wallet, and other relevant information. **Parameters:** proofRecordId: string – proof record id autoSelectCredential?: boolean – if the user has multiple credentials in their wallet and the autoSelectCredential feature is enabled, will automatically select the best match credential to fulfil the proof request. Default value will be true. style?: style – apply background color, font color message?: string - any message or hint to user. --- #### CredentialCard ```xml <CredentialCard credentialRecordId={credentialRecordId} oca={ocaJSON} style={...style} /> ``` **Description:** This component is useful for displaying the credential card, which provides a visual representation of the user's digital credential. The credential card typically includes the issuer's logo, the credential name, and other relevant information **Parameters:** credentialRecordId: string – credential record id style?: style – apply background color, font color oca?: json – OCA object for credential branding, If we don’t pass card will show the default OCA that config in SDK ```json { "type": string, "logo": { "src": string }, "primaryBackgroundColor": string, "secondaryBackgroundColor": string, "backgroundImage": { "src": string } } ``` --- #### ConnectionCard ```xml <ConnectionCard connectionId={connectionId} style={...style} /> ``` **Description:** This component is useful for displaying the connection card, which provides a visual representation of a connection established between the user and another entity. The connection card typically includes the entity's name, logo and other relevant information. **Parameters:** connectionId: string – connection id style?: style – apply background color, font color --- #### NotificationCard ```xml <NotificationCard recordId={recordId} onRemove={handleOnRemove} style={...style} /> ``` **Description:** This component is useful for displaying received notifications such as a credential offer, proof request received, credential revoke, etc. **Parameters:** recordId: string – record id style?: style – apply background color, font color onRemove: return method