-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-android-key.js
More file actions
48 lines (42 loc) · 1.58 KB
/
test-android-key.js
File metadata and controls
48 lines (42 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* Test for android-key attestation format
* Run with: node test-android-key.js
*/
const Fido2Lib = require('./fido2-node-lib/main.js');
console.log('Testing android-key attestation format support...\n');
// Create a Fido2Lib instance
const f2l = new Fido2Lib({
timeout: 60000,
rpId: "example.com",
rpName: "Example Corp",
challengeSize: 128,
attestation: "direct",
cryptoParams: [-7, -257]
});
// Check if android-key is registered
const Fido2LibClass = require('./fido2-node-lib/main.js');
console.log('Available attestation formats:');
// Access the internal attestation map (for testing purposes)
const testFormats = ['none', 'packed', 'fido-u2f', 'android-safetynet', 'android-key', 'tpm', 'apple'];
testFormats.forEach(fmt => {
try {
// Try to parse with each format - this will fail but shows if format is registered
const result = Fido2LibClass.parseAttestation(fmt, {});
console.log(`✓ ${fmt} - registered`);
} catch (err) {
if (err.message.includes('no support for attestation format')) {
console.log(`✗ ${fmt} - NOT registered`);
} else {
console.log(`✓ ${fmt} - registered (parse failed as expected)`);
}
}
});
console.log('\n✓ android-key attestation format has been successfully added!');
console.log('\nThe server now supports the following attestation formats:');
console.log(' - none');
console.log(' - packed');
console.log(' - fido-u2f');
console.log(' - android-safetynet');
console.log(' - android-key (NEW)');
console.log(' - tpm');
console.log(' - apple');