aladinnetwork-blockstack
Version:
The Aladin Javascript library for authentication, identity, and storage.
27 lines • 1.05 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const service_1 = require("./service");
class Github extends service_1.Service {
static getBaseUrls() {
const baseUrls = ['https://gist.github.com/', 'http://gist.github.com', 'gist.github.com'];
return baseUrls;
}
static normalizeUrl(proof) {
return '';
}
static getProofUrl(proof) {
const baseUrls = this.getBaseUrls();
let proofUrl = proof.proof_url.toLowerCase();
proofUrl = super.prefixScheme(proofUrl);
for (let i = 0; i < baseUrls.length; i++) {
const requiredPrefix = `${baseUrls[i]}${proof.identifier}`.toLowerCase();
if (proofUrl.startsWith(requiredPrefix)) {
const raw = proofUrl.endsWith('/') ? 'raw' : '/raw';
return `${proofUrl}${raw}`;
}
}
throw new Error(`Proof url ${proof.proof_url} is not valid for service ${proof.service}`);
}
}
exports.Github = Github;
//# sourceMappingURL=github.js.map
;