Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(x509): added test to create self-signed certificate with Curve Ed25519 #2031

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading