

const require_JsonEncoder = require('../../../../utils/JsonEncoder.js');
require('../../../../utils/index.js');
const require_PublicJwk = require('../../../kms/jwk/PublicJwk.js');
require('../../../kms/index.js');
const require_parse = require('../../domain/parse.js');
const require_didJwkDidDocument = require('./didJwkDidDocument.js');

//#region src/modules/dids/methods/jwk/DidJwk.ts
var DidJwk = class DidJwk {
	constructor(did, publicJwk) {
		this.did = did;
		this.publicJwk = publicJwk;
	}
	get allowsEncrypting() {
		return this.publicJwk.toJson().use === "enc" || this.publicJwk.supportdEncryptionKeyAgreementAlgorithms.length > 0;
	}
	get allowsSigning() {
		return this.publicJwk.toJson().use === "sig" || this.publicJwk.supportedSignatureAlgorithms.length > 0;
	}
	static fromDid(did) {
		const parsed = require_parse.parseDid(did);
		const jwkJson = require_JsonEncoder.JsonEncoder.fromBase64(parsed.id);
		return new DidJwk(did, require_PublicJwk.PublicJwk.fromUnknown(jwkJson));
	}
	/**
	* A did:jwk DID can only have one verification method, and the verification method
	* id will always be `<did>#0`.
	*/
	get verificationMethodId() {
		return `${this.did}#0`;
	}
	static fromPublicJwk(publicJwk) {
		return new DidJwk(`did:jwk:${require_JsonEncoder.JsonEncoder.toBase64URL(publicJwk.toJson({ includeKid: false }))}`, publicJwk);
	}
	get jwkJson() {
		return this.publicJwk.toJson();
	}
	get didDocument() {
		return require_didJwkDidDocument.getDidJwkDocument(this);
	}
};

//#endregion
exports.DidJwk = DidJwk;