var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
import { DwnErrorCode } from '../../src/core/dwn-error.js';
import { ed25519 } from '../../src/jose/algorithms/signing/ed25519.js';
import { expect } from 'chai';
import { KeyDerivationScheme, Records } from '../../src/index.js';
describe('Records', () => {
    if (process.env.TESTSOFF === 'true') {
        return;
    }
    describe('deriveLeafPublicKey()', () => {
        it('should throw if given public key is not supported', () => __awaiter(void 0, void 0, void 0, function* () {
            const rootPublicKey = (yield ed25519.generateKeyPair()).publicJwk;
            yield expect(Records.deriveLeafPublicKey(rootPublicKey, ['a'])).to.be.rejectedWith(DwnErrorCode.RecordsDeriveLeafPublicKeyUnSupportedCurve);
        }));
    });
    describe('deriveLeafPrivateKey()', () => {
        it('should throw if given private key is not supported', () => __awaiter(void 0, void 0, void 0, function* () {
            const derivedKey = {
                rootKeyId: 'unused',
                derivationScheme: KeyDerivationScheme.Protocols,
                derivedPrivateKey: (yield ed25519.generateKeyPair()).privateJwk
            };
            yield expect(Records.deriveLeafPrivateKey(derivedKey, ['a'])).to.be.rejectedWith(DwnErrorCode.RecordsDeriveLeafPrivateKeyUnSupportedCurve);
        }));
    });
});
//# sourceMappingURL=records.spec.js.map