Biometric plugin for the Truvera Wallet SDK. This module provides functions for biometric enrollment, matching, and identity verification processes.
Cloud wallet functionality for the Truvera Wallet SDK. This module provides the main cloud wallet creation and management functions.
Verifiable credential management functionality for the Truvera Wallet SDK. This module provides functions for importing, verifying, storing, and managing verifiable credentials.
DID (Decentralized Identifier) management functionality for the Truvera Wallet SDK. This module provides functions for creating, importing, exporting, and managing DIDs.
DIDComm message management functionality for the Truvera Wallet SDK. This module provides functions for sending, receiving, and processing DIDComm messages.
Core wallet functionality for the Dock Wallet SDK. This module provides the main wallet creation and management functions.
Default implementation of QRCodeProcessor
This processor manages a registry of QR code handlers and executes them in priority order to process scanned QR codes. It provides a flexible, extensible system for handling various types of QR codes in a wallet application.
Built-in handler for OID4VC (OpenID for Verifiable Credentials) URIs
This is a generic handler that can be configured with app-specific callbacks for importing credentials. The handler itself only handles protocol detection and delegates the actual import logic to the configured callback.
import { OID4VCHandler } from '@docknetwork/wallet-sdk-core/src/qr-handlers/builtin';
import { getCredentialProvider } from '@docknetwork/wallet-sdk-react-native';
const handler = new OID4VCHandler({
onImportCredential: async (uri, context) => {
try {
// Use SDK to import credential
await getCredentialProvider().importCredentialFromURI({
uri,
didProvider: getDIDProvider(),
getAuthCode: async (authUrl) => {
// App-specific auth handling
return await showAuthWebView(authUrl);
},
});
return { success: true };} catch (error) { return { success: false, error: error instanceof Error ? error : new Error(String(error)), };}
},
});
processor.registerHandler(handler);
Default priority: 5 (very high) This ensures OID4VC URIs are checked before other credential handlers.
Goals ⇒dockDocumentNetworkResolver
Given an Api URL, resolve the network ID For now it will be applied for creds and certs It can be extended to resolve other external URLs
Create an OID4VC handler with custom configuration
This is a convenience factory function for creating an OID4VC handler.
Create a new QR code processor instance
This is a convenience factory function for creating a processor.
DIDComm Message helpers Check https://identity.foundation/didcomm-messaging/spec/#out-of-band-messages for more details
buildRequestVerifiablePresentationMessage()
Sender: Verifier OOB message to request a verifiable presentation from the holder
buildAckWalletToWalletVerificationMessage()
Sender: Holder Start a wallet to wallet verification flow
buildVerifiablePresentationMessage()
Sender: Holder Send a verifiable presentation to the verifier
buildVerifiablePresentationAckMessage()
Sender: Verifier Sends an the presentation result to the holder
handleBlockchainNetworkChange()
Update existing substrate network connection Compare connected substrate connection with the current walle network Disconnect and Establish a new connection if the network is different
WalletStatus : 'closed' | 'loading' | 'ready' | 'error'
Possible wallet status values
KeypairType : 'sr25519' | 'ed25519' | 'ecdsa'
Supported keypair types
BiometricsProviderConfigs : Object
Configuration options for biometric provider operations
Legacy V1 wallet interface for backward compatibility
Main wallet interface providing methods for document management, import/export, and network operations.
Provides a high-level API for DID management operations
Provides a high-level API for DIDComm message management operations
Provides a high-level API for verifiable credential management operations
Callback functions for handling different stages of the identity verification process
Defines the contract for biometric enrollment and matching operations
Defines the contract for identity verification operations
Creates IDV provider instances with proper event handling and wallet integration
Provides a high-level API for biometric identity verification operations
Biometric plugin for the Truvera Wallet SDK. This module provides functions for biometric enrollment, matching, and identity verification processes.
- biometric-provider
- static
- inner
- ~setConfigs(configs)
- ~isBiometricPluginEnabled() ⇒
boolean - ~assertConfigs()
- ~getBiometricConfigs() ⇒
BiometricsProviderConfigs.<unknown> - ~hasProofOfBiometrics(proofRequest) ⇒
boolean
biometric-provider.IDV_EVENTS ⇒ IBiometricProvider
Creates a biometric provider instance for identity verification and biometric credential management
Kind: static property of biometric-provider
Returns: IBiometricProvider -
A biometric provider instance with identity verification methods
Throws:
-
ErrorIf wallet or idvProviderFactory is not provided
See: IBiometricProvider - The interface defining all available biometric provider methods
| Param | Type | Description |
|---|---|---|
| params | Object |
Provider configuration |
| params.wallet | IWallet |
The wallet instance to use for credential storage |
| params.idvProviderFactory | IDVProviderFactory |
Factory for creating IDV provider instances |
Example
import { createBiometricProvider } from '@docknetwork/wallet-sdk-core';
const biometricProvider = createBiometricProvider({
wallet,
idvProviderFactory: myIDVFactory
});
// Start identity verification process
const result = await biometricProvider.startIDV(proofRequest);
console.log('Enrollment credential:', result.enrollmentCredential);
console.log('Match credential:', result.matchCredential);
// Listen for IDV events
biometricProvider.eventEmitter.on('onComplete', (data) => {
console.log('IDV process completed:', data);
});Sets the global biometric provider configurations for the SDK
Kind: inner method of biometric-provider
| Param | Type | Description |
|---|---|---|
| configs | BiometricsProviderConfigs.<unknown> |
The biometric provider configurations to set |
| configs.enrollmentCredentialType | string |
The credential type for enrollment |
| configs.biometricMatchCredentialType | string |
The credential type for biometric matching |
| [configs.idvProvider] | any |
Optional IDV provider configuration |
Example
import { setConfigs } from '@docknetwork/wallet-sdk-core/biometric-provider';
setConfigs({
enrollmentCredentialType: 'BiometricEnrollment',
biometricMatchCredentialType: 'BiometricMatch',
idvProvider: myIDVProviderConfig
});Checks if the biometric plugin is enabled by verifying if biometric match credential type is configured
Kind: inner method of biometric-provider
Returns: boolean -
True if biometric match credential type is configured, false otherwise
Example
import { isBiometricPluginEnabled, setConfigs } from '@docknetwork/wallet-sdk-core/biometric-provider';
// Before configuration
console.log(isBiometricPluginEnabled()); // false
// After configuration
setConfigs({
enrollmentCredentialType: 'BiometricEnrollment',
biometricMatchCredentialType: 'BiometricMatch'
});
console.log(isBiometricPluginEnabled()); // trueAsserts that biometric provider configurations are available
Kind: inner method of biometric-provider
Throws:
-
ErrorIf biometric provider configs are not set
Example
import { assertConfigs } from '@docknetwork/wallet-sdk-core/biometric-provider';
try {
assertConfigs();
console.log('Biometric configs are available');
} catch (error) {
console.error('Biometric configs missing:', error.message);
}Gets the current biometric provider configurations
Kind: inner method of biometric-provider
Returns: BiometricsProviderConfigs.<unknown> -
The current biometric provider configurations
Throws:
-
ErrorIf biometric provider configs are not set
Example
import { getBiometricConfigs } from '@docknetwork/wallet-sdk-core/biometric-provider';
try {
const configs = getBiometricConfigs();
console.log('Enrollment credential type:', configs.enrollmentCredentialType);
console.log('Match credential type:', configs.biometricMatchCredentialType);
} catch (error) {
console.error('Failed to get configs:', error.message);
}Checks if a proof request requires biometric credentials
Kind: inner method of biometric-provider
Returns: boolean -
True if the proof request requires biometric credentials
| Param | Type | Description |
|---|---|---|
| proofRequest | any |
The proof request to analyze |
Example
import { hasProofOfBiometrics } from '@docknetwork/wallet-sdk-core/biometric-provider';
const proofRequest = {
input_descriptors: [{
constraints: {
fields: [{
path: ['$.credentialSubject.biometric.id']
}, {
path: ['$.credentialSubject.biometric.created']
}]
}
}]
};
if (hasProofOfBiometrics(proofRequest)) {
console.log('This proof request requires biometric verification');
}Cloud wallet functionality for the Truvera Wallet SDK. This module provides the main cloud wallet creation and management functions.
- cloud-wallet
- ~deriveBiometricKey(biometricData, identifier) ⇒
- ~deriveKeyMappingVaultKeys(biometricData, identifier) ⇒
- ~deriveBiometricEncryptionKey(biometricData, identifier) ⇒
- ~encryptMasterKey(masterKey, encryptionKey, iv) ⇒
- ~decryptMasterKey(encryptedKey, decryptionKey, iv) ⇒
- ~initializeKeyMappingVault(edvUrl, authKey, biometricData, identifier) ⇒
- ~enrollUserWithBiometrics(edvUrl, authKey, biometricData, identifier) ⇒
- ~getKeyMappingMasterKey(keyMappingEdv, identifier, decryptionKey, iv) ⇒
- ~authenticateWithBiometrics(edvUrl, authKey, biometricData, identifier) ⇒
- ~initializeCloudWalletWithBiometrics(edvUrl, authKey, biometricData, identifier, dataStore) ⇒
Derives a key from biometric data using HKDF
Kind: inner method of cloud-wallet
Returns:
Derived key
| Param | Description |
|---|---|
| biometricData | Biometric data from provider |
| identifier | User's identifier as salt (email, phone number, etc.) |
Derives EDV keys from biometric data for the KeyMappingVault
Kind: inner method of cloud-wallet
Returns:
Keys for accessing the KeyMappingVault
| Param | Description |
|---|---|
| biometricData | Biometric data from the provider |
| identifier | User's identifier as additional entropy (email, phone number, etc.) |
Generates a key for encrypting/decrypting the master key
Kind: inner method of cloud-wallet
Returns:
Encryption key and IV for AES encryption
| Param | Description |
|---|---|
| biometricData | Biometric data from provider |
| identifier | User's identifier as salt (email, phone number, etc.) |
Encrypts the master key using a key derived from biometric data
Kind: inner method of cloud-wallet
Returns:
Encrypted master key
| Param | Description |
|---|---|
| masterKey | The CloudWalletVault master key to encrypt |
| encryptionKey | Key derived from biometric data |
| iv | Initialization vector |
Decrypts the master key using biometric-derived key
Kind: inner method of cloud-wallet
Returns:
The decrypted master key
| Param | Description |
|---|---|
| encryptedKey | The encrypted master key |
| decryptionKey | Key derived from biometric data |
| iv | Initialization vector |
Initializes the KeyMappingVault using biometric data
Kind: inner method of cloud-wallet
Returns:
Initialized EDV service
| Param | Description |
|---|---|
| edvUrl | URL for the edv |
| authKey | Auth key for the edv |
| biometricData | User's biometric data |
| identifier | User's identifier (email, phone number, etc.) |
Enrolls a user by creating necessary vaults and keys
Kind: inner method of cloud-wallet
Returns:
The master key and mnemonic for backup
| Param | Description |
|---|---|
| edvUrl | URL for the edv |
| authKey | Auth key for the edv |
| biometricData | Biometric data from provider |
| identifier | User's identifier (email, phone number, etc.) |
Gets the master key from the key mapping vault using provided decryption keys
Kind: inner method of cloud-wallet
Returns:
The decrypted master key for CloudWalletVault
| Param | Description |
|---|---|
| keyMappingEdv | Initialized key mapping vault service |
| identifier | User's identifier (email, phone number, etc.) |
| decryptionKey | Key for decrypting the master key |
| iv | Initialization vector for decryption |
Authenticates a user with biometric data and identifier
Kind: inner method of cloud-wallet
Returns:
The decrypted master key for CloudWalletVault
| Param | Description |
|---|---|
| edvUrl | URL for the edv |
| authKey | Auth key for the edv |
| biometricData | Biometric data from the provider |
| identifier | User's identifier (email, phone number, etc.) |
cloud-wallet~initializeCloudWalletWithBiometrics(edvUrl, authKey, biometricData, identifier, dataStore) ⇒
Initializes the Cloud Wallet using biometric authentication
Kind: inner method of cloud-wallet
Returns:
Initialized cloud wallet
| Param | Description |
|---|---|
| edvUrl | Cloud wallet vault URL |
| authKey | Cloud wallet auth key |
| biometricData | User's biometric data |
| identifier | User's identifier (email, phone number, etc.) |
| dataStore | Optional data store for the wallet |
Verifiable credential management functionality for the Truvera Wallet SDK. This module provides functions for importing, verifying, storing, and managing verifiable credentials.
- credential-provider
- ~isValid(credential) ⇒
Promise.<Object> - ~createCredentialProvider(params) ⇒
ICredentialProvider
- ~isValid(credential) ⇒
Uses Dock SDK to verify a credential
Kind: inner method of credential-provider
Returns: Promise.<Object> -
Verification result with status and optional error/warning messages
| Param |
|---|
| credential |
credential-provider~createCredentialProvider(params) ⇒ ICredentialProvider
Creates a credential provider instance bound to a wallet
Kind: inner method of credential-provider
Returns: ICredentialProvider -
A credential provider instance with all verifiable credential management methods
See: ICredentialProvider - The interface defining all available credential provider methods
| Param | Type | Description |
|---|---|---|
| params | Object |
Provider configuration |
| params.wallet | IWallet |
The wallet instance to use for credential storage |
Example
import { createCredentialProvider } from '@docknetwork/wallet-sdk-core';
const credentialProvider = createCredentialProvider({wallet});
// Add a credential
const addedCredential = await credentialProvider.addCredential(myCredential);
// Validate a credential
const result = await credentialProvider.isValid(credential);
if (result.status === 'verified') {
console.log('Credential is valid');
}
// Get all credentials
const allCredentials = credentialProvider.getCredentials();
// Import from URI
await credentialProvider.importCredentialFromURI({
uri: 'https://example.com/credential-offer',
didProvider
});DID (Decentralized Identifier) management functionality for the Truvera Wallet SDK. This module provides functions for creating, importing, exporting, and managing DIDs.
did-provider~createDIDProvider(params) ⇒ IDIDProvider
Creates a DID provider instance bound to a wallet
Kind: inner method of did-provider
Returns: IDIDProvider -
A DID provider instance with all DID management methods
See: IDIDProvider - The interface defining all available DID provider methods
| Param | Type | Description |
|---|---|---|
| params | Object |
Provider configuration |
| params.wallet | IWallet |
The wallet instance to bind the provider to |
Example
import { createDIDProvider } from '@docknetwork/wallet-sdk-core';
const didProvider = createDIDProvider({wallet});
// Create a new DID
const {keyDoc, didDocumentResolution} = await didProvider.createDIDKey({
name: 'My DID'
});
// Get all DIDs
const allDIDs = await didProvider.getAll();
// Export a DID
const exportedDID = await didProvider.exportDID({
id: didDocumentResolution.id,
password: 'mypassword'
});DIDComm message management functionality for the Truvera Wallet SDK. This module provides functions for sending, receiving, and processing DIDComm messages.
message-provider~createMessageProvider(params) ⇒ IMessageProvider
Creates a message provider instance bound to a wallet and DID provider
Kind: inner method of message-provider
Returns: IMessageProvider -
A message provider instance with all DIDComm message management methods
See: IMessageProvider - The interface defining all available message provider methods
| Param | Type | Description |
|---|---|---|
| params | Object |
Provider configuration |
| params.wallet | IWallet |
The wallet instance to use for message storage |
| params.didProvider | IDIDProvider |
The DID provider instance to use for key management |
| [params.relayService] | any |
Optional relay service implementation (defaults to built-in service) |
Example
import { createMessageProvider } from '@docknetwork/wallet-sdk-core';
const messageProvider = createMessageProvider({
wallet,
didProvider
});
// Send a message
await messageProvider.sendMessage({
did: 'did:key:sender123',
recipientDid: 'did:key:recipient456',
message: { hello: 'world' }
});
// Start auto-fetching messages
const stopAutoFetch = messageProvider.startAutoFetch(5000);
// Add message listener
const removeListener = messageProvider.addMessageListener((message) => {
console.log('Received message:', message);
});Core wallet functionality for the Dock Wallet SDK. This module provides the main wallet creation and management functions.
wallet~createWallet(props) ⇒ Promise.<IWallet>
Creates a new wallet instance with the provided data store. The wallet provides secure storage and management of DIDs, credentials, keys, and other documents.
Kind: inner method of wallet
Returns: Promise.<IWallet> -
A promise that resolves to the created wallet instance
Throws:
-
ErrorIf the data store is not properly initialized
See: IWallet - The interface defining all available wallet methods
| Param | Type | Description |
|---|---|---|
| props | CreateWalletProps |
Configuration options for wallet creation |
| props.dataStore | DataStore |
The data store implementation to use for persistence |
Example
import { createWallet } from '@docknetwork/wallet-sdk-core';
import { createDataStore } from '@docknetwork/wallet-sdk-data-store';
const dataStore = await createDataStore();
const wallet = await createWallet({ dataStore });
// The wallet implements the IWallet interface
await wallet.addDocument(myCredential);
const documents = await wallet.getAllDocuments();This interface is obsolete and should not be used for new implementations. Use IWallet instead.
Legacy V1 wallet interface for backward compatibility
Kind: global interface
IWallet ⇐ IV1Wallet
Main wallet interface providing methods for document management, import/export, and network operations.
Kind: global interface
Extends: IV1Wallet
- IWallet ⇐
IV1Wallet- .deleteWallet() ⇒
Promise.<void> - .setStatus(newStatus)
- .setNetwork(networkId) ⇒
Promise.<void> - .getNetworkId() ⇒
string - .getDocumentById(id) ⇒
Promise.<WalletDocument> - .getAllDocuments() ⇒
Promise.<Array.<WalletDocument>> - .getDocumentsById(idList) ⇒
Promise.<Array.<WalletDocument>> - .getDocumentsByType(type) ⇒
Promise.<Array.<WalletDocument>> - .addDocument(json, [options]) ⇒
Promise.<WalletDocument> - .updateDocument(document, [options]) ⇒
Promise.<WalletDocument> - .removeDocument(id, [options]) ⇒
Promise.<void> - .getDocumentCorrelations(documentId) ⇒
Promise.<Array.<WalletDocument>> - .getAccountKeyPair(accountId) ⇒
Promise.<any> - .getDocumentsFromEncryptedWallet(json, password) ⇒
Promise.<any> - .importUniversalWalletJSON(json, password) ⇒
Promise.<void> - .exportDocuments(params) ⇒
Promise.<any> - .exportUniversalWalletJSON(password) ⇒
any
- .deleteWallet() ⇒
Deletes the entire wallet and all its documents
Kind: static method of IWallet
Emits: WalletEvents.event:walletDeleted
Sets the wallet status
Kind: static method of IWallet
| Param | Type | Description |
|---|---|---|
| newStatus | string |
The new status to set |
Sets the active network for the wallet
Kind: static method of IWallet
Emits: WalletEvents.event:networkUpdated
| Param | Type | Description |
|---|---|---|
| networkId | string |
The network identifier to switch to |
Gets the current network ID
Kind: static method of IWallet
Returns: string -
The current network identifier
Retrieves a document by its ID
Kind: static method of IWallet
Returns: Promise.<WalletDocument> -
The document with the specified ID
Throws:
-
ErrorIf document is not found
| Param | Type | Description |
|---|---|---|
| id | string |
The unique identifier of the document |
Retrieves all documents stored in the wallet
Kind: static method of IWallet
Returns: Promise.<Array.<WalletDocument>> -
Array of all documents in the wallet
Retrieves multiple documents by their IDs
Kind: static method of IWallet
Returns: Promise.<Array.<WalletDocument>> -
Array of documents matching the provided IDs
| Param | Type | Description |
|---|---|---|
| idList | Array.<string> |
Array of document IDs to retrieve |
Retrieves all documents of a specific type
Kind: static method of IWallet
Returns: Promise.<Array.<WalletDocument>> -
Array of documents matching the specified type
| Param | Type | Description |
|---|---|---|
| type | string |
The document type to filter by (e.g., 'VerifiableCredential', 'DIDDocument') |
Adds a new document to the wallet
Kind: static method of IWallet
Returns: Promise.<WalletDocument> -
The created document with generated metadata
Emits: WalletEvents.event:documentAdded
| Param | Type | Description |
|---|---|---|
| json | any |
The document to add (must have valid JSON-LD structure) |
| [options] | any |
Optional parameters for document creation |
Example
const credential = {
"@context": ["https://www.w3.org/2018/credentials/v1"],
"type": ["VerifiableCredential"],
"issuer": "did:dock:123",
"credentialSubject": { "name": "John Doe" }
};
const addedDoc = await wallet.addDocument(credential);Updates an existing document
Kind: static method of IWallet
Returns: Promise.<WalletDocument> -
The updated document
Throws:
-
ErrorIf document doesn't exist
Emits: WalletEvents.event:documentUpdated
| Param | Type | Description |
|---|---|---|
| document | any |
The document with updated data (must include ID) |
| [options] | any |
Optional parameters for document update |
Removes a document from the wallet
Kind: static method of IWallet
Throws:
-
ErrorIf document is not found
Emits: WalletEvents.event:documentRemoved
| Param | Type | Description |
|---|---|---|
| id | string |
The ID of the document to remove |
| [options] | any |
Optional parameters for document removal |
Gets all documents correlated to a specific document
Kind: static method of IWallet
Returns: Promise.<Array.<WalletDocument>> -
Array of correlated documents
| Param | Type | Description |
|---|---|---|
| documentId | string |
The ID of the document to find correlations for |
Retrieves the keypair associated with an account
Kind: static method of IWallet
Returns: Promise.<any> -
The keypair associated with the account
| Param | Type | Description |
|---|---|---|
| accountId | string |
The account ID to get the keypair for |
Decrypts and retrieves documents from an encrypted wallet without importing
Kind: static method of IWallet
Returns: Promise.<any> -
Array of decrypted documents
| Param | Type | Description |
|---|---|---|
| json | any |
The encrypted wallet JSON |
| password | string |
Password to decrypt the wallet |
Imports documents from an encrypted Universal Wallet 2020 JSON
Kind: static method of IWallet
See: https://w3c-ccg.github.io/universal-wallet-interop-spec/
| Param | Type | Description |
|---|---|---|
| json | any |
The encrypted wallet JSON |
| password | string |
Password to decrypt the wallet |
Example
// Import from encrypted wallet backup
const walletBackup = { ... }; // encrypted wallet JSON
await wallet.importUniversalWalletJSON(walletBackup, 'mypassword');Exports specified documents as an encrypted JSON (test)
Kind: static method of IWallet
Returns: Promise.<any> -
Encrypted wallet JSON
| Param | Type | Description |
|---|---|---|
| params | Object |
Export parameters |
| params.documents | Array.<any> |
Documents to export |
| params.password | string |
Password for encryption |
Exports the entire wallet as an encrypted Universal Wallet 2020 JSON
Kind: static method of IWallet
Returns: any -
Encrypted Universal Wallet JSON representation
See: https://w3c-ccg.github.io/universal-wallet-interop-spec/
| Param | Type | Description |
|---|---|---|
| password | string |
Password for encryption |
Example
// Create encrypted backup of entire wallet
const backup = await wallet.exportUniversalWalletJSON('mypassword');
// Save backup to file or cloud storageProvides a high-level API for DID management operations
Kind: global interface
- IDIDProvider
- .importDID(params) ⇒
Promise.<Array.<any>> - .createDIDKey(params) ⇒
Promise.<{keyDoc: any, didDocumentResolution: any}> - .editDID(params) ⇒
Promise.<void> - .deleteDID(params) ⇒
Promise.<void> - .exportDID(params) ⇒
Promise.<any> - .getAll() ⇒
Promise.<Array.<any>> - .getDIDKeyPairs() ⇒
Promise.<Array.<any>> - .ensureDID() ⇒
Promise.<({keyDoc: any, didDocumentResolution: any}|void)> - .getDefaultDID() ⇒
Promise.<(string|undefined)>
- .importDID(params) ⇒
Imports a DID from an encrypted wallet JSON
Kind: static method of IDIDProvider
Returns: Promise.<Array.<any>> -
Array of imported documents
Throws:
-
ErrorIf password is incorrect or DID already exists in wallet
| Param | Type | Description |
|---|---|---|
| params | Object |
Import parameters |
| params.encryptedJSONWallet | any |
The encrypted wallet JSON containing the DID |
| params.password | string |
Password to decrypt the wallet |
Example
const importedDocs = await didProvider.importDID({
encryptedJSONWallet: encryptedBackup,
password: 'mypassword'
});Creates a new DID:key with an associated keypair
Kind: static method of IDIDProvider
Returns: Promise.<{keyDoc: any, didDocumentResolution: any}> -
The created keypair and DID document
Throws:
-
ErrorIf name is not provided
| Param | Type | Description |
|---|---|---|
| params | Object |
Creation parameters |
| params.name | string |
The name for the new DID |
| [params.derivePath] | string |
Optional derivation path for the keypair |
| [params.type] | string |
Optional key type specification |
Example
const {keyDoc, didDocumentResolution} = await didProvider.createDIDKey({
name: 'My Identity DID',
derivePath: "m/44'/60'/0'/0/0"
});Edits a DID document's name
Kind: static method of IDIDProvider
Throws:
-
ErrorIf document ID is not set or document not found
| Param | Type | Description |
|---|---|---|
| params | Object |
Edit parameters |
| params.id | string |
The ID of the DID document to edit |
| params.name | string |
The new name for the DID |
Example
await didProvider.editDID({
id: 'did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK',
name: 'Updated DID Name'
});Deletes a DID from the wallet
Kind: static method of IDIDProvider
Throws:
-
ErrorIf document ID is not set
| Param | Type | Description |
|---|---|---|
| params | Object |
Delete parameters |
| params.id | string |
The ID of the DID document to delete |
Example
await didProvider.deleteDID({
id: 'did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK'
});Exports a DID and its correlated documents as an encrypted JSON
Kind: static method of IDIDProvider
Returns: Promise.<any> -
Encrypted wallet JSON containing the DID and correlations
Throws:
-
ErrorIf DID document or keypair not found
| Param | Type | Description |
|---|---|---|
| params | Object |
Export parameters |
| params.id | string |
The ID of the DID document to export |
| params.password | string |
Password for encryption |
Example
const exportedDID = await didProvider.exportDID({
id: 'did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK',
password: 'mypassword'
});Retrieves all DIDs stored in the wallet
Kind: static method of IDIDProvider
Returns: Promise.<Array.<any>> -
Array of DID resolution response documents
Example
const allDIDs = await didProvider.getAll();
console.log(`Found ${allDIDs.length} DIDs in wallet`);Retrieves all keypairs associated with DIDs in the wallet
Kind: static method of IDIDProvider
Returns: Promise.<Array.<any>> -
Array of keypair documents
Example
const keyPairs = await didProvider.getDIDKeyPairs();
console.log(`Found ${keyPairs.length} DID keypairs`);Ensures at least one DID exists in the wallet, creating a default if none exist
Kind: static method of IDIDProvider
Returns: Promise.<({keyDoc: any, didDocumentResolution: any}|void)> -
The created DID if one was created, undefined otherwise
Example
// Ensure wallet has at least one DID
await didProvider.ensureDID();Gets the default DID from the wallet (first DID if exists)
Kind: static method of IDIDProvider
Returns: Promise.<(string|undefined)> -
The default DID identifier or undefined if no DIDs exist
Example
const defaultDID = await didProvider.getDefaultDID();
if (defaultDID) {
console.log(`Default DID: ${defaultDID}`);
}Provides a high-level API for DIDComm message management operations
Kind: global interface
- IMessageProvider
- .fetchMessages ⇒
Promise.<void> - .addMessageListener ⇒
function - .processDIDCommMessages ⇒
Promise.<void> - .processMessageRecurrentJob ⇒
Promise.<void> - .markMessageAsRead ⇒
Promise.<void> - .sendMessage(params) ⇒
Promise.<any> - .waitForMessage() ⇒
Promise.<any> - .startAutoFetch([timeout]) ⇒
function - .clearCache() ⇒
Promise.<void>
- .fetchMessages ⇒
Fetches new messages from the relay service
Kind: static property of IMessageProvider
Throws:
-
ErrorIf message fetching fails
Example
await messageProvider.fetchMessages();
console.log('Messages fetched successfully');Adds a listener for when messages are decrypted
Kind: static property of IMessageProvider
Returns: function -
Function to remove the listener
| Param | Type | Description |
|---|---|---|
| handler | function |
Callback function to handle decrypted messages |
Example
const removeListener = messageProvider.addMessageListener((message) => {
console.log('New message received:', message);
});
// Later, remove the listener
removeListener();Processes stored DIDComm messages and decrypts them
Kind: static property of IMessageProvider
Throws:
-
ErrorIf message processing fails
Example
await messageProvider.processDIDCommMessages();
console.log('Messages processed successfully');Starts the recurrent message processing job
Kind: static property of IMessageProvider
Example
await messageProvider.processMessageRecurrentJob();Marks a message as read and removes it from storage
Kind: static property of IMessageProvider
Throws:
-
ErrorIf message is not found or not a DIDComm message
| Param | Type | Description |
|---|---|---|
| messageId | string |
The ID of the message to mark as read |
Example
await messageProvider.markMessageAsRead('message-id-123');
console.log('Message marked as read');Sends a DIDComm message to a recipient
Kind: static method of IMessageProvider
Returns: Promise.<any> -
Result of sending the message
Throws:
-
ErrorIf sender DID not found or message sending fails
| Param | Type | Description |
|---|---|---|
| params | Object |
Message parameters |
| [params.from] | string |
Sender DID identifier |
| [params.to] | string |
Recipient DID identifier |
| [params.message] | any |
Message payload to send |
| [params.type] | string |
DIDComm message type |
| [params.did] | string |
@deprecated Use 'from' instead - Sender DID identifier |
| [params.recipientDid] | string |
@deprecated Use 'to' instead - Recipient DID identifier |
| [params.body] | any |
@deprecated Use 'message' instead - Message payload to send |
Example
await messageProvider.sendMessage({
from: 'did:key:sender123',
to: 'did:key:recipient456',
message: { hello: 'world' },
type: 'basic-message'
});Waits for the next incoming message
Kind: static method of IMessageProvider
Returns: Promise.<any> -
Promise that resolves with the next received message
Example
const nextMessage = await messageProvider.waitForMessage();
console.log('Received message:', nextMessage);Starts automatic message fetching at regular intervals
Kind: static method of IMessageProvider
Returns: function -
Function to stop the auto-fetch process
| Param | Type | Default | Description |
|---|---|---|---|
| [timeout] | number |
2000 |
Interval in milliseconds between fetch operations |
Example
const stopAutoFetch = messageProvider.startAutoFetch(5000);
// Later, stop auto-fetching
stopAutoFetch();Clears all cached messages from the wallet
Kind: static method of IMessageProvider
Example
await messageProvider.clearCache();
console.log('All messages cleared');Provides a high-level API for verifiable credential management operations
Kind: global interface
- ICredentialProvider
- .getCredentials ⇒
Array.<any> - .isBBSPlusCredential ⇒
boolean - .importCredentialFromURI(params) ⇒
Promise.<any> - .getMembershipWitness(credentialId) ⇒
Promise.<any> - .getById(id) ⇒
any - .isValid(credential, [forceFetch]) ⇒
Promise.<Object>|string|string|string - .getCredentialStatus(credential) ⇒
Promise.<Object>|string|string - .syncCredentialStatus(params) ⇒
Promise.<Array.<any>> - .addCredential(credential) ⇒
Promise.<any> - .removeCredential(credential) ⇒
Promise.<void>
- .getCredentials ⇒
Retrieves credentials from the wallet, optionally filtered by type
Kind: static property of ICredentialProvider
Returns: Array.<any> -
Array of credentials matching the specified type
| Param | Type | Default | Description |
|---|---|---|---|
| [type] | string |
"'VerifiableCredential'" |
The credential type to filter by |
Example
const allCredentials = credentialProvider.getCredentials();
const certificates = credentialProvider.getCredentials('Certificate');Checks if a credential uses BBS+ signature
Kind: static property of ICredentialProvider
Returns: boolean -
True if the credential uses BBS+ signature
| Param | Type | Description |
|---|---|---|
| credential | any |
The credential to check |
Example
const isBBS = credentialProvider.isBBSPlusCredential(credential);
if (isBBS) {
console.log('This credential uses BBS+ signatures');
}Imports a credential from a URI (supports OpenID credential offers)
Kind: static method of ICredentialProvider
Returns: Promise.<any> -
The imported credential
Throws:
-
ErrorIf import fails
| Param | Type | Description |
|---|---|---|
| params | Object |
Import parameters |
| params.uri | string |
The URI containing the credential offer |
| params.didProvider | any |
DID provider instance for key management |
| [params.getAuthCode] | function |
Optional callback to handle authorization |
Example
const credential = await credentialProvider.importCredentialFromURI({
uri: 'https://issuer.example.com/credential-offer',
didProvider,
getAuthCode: async (url) => getUserAuthCode(url)
});Gets the membership witness for a credential (used for BBS+ credentials)
Kind: static method of ICredentialProvider
Returns: Promise.<any> -
The membership witness data
| Param | Type | Description |
|---|---|---|
| credentialId | string |
The credential ID to get the witness for |
Example
const witness = await credentialProvider.getMembershipWitness('credential-123');Retrieves a credential by its ID
Kind: static method of ICredentialProvider
Returns: any -
The credential document
Throws:
-
ErrorIf credential is not found
| Param | Type | Description |
|---|---|---|
| id | string |
The unique identifier of the credential |
Example
const credential = await credentialProvider.getById('credential-123');Validates a credential by verifying its cryptographic proof and status
Kind: static method of ICredentialProvider
Returns: Promise.<Object> -
Validation result
string -
returns.status - Validation status (verified, revoked, expired, invalid, pending)
string -
[returns.error] - Error message if validation failed
string -
[returns.warning] - Warning message if any
Throws:
-
ErrorIf validation fails
| Param | Type | Default | Description |
|---|---|---|---|
| credential | any |
The credential to validate | |
| [forceFetch] | boolean |
false |
Whether to force refresh the credential status |
Example
const result = await credentialProvider.isValid(credential);
if (result.status === 'verified') {
console.log('Credential is valid');
} else if (result.status === 'revoked') {
console.log('Credential has been revoked');
}Gets the current status of a credential (cached, fast operation)
Kind: static method of ICredentialProvider
Returns: Promise.<Object> -
Current credential status
string -
returns.status - Current status of the credential
string -
[returns.error] - Error message if any
| Param | Type | Description |
|---|---|---|
| credential | any |
The credential to check |
Example
const status = await credentialProvider.getCredentialStatus(credential);
console.log(`Credential status: ${status.status}`);Synchronizes credential status from the blockchain
Kind: static method of ICredentialProvider
Returns: Promise.<Array.<any>> -
Array of credential status documents
| Param | Type | Default | Description |
|---|---|---|---|
| params | Object |
Sync parameters | |
| [params.credentialIds] | Array.<string> |
Optional list of credential IDs to sync | |
| [params.forceFetch] | boolean |
false |
Whether to force refresh from blockchain |
Example
// Sync all credentials
await credentialProvider.syncCredentialStatus({});
// Sync specific credentials
await credentialProvider.syncCredentialStatus({
credentialIds: ['cred-1', 'cred-2'],
forceFetch: true
});Adds a credential to the wallet
Kind: static method of ICredentialProvider
Returns: Promise.<any> -
The added credential document
| Param | Type | Description |
|---|---|---|
| credential | any |
The credential to add |
Example
const addedCredential = await credentialProvider.addCredential({
'@context': ['https://www.w3.org/2018/credentials/v1'],
type: ['VerifiableCredential'],
issuer: 'did:dock:issuer123',
credentialSubject: { name: 'Alice' }
});Removes a credential and all its related documents from the wallet
Kind: static method of ICredentialProvider
Throws:
-
ErrorIf credential is not found
| Param | Type | Description |
|---|---|---|
| credential | any |
The credential to remove |
Example
await credentialProvider.removeCredential(credential);
// Or by ID
await credentialProvider.removeCredential('credential-123');Callback functions for handling different stages of the identity verification process
Kind: global interface
Defines the contract for biometric enrollment and matching operations
Kind: global interface
Defines the contract for identity verification operations
Kind: global interface
Creates IDV provider instances with proper event handling and wallet integration
Kind: global interface
Provides a high-level API for biometric identity verification operations
Kind: global interface
- IBiometricProvider
- .startIDV
- .eventEmitter
- .startIDV(proofRequest) ⇒
Promise.<{enrollmentCredential: Credential, matchCredential: Credential}>
Starts the identity verification process using biometric credentials
Kind: static property of IBiometricProvider
Event emitter for IDV process events (onDeepLink, onMessage, onError, onCancel, onComplete)
Kind: static property of IBiometricProvider
IBiometricProvider.startIDV(proofRequest) ⇒ Promise.<{enrollmentCredential: Credential, matchCredential: Credential}>
Starts the identity verification process using biometric credentials
Kind: static method of IBiometricProvider
Returns: Promise.<{enrollmentCredential: Credential, matchCredential: Credential}> -
The enrollment and match credentials
Throws:
-
ErrorIf IDV process fails or biometric configs are missing
| Param | Type | Description |
|---|---|---|
| proofRequest | any |
The proof request containing biometric requirements |
Example
const result = await biometricProvider.startIDV({
input_descriptors: [{
constraints: {
fields: [{
path: ['$.credentialSubject.biometric.id'],
purpose: 'Biometric ID verification'
}]
}
}]
});Default implementation of QRCodeProcessor
This processor manages a registry of QR code handlers and executes them in priority order to process scanned QR codes. It provides a flexible, extensible system for handling various types of QR codes in a wallet application.
Kind: global class
Example
const processor = new DefaultQRCodeProcessor();
// Register handlers
processor.registerHandler(new OID4VCHandler());
processor.registerHandler(new CredentialHandler());
// Process QR code
const result = await processor.process(scannedData);
if (result.success) {
console.log('QR code processed:', result.data);
} else {
console.error('Failed to process QR code:', result.error);
}Register a new QR code handler
Kind: instance method of DefaultQRCodeProcessor
Throws:
- Error if a handler with the same ID is already registered
| Param | Description |
|---|---|
| handler | The handler to register |
Unregister a QR code handler by its ID
Kind: instance method of DefaultQRCodeProcessor
Returns:
True if the handler was found and removed, false otherwise
| Param | Description |
|---|---|
| id | The ID of the handler to unregister |
Get all registered handlers sorted by priority
Kind: instance method of DefaultQRCodeProcessor
Returns:
Array of registered handlers sorted by priority (lowest first)
Get a specific handler by its ID
Kind: instance method of DefaultQRCodeProcessor
Returns:
The handler if found, undefined otherwise
| Param | Description |
|---|---|
| id | The ID of the handler to retrieve |
Clear all registered handlers
Kind: instance method of DefaultQRCodeProcessor
Process QR code data through registered handlers
This method:
- Prepares the context from raw QR data
- Executes handlers in priority order
- Returns the first successful result (or continues if stopOnFirstSuccess is false)
- Returns an error result if no handler can process the data
Kind: instance method of DefaultQRCodeProcessor
Returns:
Result of the processing
| Param | Description |
|---|---|
| data | Raw QR code data string |
| options | Processing options |
Default context preparation function
This method attempts to parse the raw QR data as JSON or URL. Override this by providing a custom prepareContext function in ProcessOptions.
Kind: instance method of DefaultQRCodeProcessor
Returns:
Prepared context object
| Param | Description |
|---|---|
| data | Raw QR code data string |
Execute a promise with a timeout
Kind: instance method of DefaultQRCodeProcessor
Returns:
Result of the promise
Throws:
- Error if the promise times out
| Param | Description |
|---|---|
| promise | Promise to execute |
| timeoutMs | Timeout in milliseconds |
Kind: global variable
Returns:
OOB message to start a wallet to wallet verification flow The holder will scan it as QR code and should have the context to start the verification flow
Given an Api URL, resolve the network ID For now it will be applied for creds and certs It can be extended to resolve other external URLs
Kind: global variable
Create an OID4VC handler with custom configuration
This is a convenience factory function for creating an OID4VC handler.
Kind: global variable
Returns:
Configured OID4VC handler
| Param | Description |
|---|---|
| config | Handler configuration |
Example
const handler = createOID4VCHandler({
onImportCredential: async (uri) => {
// Your import logic
return { success: true };
},
});Check if this is an OID4VC URI
Matches URIs that start with any of the configured prefixes. By default, matches: openid-credential-offer://
Kind: instance method of OID4VCHandler
Returns:
True if this handler can process the URI
| Param | Description |
|---|---|
| context | The QR code context |
Process the OID4VC credential offer URI
Delegates to the configured onImportCredential callback for actual processing. This allows apps to implement their own navigation, UI, and error handling.
Kind: instance method of OID4VCHandler
Returns:
Result of the processing
| Param | Description |
|---|---|
| context | The QR code context |
Create a new QR code processor instance
This is a convenience factory function for creating a processor.
Kind: global variable
Returns:
New processor instance with handlers registered
| Param | Description |
|---|---|
| handlers | Optional array of handlers to register immediately |
Example
const processor = createQRCodeProcessor([
new OID4VCHandler(),
new CredentialHandler(),
]);Example
const processor = new DefaultQRCodeProcessor();
// Register handlers
processor.registerHandler(new OID4VCHandler());
processor.registerHandler(new CredentialHandler());
// Process QR code
const result = await processor.process(scannedData);
if (result.success) {
console.log('QR code processed:', result.data);
} else {
console.error('Failed to process QR code:', result.error);
}Register a new QR code handler
Kind: instance method of DefaultQRCodeProcessor
Throws:
- Error if a handler with the same ID is already registered
| Param | Description |
|---|---|
| handler | The handler to register |
Unregister a QR code handler by its ID
Kind: instance method of DefaultQRCodeProcessor
Returns:
True if the handler was found and removed, false otherwise
| Param | Description |
|---|---|
| id | The ID of the handler to unregister |
Get all registered handlers sorted by priority
Kind: instance method of DefaultQRCodeProcessor
Returns:
Array of registered handlers sorted by priority (lowest first)
Get a specific handler by its ID
Kind: instance method of DefaultQRCodeProcessor
Returns:
The handler if found, undefined otherwise
| Param | Description |
|---|---|
| id | The ID of the handler to retrieve |
Clear all registered handlers
Kind: instance method of DefaultQRCodeProcessor
Process QR code data through registered handlers
This method:
- Prepares the context from raw QR data
- Executes handlers in priority order
- Returns the first successful result (or continues if stopOnFirstSuccess is false)
- Returns an error result if no handler can process the data
Kind: instance method of DefaultQRCodeProcessor
Returns:
Result of the processing
| Param | Description |
|---|---|
| data | Raw QR code data string |
| options | Processing options |
Default context preparation function
This method attempts to parse the raw QR data as JSON or URL. Override this by providing a custom prepareContext function in ProcessOptions.
Kind: instance method of DefaultQRCodeProcessor
Returns:
Prepared context object
| Param | Description |
|---|---|
| data | Raw QR code data string |
Execute a promise with a timeout
Kind: instance method of DefaultQRCodeProcessor
Returns:
Result of the promise
Throws:
- Error if the promise times out
| Param | Description |
|---|---|
| promise | Promise to execute |
| timeoutMs | Timeout in milliseconds |
DIDComm Message helpers Check https://identity.foundation/didcomm-messaging/spec/#out-of-band-messages for more details
Kind: global constant
Sender: Verifier OOB message to request a verifiable presentation from the holder
Kind: global function
Sender: Holder Start a wallet to wallet verification flow
Kind: global function
Sender: Holder Send a verifiable presentation to the verifier
Kind: global function
Sender: Verifier Sends an the presentation result to the holder
Kind: global function
Update existing substrate network connection Compare connected substrate connection with the current walle network Disconnect and Establish a new connection if the network is different
Kind: global function
Possible wallet status values
Kind: global typedef
Supported keypair types
Kind: global typedef
Configuration options for biometric provider operations
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| enrollmentCredentialType | string |
The credential type used for biometric enrollment |
| biometricMatchCredentialType | string |
The credential type used for biometric matching |
| idvConfigs | E |
IDV provider-specific configuration options |
Built-in handler for OID4VC (OpenID for Verifiable Credentials) URIs
This is a generic handler that can be configured with app-specific callbacks for importing credentials. The handler itself only handles protocol detection and delegates the actual import logic to the configured callback.
import { OID4VCHandler } from '@docknetwork/wallet-sdk-core/src/qr-handlers/builtin';
import { getCredentialProvider } from '@docknetwork/wallet-sdk-react-native';
const handler = new OID4VCHandler({
onImportCredential: async (uri, context) => {
try {
// Use SDK to import credential
await getCredentialProvider().importCredentialFromURI({
uri,
didProvider: getDIDProvider(),
getAuthCode: async (authUrl) => {
// App-specific auth handling
return await showAuthWebView(authUrl);
},
});
return { success: true };} catch (error) { return { success: false, error: error instanceof Error ? error : new Error(String(error)), };}
},
});
processor.registerHandler(handler);
Default priority: 5 (very high) This ensures OID4VC URIs are checked before other credential handlers.
Kind: global class
Category: Built-in Handlers
Check if this is an OID4VC URI
Matches URIs that start with any of the configured prefixes. By default, matches: openid-credential-offer://
Kind: instance method of OID4VCHandler
Returns:
True if this handler can process the URI
| Param | Description |
|---|---|
| context | The QR code context |
Process the OID4VC credential offer URI
Delegates to the configured onImportCredential callback for actual processing. This allows apps to implement their own navigation, UI, and error handling.
Kind: instance method of OID4VCHandler
Returns:
Result of the processing
| Param | Description |
|---|---|
| context | The QR code context |