Skip to content

Commit 66971d8

Browse files
committed
fix: use valid SPKAC fixture in tests, update docs site coverage data
1 parent fd72f21 commit 66971d8

2 files changed

Lines changed: 36 additions & 25 deletions

File tree

docs/data/coverage.ts

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ export const COVERAGE_DATA: CoverageCategory[] = [
4444
{
4545
name: 'Certificate',
4646
subItems: [
47-
{ name: 'exportChallenge', status: 'missing' },
48-
{ name: 'exportPublicKey', status: 'missing' },
49-
{ name: 'verifySpkac', status: 'missing' },
47+
{ name: 'exportChallenge', status: 'implemented' },
48+
{ name: 'exportPublicKey', status: 'implemented' },
49+
{ name: 'verifySpkac', status: 'implemented' },
5050
],
5151
},
5252
{
@@ -76,8 +76,15 @@ export const COVERAGE_DATA: CoverageCategory[] = [
7676
},
7777
{
7878
name: 'ECDH',
79-
status: 'implemented',
80-
note: 'Use simple ECDH methods instead',
79+
subItems: [
80+
{ name: 'convertKey', status: 'implemented', note: 'static' },
81+
{ name: 'computeSecret', status: 'implemented' },
82+
{ name: 'generateKeys', status: 'implemented' },
83+
{ name: 'getPrivateKey', status: 'implemented' },
84+
{ name: 'getPublicKey', status: 'implemented' },
85+
{ name: 'setPrivateKey', status: 'implemented' },
86+
{ name: 'setPublicKey', status: 'implemented' },
87+
],
8188
},
8289
{
8390
name: 'Hash',
@@ -114,11 +121,11 @@ export const COVERAGE_DATA: CoverageCategory[] = [
114121
{ name: 'asymmetricKeyType', status: 'implemented' },
115122
{ name: 'export', status: 'implemented' },
116123
{ name: 'type', status: 'implemented' },
117-
{ name: 'asymmetricKeyDetails', status: 'missing' },
124+
{ name: 'asymmetricKeyDetails', status: 'implemented' },
118125
{ name: 'equals', status: 'implemented' },
119126
{ name: 'symmetricKeySize', status: 'implemented' },
120-
{ name: 'toCryptoKey', status: 'missing' },
121-
{ name: 'from', status: 'missing', note: 'static' },
127+
{ name: 'toCryptoKey', status: 'implemented' },
128+
{ name: 'from', status: 'implemented', note: 'static' },
122129
],
123130
},
124131
{
@@ -130,8 +137,8 @@ export const COVERAGE_DATA: CoverageCategory[] = [
130137
{
131138
title: 'Crypto Methods',
132139
items: [
133-
{ name: 'argon2', status: 'missing' },
134-
{ name: 'checkPrime', status: 'missing' },
140+
{ name: 'argon2', status: 'implemented' },
141+
{ name: 'checkPrime', status: 'implemented' },
135142
{ name: 'constants', status: 'implemented' },
136143
{ name: 'createCipheriv', status: 'implemented' },
137144
{ name: 'createDecipheriv', status: 'implemented' },
@@ -201,8 +208,8 @@ export const COVERAGE_DATA: CoverageCategory[] = [
201208
{ name: 'hmac', status: 'implemented' },
202209
],
203210
},
204-
{ name: 'generatePrime', status: 'missing' },
205-
{ name: 'getCipherInfo', status: 'missing' },
211+
{ name: 'generatePrime', status: 'implemented' },
212+
{ name: 'getCipherInfo', status: 'implemented' },
206213
{ name: 'getCiphers', status: 'implemented' },
207214
{ name: 'getCurves', status: 'implemented' },
208215
{ name: 'getDiffieHellman', status: 'implemented' },

example/src/tests/certificate/certificate_tests.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,22 @@ import { assert } from 'chai';
44

55
const SUITE = 'certificate';
66

7-
// Known valid SPKAC (Netscape Signed Public Key and Challenge)
8-
// Generated with: openssl spkac -key test.pem -challenge test
7+
// Node.js test fixture: 2048-bit RSA SPKAC with challenge "this-is-a-challenge"
98
const validSpkac =
10-
'MIIBXjCByDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA3V' +
11-
'OalmRSaIBk2fVEKEECNBbOJMFCMHBOBYhBjqRLNeGq8GOWQ6qn' +
12-
'FJycJgbYxOWL/4y7FuyFdEiRm3lMiDl0FR2WzhqFDsT7LMfMaV' +
13-
'Bv39JMmPOfUoqHaEYAN2Bvw9bMT0DHXpcFVGkDHFnYPFvKfBxKx' +
14-
'mCYSiEkGrgK7yDiwl2kCAwEAARYEbm9uZTANBgkqhkiG9w0BAQQ' +
15-
'FAAOBg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SjRc4m6' +
22+
'hnriEkc=';
1923

2024
const invalidSpkac = 'not-a-valid-spkac';
2125

@@ -47,10 +51,10 @@ test(SUITE, 'exportPublicKey returns empty buffer for invalid SPKAC', () => {
4751
assert.strictEqual(result.length, 0);
4852
});
4953

50-
test(SUITE, 'exportChallenge returns Buffer', () => {
54+
test(SUITE, 'exportChallenge returns correct challenge string', () => {
5155
const result = Certificate.exportChallenge(validSpkac);
52-
assert.isOk(result);
5356
assert.isTrue(Buffer.isBuffer(result));
57+
assert.strictEqual(result.toString('utf8'), 'this-is-a-challenge');
5458
});
5559

5660
test(SUITE, 'exportChallenge returns empty buffer for invalid SPKAC', () => {

0 commit comments

Comments
 (0)