{"version":3,"file":"did.mjs","names":[],"sources":["../../src/utils/did.ts"],"sourcesContent":["import { TypedArrayEncoder } from './TypedArrayEncoder'\n\nexport function indyDidFromPublicKeyBase58(publicKeyBase58: string): string {\n  const buffer = TypedArrayEncoder.fromBase58(publicKeyBase58)\n\n  const did = TypedArrayEncoder.toBase58(buffer.slice(0, 16))\n\n  return did\n}\n\n/**\n * Checks whether `potentialDid` is a valid DID. You can optionally provide a `method` to\n * check whether the did is for that specific method.\n *\n * Note: the check in this method is very simple and just check whether the did starts with\n * `did:` or `did:<method>:`. It does not do an advanced regex check on the did.\n */\nexport function isDid(potentialDid: string, method?: string) {\n  return method ? potentialDid.startsWith(`did:${method}:`) : potentialDid.startsWith('did:')\n}\n"],"mappings":";;;;;AAEA,SAAgB,2BAA2B,iBAAiC;CAC1E,MAAM,SAAS,kBAAkB,WAAW,gBAAgB;AAI5D,QAFY,kBAAkB,SAAS,OAAO,MAAM,GAAG,GAAG,CAAC;;;;;;;;;AAY7D,SAAgB,MAAM,cAAsB,QAAiB;AAC3D,QAAO,SAAS,aAAa,WAAW,OAAO,OAAO,GAAG,GAAG,aAAa,WAAW,OAAO"}