

import { PublicJwk } from "../../../modules/kms/jwk/PublicJwk.mjs";
import "../../../modules/kms/index.mjs";
import { CredoWebCryptoKey } from "../CredoWebCryptoKey.mjs";
import * as core from "webcrypto-core";

//#region src/crypto/webcrypto/providers/CredoEcdsaProvider.ts
var CredoEcdsaProvider = class extends core.EcdsaProvider {
	constructor(walletWebCrypto) {
		super();
		this.walletWebCrypto = walletWebCrypto;
	}
	async onSign(algorithm, key, data) {
		return this.walletWebCrypto.sign(key, new Uint8Array(data), algorithm);
	}
	async onVerify(algorithm, key, signature, data) {
		return this.walletWebCrypto.verify(key, algorithm, new Uint8Array(data), new Uint8Array(signature));
	}
	async onGenerateKey(algorithm, extractable, keyUsages) {
		const key = await this.walletWebCrypto.generate(algorithm);
		const publicJwk = PublicJwk.fromPublicJwk(key.publicJwk);
		return {
			publicKey: new CredoWebCryptoKey(publicJwk, algorithm, extractable, "public", keyUsages),
			privateKey: new CredoWebCryptoKey(publicJwk, algorithm, extractable, "private", keyUsages)
		};
	}
	async onExportKey(format, key) {
		return this.walletWebCrypto.exportKey(format, key);
	}
	async onImportKey(format, keyData, algorithm, extractable, keyUsages) {
		return this.walletWebCrypto.importKey(format, keyData.kty ? keyData : new Uint8Array(keyData), algorithm, extractable, keyUsages);
	}
};

//#endregion
export { CredoEcdsaProvider };
//# sourceMappingURL=CredoEcdsaProvider.mjs.map