From f63c127bf16121d502a3a01f0979c4d84004dea7 Mon Sep 17 00:00:00 2001 From: Wietse Wind Date: Thu, 16 Feb 2023 01:19:11 +0100 Subject: [PATCH] Add xumm profile for openid userinfo --- src/index.ts | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/index.ts b/src/index.ts index e8a6a35..b668d35 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,12 +4,12 @@ import { XummSdkJwt } from "xumm-sdk"; import PKCE from "xumm-js-pkce"; const log = function (...args: any[]) { - if (typeof localStorage !== 'undefined') { + if (typeof localStorage !== "undefined") { if (localStorage?.debug) { - console.log(...args) + console.log(...args); } } -} +}; // localStorage.debug = "xummpkce*"; // Debug.log = log.bind(console); @@ -31,6 +31,13 @@ interface XummPkceOptions { implicit: boolean; } +export interface XummProfile { + slug: string; + profileUrl: string; + accountSlug: string | null; + payString: string | null; +} + export interface ResolvedFlow { sdk: XummSdkJwt; jwt: string; @@ -44,6 +51,7 @@ export interface ResolvedFlow { source: string; kycApproved: boolean; proSubscription: boolean; + profile?: XummProfile; }; } @@ -264,10 +272,7 @@ export class XummPkceThread extends EventEmitter { JSON.stringify({ jwt: resp.access_token, me }) ); } catch (e) { - log( - "Could not persist JWT to local storage", - e - ); + log("Could not persist JWT to local storage", e); } } @@ -308,10 +313,7 @@ export class XummPkceThread extends EventEmitter { } }, 750); } else { - log( - "Unexpected message, skipping", - postMessage?.source - ); + log("Unexpected message, skipping", postMessage?.source); } } catch (e) { log("Error parsing message", (e as Error)?.message || e);