-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #197 from docknetwork/DCKM-336-create-wallet-sdk-p…
…ackage-for-the-biometrics-plugin DCKM-336: create biometrics plugin interface
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; |