UNPKG

@hypernetlabs/hypernet-id-web-integration

Version:

Web integration package for Hypernet.ID. Provides basic access to user identity status and facilitates onboarding workflows.

39 lines 1.85 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.HypernetID = void 0; const utils_1 = require("@hypernetlabs/utils"); const inversify_1 = require("inversify"); const neverthrow_1 = require("neverthrow"); const configuration_1 = require("./configuration"); let HypernetID = class HypernetID { constructor(customerId) { this.customerId = customerId; this.ajaxUtils = new utils_1.AxiosAjaxUtils(); } getIdentityTokenForAccount(accountAddress) { const requestUrl = new URL(`${configuration_1.apiBaseUrl}/address/${accountAddress}`); return this.ajaxUtils.get(requestUrl); } getIdentityTokenForAccountOnChain(accountAddress, chainId) { const requestUrl = new URL(`${configuration_1.apiBaseUrl}/address/${accountAddress}/chain/${chainId}`); return this.ajaxUtils .get(requestUrl) .map((result) => { return result.mintedIdentityToken; }); } getRedirectUrl(linkId) { return (0, neverthrow_1.okAsync)(new URL(`${configuration_1.appBaseUrl}/?referralLinkId=${linkId}`)); } }; HypernetID = __decorate([ (0, inversify_1.injectable)() ], HypernetID); exports.HypernetID = HypernetID; //# sourceMappingURL=HypernetID.js.map