From db5ce44e82dc1d25ba1519be0438ba46eda1d88c Mon Sep 17 00:00:00 2001 From: theborakompanioni Date: Fri, 22 Sep 2023 10:52:36 +0200 Subject: [PATCH] dev(auth): add Single- and RefreshTokenContext types --- src/libs/JmWalletApi.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/libs/JmWalletApi.ts b/src/libs/JmWalletApi.ts index 2b51bacd..86cb8d88 100644 --- a/src/libs/JmWalletApi.ts +++ b/src/libs/JmWalletApi.ts @@ -23,6 +23,21 @@ type Vout = number export type TxId = string export type UtxoId = `${TxId}:${Vout}` +// for JM versions <0.9.11 +export type SingleApiTokenContext = { + token: ApiToken +} + +// for JM versions >=0.9.11 +export type RefreshApiTokenContext = SingleApiTokenContext & { + token_type: string // "bearer" + expires_in: Seconds // 1800 + scope: string + refresh_token: ApiToken +} + +export type ApiTokenContext = SingleApiTokenContext | RefreshApiTokenContext + type WithWalletName = { walletName: WalletName }