MCPcopy Index your code
hub / github.com/mailvelope/mailvelope / url

Function url

src/modules/openpgpKeyServer.js:71–81  ·  view source on GitHub ↗

* Helper function to create a url with the proper path for an api request. * @param {String} [options.email] - The user id's email address * @param {String} [options.keyId] - The long 16 char key id * @param {String} [options.fingerprint] - The 40 char v4 fingerprint * @return {String} The co

({email, keyId, fingerprint} = {})

Source from the content-addressed store, hash-verified

69 * @return {String} The complete request url
70 */
71function url({email, keyId, fingerprint} = {}) {
72 const url = `${DEFAULT_URL}/vks/v1/`;
73 if (email) {
74 return `${url}by-email/${encodeURIComponent(email)}`;
75 } else if (fingerprint) {
76 return `${url}by-fingerprint/${encodeURIComponent(removeHexPrefix(fingerprint).toUpperCase())}`;
77 } else if (keyId) {
78 return `${url}by-keyid/${encodeURIComponent(removeHexPrefix(keyId).toUpperCase())}`;
79 }
80 return url;
81}

Callers 1

lookupFunction · 0.70

Calls 1

removeHexPrefixFunction · 0.90

Tested by

no test coverage detected