

const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.js');
const require_PublicJwk = require('../../../modules/kms/jwk/PublicJwk.js');
require('../../../modules/kms/index.js');
const require_CredoWebCryptoKey = require('../CredoWebCryptoKey.js');
let webcrypto_core = require("webcrypto-core");
webcrypto_core = require_rolldown_runtime.__toESM(webcrypto_core);

//#region src/crypto/webcrypto/providers/CredoEd25519Provider.ts
var CredoEd25519Provider = class extends webcrypto_core.Ed25519Provider {
	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 = require_PublicJwk.PublicJwk.fromPublicJwk(key.publicJwk);
		return {
			publicKey: new require_CredoWebCryptoKey.CredoWebCryptoKey(publicJwk, algorithm, extractable, "public", keyUsages),
			privateKey: new require_CredoWebCryptoKey.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
exports.CredoEd25519Provider = CredoEd25519Provider;