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

feat: test coverage increase in ed25519.ts #815

Merged
Merged
Changes from 1 commit
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
Prev Previous commit
refactor: refactored imports t fix lint errors
  • Loading branch information
ANIRUDH-333 committed Oct 5, 2024
commit 47c2e3e79129cc102535b355e33bf5260bf9cf47
18 changes: 10 additions & 8 deletions tests/jose/jws/general.spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import chai, { expect } from 'chai';
import { expect } from 'chai';
import sinon from 'sinon';
import { UniversalResolver } from '@web5/dids';

import { ed25519 } from '../../../src/jose/algorithms/signing/ed25519.js';
import { Encoder } from '../../../src/utils/encoder.js';
import { GeneralJwsBuilder } from '../../../src/jose/jws/general/builder.js';
import { GeneralJwsVerifier } from '../../../src/jose/jws/general/verifier.js';
import { Jws } from '../../../src/utils/jws.js';
import { PrivateKeySigner } from '../../../src/index.js';
import { signatureAlgorithms } from '../../../src/jose/algorithms/signing/signature-algorithms.js';
import sinon from 'sinon';
import { UniversalResolver } from '@web5/dids';
import { Encoder } from '../../../src/utils/encoder.js';
import { ed25519 } from '../../../src/jose/algorithms/signing/ed25519.js';
import { DwnError, DwnErrorCode } from '../../../src/core/dwn-error.js';


const { Ed25519, secp256k1 } = signatureAlgorithms;
const secp256r1 = signatureAlgorithms['P-256'];

Expand Down Expand Up @@ -129,9 +131,9 @@ describe('General JWS Sign/Verify', () => {

it('should throw an error for invalid Ed25519 JWK', async () => {
const invalidJwk = {
kty: 'RSA', // Invalid key type
crv: 'Ed25519',
d: 'invalid-private-key'
kty : 'RSA', // Invalid key type
crv : 'Ed25519',
d : 'invalid-private-key'
};

const content = new TextEncoder().encode('anyPayloadValue');
Expand Down