mirror of
https://github.com/alexgo-io/stacks.js.git
synced 2026-06-13 01:38:20 +08:00
725 lines
39 KiB
HTML
Vendored
725 lines
39 KiB
HTML
Vendored
<!doctype html>
|
|
<html class="default no-js">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<title>UserSession | Stacks.js 1.4.1 Library Reference</title>
|
|
<meta name="description" content="Documentation for Stacks.js 1.4.1 Library Reference">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="stylesheet" href="../assets/css/main.css">
|
|
<script async src="../assets/js/search.js" id="search-script"></script>
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<div class="tsd-page-toolbar">
|
|
<div class="container">
|
|
<div class="table-wrap">
|
|
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
|
|
<div class="field">
|
|
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
|
|
<input id="tsd-search-field" type="text" />
|
|
</div>
|
|
<ul class="results">
|
|
<li class="state loading">Preparing search index...</li>
|
|
<li class="state failure">The search index is not available</li>
|
|
</ul>
|
|
<a href="../index.html" class="title">Stacks.js 1.4.1 Library Reference</a>
|
|
</div>
|
|
<div class="table-cell" id="tsd-widgets">
|
|
<div id="tsd-filter">
|
|
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
|
|
<div class="tsd-filter-group">
|
|
<div class="tsd-select" id="tsd-filter-visibility">
|
|
<span class="tsd-select-label">All</span>
|
|
<ul class="tsd-select-list">
|
|
<li data-value="public">Public</li>
|
|
<li data-value="protected">Public/Protected</li>
|
|
<li data-value="private" class="selected">All</li>
|
|
</ul>
|
|
</div>
|
|
<input type="checkbox" id="tsd-filter-inherited" checked />
|
|
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
|
|
<input type="checkbox" id="tsd-filter-externals" checked />
|
|
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
|
|
</div>
|
|
</div>
|
|
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="tsd-page-title">
|
|
<div class="container">
|
|
<ul class="tsd-breadcrumb">
|
|
<li>
|
|
<a href="../modules.html">Stacks.js 1.4.1 Library Reference</a>
|
|
</li>
|
|
<li>
|
|
<a href="../modules/auth.html">auth</a>
|
|
</li>
|
|
<li>
|
|
<a href="auth.usersession.html">UserSession</a>
|
|
</li>
|
|
</ul>
|
|
<h1>Class UserSession</h1>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
<div class="container container-main">
|
|
<div class="row">
|
|
<div class="col-8 col-content">
|
|
<section class="tsd-panel tsd-comment">
|
|
<div class="tsd-comment tsd-typography">
|
|
<div class="lead">
|
|
<p>Represents an instance of a signed in user for a particular app.</p>
|
|
</div>
|
|
<p>A signed in user has access to two major pieces of information
|
|
about the user, the user's private key for that app and the location
|
|
of the user's gaia storage bucket for the app.</p>
|
|
<p>A user can be signed in either directly through the interactive
|
|
sign in process or by directly providing the app private key.</p>
|
|
</div>
|
|
</section>
|
|
<section class="tsd-panel tsd-hierarchy">
|
|
<h3>Hierarchy</h3>
|
|
<ul class="tsd-hierarchy">
|
|
<li>
|
|
<span class="target">UserSession</span>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section class="tsd-panel-group tsd-index-group">
|
|
<h2>Index</h2>
|
|
<section class="tsd-panel tsd-index-panel">
|
|
<div class="tsd-index-content">
|
|
<section class="tsd-index-section ">
|
|
<h3>Constructors</h3>
|
|
<ul class="tsd-index-list">
|
|
<li class="tsd-kind-constructor tsd-parent-kind-class"><a href="auth.usersession.html#constructor" class="tsd-kind-icon">constructor</a></li>
|
|
</ul>
|
|
</section>
|
|
<section class="tsd-index-section ">
|
|
<h3>Properties</h3>
|
|
<ul class="tsd-index-list">
|
|
<li class="tsd-kind-property tsd-parent-kind-class"><a href="auth.usersession.html#appconfig" class="tsd-kind-icon">app<wbr>Config</a></li>
|
|
<li class="tsd-kind-property tsd-parent-kind-class"><a href="auth.usersession.html#store" class="tsd-kind-icon">store</a></li>
|
|
</ul>
|
|
</section>
|
|
<section class="tsd-index-section ">
|
|
<h3>Methods</h3>
|
|
<ul class="tsd-index-list">
|
|
<li class="tsd-kind-method tsd-parent-kind-class"><a href="auth.usersession.html#decryptcontent" class="tsd-kind-icon">decrypt<wbr>Content</a></li>
|
|
<li class="tsd-kind-method tsd-parent-kind-class"><a href="auth.usersession.html#encryptcontent" class="tsd-kind-icon">encrypt<wbr>Content</a></li>
|
|
<li class="tsd-kind-method tsd-parent-kind-class"><a href="auth.usersession.html#generateandstoretransitkey" class="tsd-kind-icon">generate<wbr>And<wbr>Store<wbr>Transit<wbr>Key</a></li>
|
|
<li class="tsd-kind-method tsd-parent-kind-class"><a href="auth.usersession.html#getauthresponsetoken" class="tsd-kind-icon">get<wbr>Auth<wbr>Response<wbr>Token</a></li>
|
|
<li class="tsd-kind-method tsd-parent-kind-class"><a href="auth.usersession.html#handlependingsignin" class="tsd-kind-icon">handle<wbr>Pending<wbr>Sign<wbr>In</a></li>
|
|
<li class="tsd-kind-method tsd-parent-kind-class"><a href="auth.usersession.html#issigninpending" class="tsd-kind-icon">is<wbr>Sign<wbr>InPending</a></li>
|
|
<li class="tsd-kind-method tsd-parent-kind-class"><a href="auth.usersession.html#isusersignedin" class="tsd-kind-icon">is<wbr>User<wbr>Signed<wbr>In</a></li>
|
|
<li class="tsd-kind-method tsd-parent-kind-class"><a href="auth.usersession.html#loaduserdata" class="tsd-kind-icon">load<wbr>User<wbr>Data</a></li>
|
|
<li class="tsd-kind-method tsd-parent-kind-class"><a href="auth.usersession.html#makeauthrequest" class="tsd-kind-icon">make<wbr>Auth<wbr>Request</a></li>
|
|
<li class="tsd-kind-method tsd-parent-kind-class"><a href="auth.usersession.html#signuserout" class="tsd-kind-icon">sign<wbr>User<wbr>Out</a></li>
|
|
</ul>
|
|
</section>
|
|
</div>
|
|
</section>
|
|
</section>
|
|
<section class="tsd-panel-group tsd-member-group ">
|
|
<h2>Constructors</h2>
|
|
<section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class">
|
|
<a name="constructor" class="tsd-anchor"></a>
|
|
<h3>constructor</h3>
|
|
<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class">
|
|
<li class="tsd-signature tsd-kind-icon">new <wbr>User<wbr>Session<span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>appConfig<span class="tsd-signature-symbol">?: </span><a href="auth.appconfig.html" class="tsd-signature-type" data-tsd-kind="Class">AppConfig</a><span class="tsd-signature-symbol">; </span>sessionOptions<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SessionOptions</span><span class="tsd-signature-symbol">; </span>sessionStore<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SessionDataStore</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="auth.usersession.html" class="tsd-signature-type" data-tsd-kind="Class">UserSession</a></li>
|
|
</ul>
|
|
<ul class="tsd-descriptions">
|
|
<li class="tsd-description">
|
|
<aside class="tsd-sources">
|
|
<ul>
|
|
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/auth/src/userSession.ts#L51">packages/auth/src/userSession.ts:51</a></li>
|
|
</ul>
|
|
</aside>
|
|
<div class="tsd-comment tsd-typography">
|
|
<div class="lead">
|
|
<p>Creates a UserSession object</p>
|
|
</div>
|
|
</div>
|
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
<ul class="tsd-parameters">
|
|
<li>
|
|
<h5><span class="tsd-flag ts-flagOptional">Optional</span> options: <span class="tsd-signature-symbol">{ </span>appConfig<span class="tsd-signature-symbol">?: </span><a href="auth.appconfig.html" class="tsd-signature-type" data-tsd-kind="Class">AppConfig</a><span class="tsd-signature-symbol">; </span>sessionOptions<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SessionOptions</span><span class="tsd-signature-symbol">; </span>sessionStore<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SessionDataStore</span><span class="tsd-signature-symbol"> }</span></h5>
|
|
<div class="tsd-comment tsd-typography">
|
|
</div>
|
|
<ul class="tsd-parameters">
|
|
<li class="tsd-parameter">
|
|
<h5><span class="tsd-flag ts-flagOptional">Optional</span> app<wbr>Config<span class="tsd-signature-symbol">?: </span><a href="auth.appconfig.html" class="tsd-signature-type" data-tsd-kind="Class">AppConfig</a></h5>
|
|
</li>
|
|
<li class="tsd-parameter">
|
|
<h5><span class="tsd-flag ts-flagOptional">Optional</span> session<wbr>Options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SessionOptions</span></h5>
|
|
</li>
|
|
<li class="tsd-parameter">
|
|
<h5><span class="tsd-flag ts-flagOptional">Optional</span> session<wbr>Store<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SessionDataStore</span></h5>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<h4 class="tsd-returns-title">Returns <a href="auth.usersession.html" class="tsd-signature-type" data-tsd-kind="Class">UserSession</a></h4>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
</section>
|
|
<section class="tsd-panel-group tsd-member-group ">
|
|
<h2>Properties</h2>
|
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
|
|
<a name="appconfig" class="tsd-anchor"></a>
|
|
<h3>app<wbr>Config</h3>
|
|
<div class="tsd-signature tsd-kind-icon">app<wbr>Config<span class="tsd-signature-symbol">:</span> <a href="auth.appconfig.html" class="tsd-signature-type" data-tsd-kind="Class">AppConfig</a></div>
|
|
<aside class="tsd-sources">
|
|
<ul>
|
|
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/auth/src/userSession.ts#L49">packages/auth/src/userSession.ts:49</a></li>
|
|
</ul>
|
|
</aside>
|
|
</section>
|
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
|
|
<a name="store" class="tsd-anchor"></a>
|
|
<h3>store</h3>
|
|
<div class="tsd-signature tsd-kind-icon">store<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">SessionDataStore</span></div>
|
|
<aside class="tsd-sources">
|
|
<ul>
|
|
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/auth/src/userSession.ts#L51">packages/auth/src/userSession.ts:51</a></li>
|
|
</ul>
|
|
</aside>
|
|
</section>
|
|
</section>
|
|
<section class="tsd-panel-group tsd-member-group ">
|
|
<h2>Methods</h2>
|
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
|
|
<a name="decryptcontent" class="tsd-anchor"></a>
|
|
<h3>decrypt<wbr>Content</h3>
|
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
<li class="tsd-signature tsd-kind-icon">decrypt<wbr>Content<span class="tsd-signature-symbol">(</span>content<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>privateKey<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span><span class="tsd-signature-symbol">></span></li>
|
|
</ul>
|
|
<ul class="tsd-descriptions">
|
|
<li class="tsd-description">
|
|
<aside class="tsd-sources">
|
|
<ul>
|
|
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/auth/src/userSession.ts#L395">packages/auth/src/userSession.ts:395</a></li>
|
|
</ul>
|
|
</aside>
|
|
<div class="tsd-comment tsd-typography">
|
|
<div class="lead">
|
|
<p>Decrypts data encrypted with <code>encryptContent</code> with the
|
|
transit private key.</p>
|
|
</div>
|
|
</div>
|
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
<ul class="tsd-parameters">
|
|
<li>
|
|
<h5>content: <span class="tsd-signature-type">string</span></h5>
|
|
<div class="tsd-comment tsd-typography">
|
|
<p>encrypted content.</p>
|
|
</div>
|
|
</li>
|
|
<li>
|
|
<h5><span class="tsd-flag ts-flagOptional">Optional</span> options: <span class="tsd-signature-symbol">{ </span>privateKey<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span></h5>
|
|
<ul class="tsd-parameters">
|
|
<li class="tsd-parameter">
|
|
<h5><span class="tsd-flag ts-flagOptional">Optional</span> private<wbr>Key<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span></h5>
|
|
<div class="tsd-comment tsd-typography">
|
|
<p>The hex string of the ECDSA private
|
|
key to use for decryption. If not provided, will use user's appPrivateKey.</p>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span><span class="tsd-signature-symbol">></span></h4>
|
|
<p>decrypted content.</p>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
|
|
<a name="encryptcontent" class="tsd-anchor"></a>
|
|
<h3>encrypt<wbr>Content</h3>
|
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
<li class="tsd-signature tsd-kind-icon">encrypt<wbr>Content<span class="tsd-signature-symbol">(</span>content<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span>, options<span class="tsd-signature-symbol">?: </span><a href="../interfaces/encryption.encryptcontentoptions.html" class="tsd-signature-type" data-tsd-kind="Interface">EncryptContentOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span></li>
|
|
</ul>
|
|
<ul class="tsd-descriptions">
|
|
<li class="tsd-description">
|
|
<aside class="tsd-sources">
|
|
<ul>
|
|
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/auth/src/userSession.ts#L378">packages/auth/src/userSession.ts:378</a></li>
|
|
</ul>
|
|
</aside>
|
|
<div class="tsd-comment tsd-typography">
|
|
<div class="lead">
|
|
<p>Encrypts the data provided with the app public key.</p>
|
|
</div>
|
|
</div>
|
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
<ul class="tsd-parameters">
|
|
<li>
|
|
<h5>content: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span></h5>
|
|
<div class="tsd-comment tsd-typography">
|
|
<p>the data to encrypt</p>
|
|
</div>
|
|
</li>
|
|
<li>
|
|
<h5><span class="tsd-flag ts-flagOptional">Optional</span> options: <a href="../interfaces/encryption.encryptcontentoptions.html" class="tsd-signature-type" data-tsd-kind="Interface">EncryptContentOptions</a></h5>
|
|
</li>
|
|
</ul>
|
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span></h4>
|
|
<p>Stringified ciphertext object</p>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
|
|
<a name="generateandstoretransitkey" class="tsd-anchor"></a>
|
|
<h3>generate<wbr>And<wbr>Store<wbr>Transit<wbr>Key</h3>
|
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
<li class="tsd-signature tsd-kind-icon">generate<wbr>And<wbr>Store<wbr>Transit<wbr>Key<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li>
|
|
</ul>
|
|
<ul class="tsd-descriptions">
|
|
<li class="tsd-description">
|
|
<aside class="tsd-sources">
|
|
<ul>
|
|
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/auth/src/userSession.ts#L151">packages/auth/src/userSession.ts:151</a></li>
|
|
</ul>
|
|
</aside>
|
|
<div class="tsd-comment tsd-typography">
|
|
<div class="lead">
|
|
<p>Generates a ECDSA keypair to
|
|
use as the ephemeral app transit private key
|
|
and store in the session.</p>
|
|
</div>
|
|
</div>
|
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
|
|
<p>the hex encoded private key</p>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
|
|
<a name="getauthresponsetoken" class="tsd-anchor"></a>
|
|
<h3>get<wbr>Auth<wbr>Response<wbr>Token</h3>
|
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
<li class="tsd-signature tsd-kind-icon">get<wbr>Auth<wbr>Response<wbr>Token<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li>
|
|
</ul>
|
|
<ul class="tsd-descriptions">
|
|
<li class="tsd-description">
|
|
<aside class="tsd-sources">
|
|
<ul>
|
|
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/auth/src/userSession.ts#L163">packages/auth/src/userSession.ts:163</a></li>
|
|
</ul>
|
|
</aside>
|
|
<div class="tsd-comment tsd-typography">
|
|
<div class="lead">
|
|
<p>Retrieve the authentication token from the URL query</p>
|
|
</div>
|
|
</div>
|
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
|
|
<p>the authentication token if it exists otherwise <code>null</code></p>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
|
|
<a name="handlependingsignin" class="tsd-anchor"></a>
|
|
<h3>handle<wbr>Pending<wbr>Sign<wbr>In</h3>
|
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
<li class="tsd-signature tsd-kind-icon">handle<wbr>Pending<wbr>Sign<wbr>In<span class="tsd-signature-symbol">(</span>authResponseToken<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/auth.userdata.html" class="tsd-signature-type" data-tsd-kind="Interface">UserData</a><span class="tsd-signature-symbol">></span></li>
|
|
</ul>
|
|
<ul class="tsd-descriptions">
|
|
<li class="tsd-description">
|
|
<aside class="tsd-sources">
|
|
<ul>
|
|
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/auth/src/userSession.ts#L216">packages/auth/src/userSession.ts:216</a></li>
|
|
</ul>
|
|
</aside>
|
|
<div class="tsd-comment tsd-typography">
|
|
<div class="lead">
|
|
<p>Try to process any pending sign in request by returning a <code>Promise</code> that resolves
|
|
to the user data object if the sign in succeeds.</p>
|
|
</div>
|
|
</div>
|
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
<ul class="tsd-parameters">
|
|
<li>
|
|
<h5>authResponseToken: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = ...</span></h5>
|
|
<div class="tsd-comment tsd-typography">
|
|
<p>the signed authentication response token</p>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/auth.userdata.html" class="tsd-signature-type" data-tsd-kind="Interface">UserData</a><span class="tsd-signature-symbol">></span></h4>
|
|
<p>that resolves to the user data object if successful and rejects
|
|
if handling the sign in request fails or there was no pending sign in request.</p>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
|
|
<a name="issigninpending" class="tsd-anchor"></a>
|
|
<h3>is<wbr>Sign<wbr>InPending</h3>
|
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
<li class="tsd-signature tsd-kind-icon">is<wbr>Sign<wbr>InPending<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
|
|
</ul>
|
|
<ul class="tsd-descriptions">
|
|
<li class="tsd-description">
|
|
<aside class="tsd-sources">
|
|
<ul>
|
|
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/auth/src/userSession.ts#L183">packages/auth/src/userSession.ts:183</a></li>
|
|
</ul>
|
|
</aside>
|
|
<div class="tsd-comment tsd-typography">
|
|
<div class="lead">
|
|
<p>Check if there is a authentication request that hasn't been handled.</p>
|
|
</div>
|
|
<p>Also checks for a protocol echo reply (which if detected then the page
|
|
will be automatically redirected after this call).</p>
|
|
</div>
|
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
|
|
<p><code>true</code> if there is a pending sign in, otherwise <code>false</code></p>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
|
|
<a name="isusersignedin" class="tsd-anchor"></a>
|
|
<h3>is<wbr>User<wbr>Signed<wbr>In</h3>
|
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
<li class="tsd-signature tsd-kind-icon">is<wbr>User<wbr>Signed<wbr>In<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
|
|
</ul>
|
|
<ul class="tsd-descriptions">
|
|
<li class="tsd-description">
|
|
<aside class="tsd-sources">
|
|
<ul>
|
|
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/auth/src/userSession.ts#L204">packages/auth/src/userSession.ts:204</a></li>
|
|
</ul>
|
|
</aside>
|
|
<div class="tsd-comment tsd-typography">
|
|
<div class="lead">
|
|
<p>Check if a user is currently signed in.</p>
|
|
</div>
|
|
</div>
|
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
|
|
<p><code>true</code> if the user is signed in, <code>false</code> if not.</p>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
|
|
<a name="loaduserdata" class="tsd-anchor"></a>
|
|
<h3>load<wbr>User<wbr>Data</h3>
|
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
<li class="tsd-signature tsd-kind-icon">load<wbr>User<wbr>Data<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/auth.userdata.html" class="tsd-signature-type" data-tsd-kind="Interface">UserData</a></li>
|
|
</ul>
|
|
<ul class="tsd-descriptions">
|
|
<li class="tsd-description">
|
|
<aside class="tsd-sources">
|
|
<ul>
|
|
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/auth/src/userSession.ts#L361">packages/auth/src/userSession.ts:361</a></li>
|
|
</ul>
|
|
</aside>
|
|
<div class="tsd-comment tsd-typography">
|
|
<div class="lead">
|
|
<p>Retrieves the user data object. The user's profile is stored in the key <a href="../interfaces/keychain.profile.html">Profile</a>.</p>
|
|
</div>
|
|
</div>
|
|
<h4 class="tsd-returns-title">Returns <a href="../interfaces/auth.userdata.html" class="tsd-signature-type" data-tsd-kind="Interface">UserData</a></h4>
|
|
<p>User data object.</p>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
|
|
<a name="makeauthrequest" class="tsd-anchor"></a>
|
|
<h3>make<wbr>Auth<wbr>Request</h3>
|
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
<li class="tsd-signature tsd-kind-icon">make<wbr>Auth<wbr>Request<span class="tsd-signature-symbol">(</span>transitKey<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span>, redirectURI<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span>, manifestURI<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span>, scopes<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span>, appDomain<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span>, expiresAt<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span>, extraParams<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li>
|
|
</ul>
|
|
<ul class="tsd-descriptions">
|
|
<li class="tsd-description">
|
|
<aside class="tsd-sources">
|
|
<ul>
|
|
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/auth/src/userSession.ts#L114">packages/auth/src/userSession.ts:114</a></li>
|
|
</ul>
|
|
</aside>
|
|
<div class="tsd-comment tsd-typography">
|
|
<div class="lead">
|
|
<p>Generates an authentication request that can be sent to the Blockstack
|
|
browser for the user to approve sign in. This authentication request can
|
|
then be used for sign in by passing it to the [[redirectToSignInWithAuthRequest]]
|
|
method.</p>
|
|
</div>
|
|
<p><em>Note</em>: This method should only be used if you want to use a customized authentication
|
|
flow. Typically, you'd use [[redirectToSignIn]] which is the default sign in method.</p>
|
|
</div>
|
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
<ul class="tsd-parameters">
|
|
<li>
|
|
<h5><span class="tsd-flag ts-flagOptional">Optional</span> transitKey: <span class="tsd-signature-type">string</span></h5>
|
|
<div class="tsd-comment tsd-typography">
|
|
<p>A HEX encoded transit private key.</p>
|
|
</div>
|
|
</li>
|
|
<li>
|
|
<h5><span class="tsd-flag ts-flagOptional">Optional</span> redirectURI: <span class="tsd-signature-type">string</span></h5>
|
|
<div class="tsd-comment tsd-typography">
|
|
<p>Location to redirect the user to after sign in approval.</p>
|
|
</div>
|
|
</li>
|
|
<li>
|
|
<h5><span class="tsd-flag ts-flagOptional">Optional</span> manifestURI: <span class="tsd-signature-type">string</span></h5>
|
|
<div class="tsd-comment tsd-typography">
|
|
<p>Location of this app's manifest file.</p>
|
|
</div>
|
|
</li>
|
|
<li>
|
|
<h5><span class="tsd-flag ts-flagOptional">Optional</span> scopes: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></h5>
|
|
<div class="tsd-comment tsd-typography">
|
|
<p>The permissions this app is requesting. The default is <code>store_write</code>.</p>
|
|
</div>
|
|
</li>
|
|
<li>
|
|
<h5><span class="tsd-flag ts-flagOptional">Optional</span> appDomain: <span class="tsd-signature-type">string</span></h5>
|
|
<div class="tsd-comment tsd-typography">
|
|
<p>The origin of the app.</p>
|
|
</div>
|
|
</li>
|
|
<li>
|
|
<h5>expiresAt: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = ...</span></h5>
|
|
<div class="tsd-comment tsd-typography">
|
|
<p>The time at which this request is no longer valid.</p>
|
|
</div>
|
|
</li>
|
|
<li>
|
|
<h5>extraParams: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> = {}</span></h5>
|
|
<div class="tsd-comment tsd-typography">
|
|
<p>Any extra parameters to pass to the authenticator. Use this to
|
|
pass options that aren't part of the Blockstack authentication specification,
|
|
but might be supported by special authenticators.</p>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
|
|
<p>the authentication request</p>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
|
|
<a name="signuserout" class="tsd-anchor"></a>
|
|
<h3>sign<wbr>User<wbr>Out</h3>
|
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
<li class="tsd-signature tsd-kind-icon">sign<wbr>User<wbr>Out<span class="tsd-signature-symbol">(</span>redirectURL<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
|
|
</ul>
|
|
<ul class="tsd-descriptions">
|
|
<li class="tsd-description">
|
|
<aside class="tsd-sources">
|
|
<ul>
|
|
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/auth/src/userSession.ts#L410">packages/auth/src/userSession.ts:410</a></li>
|
|
</ul>
|
|
</aside>
|
|
<div class="tsd-comment tsd-typography">
|
|
<div class="lead">
|
|
<p>Sign the user out and optionally redirect to given location.</p>
|
|
</div>
|
|
</div>
|
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
<ul class="tsd-parameters">
|
|
<li>
|
|
<h5><span class="tsd-flag ts-flagOptional">Optional</span> redirectURL: <span class="tsd-signature-type">string</span></h5>
|
|
<div class="tsd-comment tsd-typography">
|
|
<p>Location to redirect user to after sign out.
|
|
Only used in environments with <code>window</code> available</p>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
</section>
|
|
</div>
|
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
<nav class="tsd-navigation primary">
|
|
<ul>
|
|
<li class=" ">
|
|
<a href="../modules.html">Modules</a>
|
|
</li>
|
|
<li class="current tsd-kind-module">
|
|
<a href="../modules/auth.html">auth</a>
|
|
</li>
|
|
<li class=" tsd-kind-module">
|
|
<a href="../modules/bns.html">bns</a>
|
|
</li>
|
|
<li class=" tsd-kind-module">
|
|
<a href="../modules/cli.html">cli</a>
|
|
</li>
|
|
<li class=" tsd-kind-module">
|
|
<a href="../modules/common.html">common</a>
|
|
</li>
|
|
<li class=" tsd-kind-module">
|
|
<a href="../modules/encryption.html">encryption</a>
|
|
</li>
|
|
<li class=" tsd-kind-module">
|
|
<a href="../modules/keychain.html">keychain</a>
|
|
</li>
|
|
<li class=" tsd-kind-module">
|
|
<a href="../modules/network.html">network</a>
|
|
</li>
|
|
<li class=" tsd-kind-module">
|
|
<a href="../modules/profile.html">profile</a>
|
|
</li>
|
|
<li class=" tsd-kind-module">
|
|
<a href="../modules/stacking.html">stacking</a>
|
|
</li>
|
|
<li class=" tsd-kind-module">
|
|
<a href="../modules/storage.html">storage</a>
|
|
</li>
|
|
<li class=" tsd-kind-module">
|
|
<a href="../modules/transactions.html">transactions</a>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
<nav class="tsd-navigation secondary menu-sticky">
|
|
<ul class="before-current">
|
|
</ul>
|
|
<ul class="current">
|
|
<li class="current tsd-kind-module">
|
|
<a href="../modules/auth.html" class="tsd-kind-icon">auth</a>
|
|
<ul>
|
|
<li class=" tsd-kind-enum tsd-parent-kind-module">
|
|
<a href="../enums/auth.authscope.html" class="tsd-kind-icon">Auth<wbr>Scope</a>
|
|
</li>
|
|
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
<a href="auth.appconfig.html" class="tsd-kind-icon">App<wbr>Config</a>
|
|
</li>
|
|
<li class="current tsd-kind-class tsd-parent-kind-module">
|
|
<a href="auth.usersession.html" class="tsd-kind-icon">User<wbr>Session</a>
|
|
<ul>
|
|
<li class=" tsd-kind-constructor tsd-parent-kind-class">
|
|
<a href="auth.usersession.html#constructor" class="tsd-kind-icon">constructor</a>
|
|
</li>
|
|
<li class=" tsd-kind-property tsd-parent-kind-class">
|
|
<a href="auth.usersession.html#appconfig" class="tsd-kind-icon">app<wbr>Config</a>
|
|
</li>
|
|
<li class=" tsd-kind-property tsd-parent-kind-class">
|
|
<a href="auth.usersession.html#store" class="tsd-kind-icon">store</a>
|
|
</li>
|
|
<li class=" tsd-kind-method tsd-parent-kind-class">
|
|
<a href="auth.usersession.html#decryptcontent" class="tsd-kind-icon">decrypt<wbr>Content</a>
|
|
</li>
|
|
<li class=" tsd-kind-method tsd-parent-kind-class">
|
|
<a href="auth.usersession.html#encryptcontent" class="tsd-kind-icon">encrypt<wbr>Content</a>
|
|
</li>
|
|
<li class=" tsd-kind-method tsd-parent-kind-class">
|
|
<a href="auth.usersession.html#generateandstoretransitkey" class="tsd-kind-icon">generate<wbr>And<wbr>Store<wbr>Transit<wbr>Key</a>
|
|
</li>
|
|
<li class=" tsd-kind-method tsd-parent-kind-class">
|
|
<a href="auth.usersession.html#getauthresponsetoken" class="tsd-kind-icon">get<wbr>Auth<wbr>Response<wbr>Token</a>
|
|
</li>
|
|
<li class=" tsd-kind-method tsd-parent-kind-class">
|
|
<a href="auth.usersession.html#handlependingsignin" class="tsd-kind-icon">handle<wbr>Pending<wbr>Sign<wbr>In</a>
|
|
</li>
|
|
<li class=" tsd-kind-method tsd-parent-kind-class">
|
|
<a href="auth.usersession.html#issigninpending" class="tsd-kind-icon">is<wbr>Sign<wbr>InPending</a>
|
|
</li>
|
|
<li class=" tsd-kind-method tsd-parent-kind-class">
|
|
<a href="auth.usersession.html#isusersignedin" class="tsd-kind-icon">is<wbr>User<wbr>Signed<wbr>In</a>
|
|
</li>
|
|
<li class=" tsd-kind-method tsd-parent-kind-class">
|
|
<a href="auth.usersession.html#loaduserdata" class="tsd-kind-icon">load<wbr>User<wbr>Data</a>
|
|
</li>
|
|
<li class=" tsd-kind-method tsd-parent-kind-class">
|
|
<a href="auth.usersession.html#makeauthrequest" class="tsd-kind-icon">make<wbr>Auth<wbr>Request</a>
|
|
</li>
|
|
<li class=" tsd-kind-method tsd-parent-kind-class">
|
|
<a href="auth.usersession.html#signuserout" class="tsd-kind-icon">sign<wbr>User<wbr>Out</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class=" tsd-kind-interface tsd-parent-kind-module">
|
|
<a href="../interfaces/auth.profilelookupoptions.html" class="tsd-kind-icon">Profile<wbr>Lookup<wbr>Options</a>
|
|
</li>
|
|
<li class=" tsd-kind-interface tsd-parent-kind-module">
|
|
<a href="../interfaces/auth.userdata.html" class="tsd-kind-icon">User<wbr>Data</a>
|
|
</li>
|
|
<li class=" tsd-kind-variable tsd-parent-kind-module">
|
|
<a href="../modules/auth.html#default_blockstack_host" class="tsd-kind-icon">DEFAULT_<wbr>BLOCKSTACK_<wbr>HOST</a>
|
|
</li>
|
|
<li class=" tsd-kind-variable tsd-parent-kind-module">
|
|
<a href="../modules/auth.html#default_profile" class="tsd-kind-icon">DEFAULT_<wbr>PROFILE</a>
|
|
</li>
|
|
<li class=" tsd-kind-function tsd-parent-kind-module">
|
|
<a href="../modules/auth.html#lookupprofile" class="tsd-kind-icon">lookup<wbr>Profile</a>
|
|
</li>
|
|
<li class=" tsd-kind-function tsd-parent-kind-module">
|
|
<a href="../modules/auth.html#makeauthrequest" class="tsd-kind-icon">make<wbr>Auth<wbr>Request</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul class="after-current">
|
|
<li class=" tsd-kind-module">
|
|
<a href="../modules/bns.html" class="tsd-kind-icon">bns</a>
|
|
</li>
|
|
<li class=" tsd-kind-module">
|
|
<a href="../modules/cli.html" class="tsd-kind-icon">cli</a>
|
|
</li>
|
|
<li class=" tsd-kind-module">
|
|
<a href="../modules/common.html" class="tsd-kind-icon">common</a>
|
|
</li>
|
|
<li class=" tsd-kind-module">
|
|
<a href="../modules/encryption.html" class="tsd-kind-icon">encryption</a>
|
|
</li>
|
|
<li class=" tsd-kind-module">
|
|
<a href="../modules/keychain.html" class="tsd-kind-icon">keychain</a>
|
|
</li>
|
|
<li class=" tsd-kind-module">
|
|
<a href="../modules/network.html" class="tsd-kind-icon">network</a>
|
|
</li>
|
|
<li class=" tsd-kind-module">
|
|
<a href="../modules/profile.html" class="tsd-kind-icon">profile</a>
|
|
</li>
|
|
<li class=" tsd-kind-module">
|
|
<a href="../modules/stacking.html" class="tsd-kind-icon">stacking</a>
|
|
</li>
|
|
<li class=" tsd-kind-module">
|
|
<a href="../modules/storage.html" class="tsd-kind-icon">storage</a>
|
|
</li>
|
|
<li class=" tsd-kind-module">
|
|
<a href="../modules/transactions.html" class="tsd-kind-icon">transactions</a>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<footer class="with-border-bottom">
|
|
<div class="container">
|
|
<h2>Legend</h2>
|
|
<div class="tsd-legend-group">
|
|
<ul class="tsd-legend">
|
|
<li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
|
|
<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
|
|
<li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
|
|
<li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
|
|
<li class="tsd-kind-type-alias tsd-has-type-parameter"><span class="tsd-kind-icon">Type alias with type parameter</span></li>
|
|
</ul>
|
|
<ul class="tsd-legend">
|
|
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
|
|
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
|
|
<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
|
|
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
|
|
</ul>
|
|
<ul class="tsd-legend">
|
|
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
|
|
<li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
|
|
</ul>
|
|
<ul class="tsd-legend">
|
|
<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
<div class="container tsd-generator">
|
|
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
|
|
</div>
|
|
<div class="overlay"></div>
|
|
<script src="../assets/js/main.js"></script>
|
|
</body>
|
|
</html> |