import { signatureAlgorithms } from '../../../../src/jose/algorithms/signing/signature-algorithms.js';
import { validateJsonSchema } from '../../../../src/schema-validator.js';
import { describe, expect, it } from 'bun:test';
const { Ed25519, secp256k1 } = signatureAlgorithms;
describe('PublicJwk Schema', async () => {
    const { publicJwk: publicJwkSecp256k1 } = await secp256k1.generateKeyPair();
    const { publicJwk: publicJwkEd25519 } = await Ed25519.generateKeyPair();
    const publicJwkRsa = {
        'kty': 'RSA',
        'e': 'AQAB',
        'use': 'sig',
        'alg': 'RS256',
        'n': 'abcd1234'
    };
    it('should not throw an exception if properly formatted publicJwk', () => {
        expect(() => validateJsonSchema('PublicJwk', publicJwkSecp256k1)).not.toThrow();
        expect(() => validateJsonSchema('PublicJwk', publicJwkEd25519)).not.toThrow();
        expect(() => validateJsonSchema('PublicJwk', publicJwkRsa)).not.toThrow();
    });
    it('should throw an exception if publicJwk has private property', () => {
        expect(() => validateJsonSchema('PublicJwk', { ...publicJwkSecp256k1, d: 'supersecret' })).toThrow();
        expect(() => validateJsonSchema('PublicJwk', { ...publicJwkEd25519, d: 'supersecret' })).toThrow();
        expect(() => validateJsonSchema('PublicJwk', { ...publicJwkRsa, oth: {} })).toThrow();
        expect(() => validateJsonSchema('PublicJwk', { ...publicJwkRsa, d: 'supersecret', oth: {} })).toThrow();
    });
});
//# sourceMappingURL=public-jwk.spec.js.map