UNPKG

blockstack

Version:

The Blockstack Javascript library for authentication, identity, and storage.

57 lines 1.89 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const service_1 = require("./service"); class LinkedIn extends service_1.Service { getBaseUrls() { const baseUrls = [ 'https://www.linkedin.com/feed/update/', 'http://www.linkedin.com/feed/update/', 'www.linkedin.com/feed/update/' ]; return baseUrls; } getProofUrl(proof) { const baseUrls = this.getBaseUrls(); let proofUrl = proof.proof_url.toLowerCase(); proofUrl = super.prefixScheme(proofUrl); for (let i = 0; i < baseUrls.length; i++) { if (proofUrl.startsWith(`${baseUrls[i]}`)) { return proofUrl; } } throw new Error(`Proof url ${proof.proof_url} is not valid for service ${proof.service}`); } normalizeUrl(_proof) { return ''; } shouldValidateIdentityInBody() { return true; } getProofIdentity(searchText, cheerio) { const $ = cheerio.load(searchText); const profileLink = $('body > main header a'); if (profileLink !== undefined) { if (profileLink.attr('href') === undefined) { return ''; } const url = profileLink.attr('href'); // Parse URL for identifier const identifier = url.split('?').shift().split('/').pop(); return identifier; } else { return ''; } } getProofStatement(searchText, cheerio) { const $ = cheerio.load(searchText); const postContent = $('head > meta[property="og:title"]'); let statement = ''; if (postContent !== undefined) { statement = postContent.attr('content'); } return statement; } } exports.LinkedIn = LinkedIn; //# sourceMappingURL=linkedIn.js.map