

const require_TypedArrayEncoder = require('./TypedArrayEncoder.js');

//#region src/utils/did.ts
function indyDidFromPublicKeyBase58(publicKeyBase58) {
	const buffer = require_TypedArrayEncoder.TypedArrayEncoder.fromBase58(publicKeyBase58);
	return require_TypedArrayEncoder.TypedArrayEncoder.toBase58(buffer.slice(0, 16));
}
/**
* Checks whether `potentialDid` is a valid DID. You can optionally provide a `method` to
* check whether the did is for that specific method.
*
* Note: the check in this method is very simple and just check whether the did starts with
* `did:` or `did:<method>:`. It does not do an advanced regex check on the did.
*/
function isDid(potentialDid, method) {
	return method ? potentialDid.startsWith(`did:${method}:`) : potentialDid.startsWith("did:");
}

//#endregion
exports.indyDidFromPublicKeyBase58 = indyDidFromPublicKeyBase58;
exports.isDid = isDid;