Skip to content

Commit

Permalink
Merge pull request #197 from docknetwork/DCKM-336-create-wallet-sdk-p…
Browse files Browse the repository at this point in the history
…ackage-for-the-biometrics-plugin

DCKM-336: create biometrics plugin interface
  • Loading branch information
maycon-mello authored Jan 26, 2024
2 parents 29eaf5e + 8011cc1 commit 96cfd39
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions packages/react-native/lib/default-biometrics-plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import axios from 'axios';


function hasProofOfBiometrics(proofRequest) {
// need to define which property will define that
// it should be handled by certs maybe
}

// example key, TODO: move this to env variables
const DOCK_API_KEY = '<some-api-key>';

async function issueBiometricsVC() {
// vcData
const vcSubject = {
timestamp: Date.now(),
biometricsIdentifier: '123', // useSomeDeviceIdentifierhere() // use a device identifier
}


const options = {
method: 'POST',
url: 'https://api-staging.dock.io/credentials',
headers: {
'Content-Type': 'application/json',
'DOCK-API-TOKEN':
},
data: {
anchor: false,
persist: false,
credential: {
name: 'Biometrics Credential',
type: ['VerifiableCredential', 'BiometricsCredential'],
issuer: 'did:dock:5GJeBeStWSxqyPGUJnERMFhm3wKcfCZP6nhqtoKyRAmq9FeU',
issuanceDate: '2024-01-09T19:14:04.108Z',
subject: vcSubject,
},
algorithm: 'dockbbs+',
},
};

const vc = await axios.request(options).then(function (response) {
return response.data;
});


// mock-biometric check, use react-native

return vc;
}

export const defaultBiometricsPlugin = {
hasProofOfBiometrics,
issueBiometricsVC,
};

0 comments on commit 96cfd39

Please sign in to comment.