UNPKG

@sovrano-io/auth-sdk

Version:

Sovrano wallet auth sdk for koinos dapps

70 lines 1.75 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Signup = void 0; const utils_1 = require("./utils"); const config_1 = require("./config"); class Signup { /** * Get the URL to redirect to for signup * @param data * @returns */ static getRequestUrl(data) { const encodedData = this.encodeRequest(data); return `${(0, config_1.getConfig)().baseUrl}/signup?data=${encodedData}`; } /** * Get the URL to redirect to after signup * * @param data * @param url * @returns */ static getResponseUrl(data, url) { const encodedData = this.encodeResponse(data); return `${url}?data=${encodedData}`; } /** * Encode the signup request data * @param data * @returns */ static encodeRequest(data) { return (0, utils_1.encodeParams)(data); } /** * Decode the signup request data * @param data * @returns */ static decodeRequest(data) { return (0, utils_1.decodeParams)(data); } /** * Encode the signup response data * @param data * @returns */ static encodeResponse(data) { return (0, utils_1.encodeParams)(data); } /** * Decode the signup response data * @param data * @returns */ static decodeResponse(data) { return (0, utils_1.decodeParams)(data); } /** * Get the response data from the URL * @returns */ static getResponse(responseUrl) { const url = new URL(responseUrl); const data = url.searchParams.get('data'); return this.decodeResponse(data); } } exports.Signup = Signup; //# sourceMappingURL=Signup.js.map