Skip to content

Commit

Permalink
chore(x509): added test to create self-signed certificate with Curve …
Browse files Browse the repository at this point in the history
…Ed25519 (#2031)

Signed-off-by: Berend Sliedrecht <[email protected]>
  • Loading branch information
berendsliedrecht committed Sep 12, 2024
1 parent 5ddd37a commit 4c1108c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion packages/core/src/modules/x509/__tests__/X509Service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,24 @@ describe('X509Service', () => {
})
})

it('should generate a self-signed X509 Certificate', async () => {
it('should generate a self-signed X509 Certificate with Ed25519', async () => {
const key = await agentContext.wallet.createKey({ keyType: KeyType.Ed25519 })

const selfSignedCertificate = await X509Service.createSelfSignedCertificate(agentContext, {
key,
})

expect(selfSignedCertificate.publicKey.publicKeyBase58).toStrictEqual(key.publicKeyBase58)
expect(selfSignedCertificate.sanDnsNames).toStrictEqual([])
expect(selfSignedCertificate.sanUriNames).toStrictEqual([])

const pemCertificate = selfSignedCertificate.toString('pem')

expect(pemCertificate.startsWith('-----BEGIN CERTIFICATE-----\n')).toBeTruthy()
expect(pemCertificate.endsWith('\n-----END CERTIFICATE-----')).toBeTruthy()
})

it('should generate a self-signed X509 Certificate with P256', async () => {
const key = await agentContext.wallet.createKey({ keyType: KeyType.P256 })

const selfSignedCertificate = await X509Service.createSelfSignedCertificate(agentContext, {
Expand Down

0 comments on commit 4c1108c

Please sign in to comment.