This constant is used in the redirectToSignInWithAuthRequest
This logic is in a separate file with no dependencies so that it can be loaded and executed as soon as possible to fulfill the purpose of the protocol detection technique. The effectiveness of this is obviously subject to how web apps bundle/consume the blockstack.js lib.
Instance of BlockstackNetwork set to the default endpoints.
Decrypts data encrypted with encryptContent
with the
transit private key.
encrypted content.
the hex string of the ECDSA private key to use for decryption. If not provided, will use user's appPrivateKey.
decrypted content.
Deletes the specified file from the app's data store.
The path to the file to delete.
Optional options object.
Set to true if the file was originally signed in order for the corresponding signature file to also be deleted.
Resolves when the file has been removed or rejects with an error.
Encrypts the data provided with the app public key.
data to encrypt
Stringified ciphertext object
Estimates the cost of an announce transaction
the hash of the message
the number of utxos we expect will be required from the importer address
Estimates the cost of a name-import transaction
the fully-qualified name
the recipient
the zone file hash
the number of UTXOs we expect will be required from the importer address
Estimates cost of a namespace preorder transaction for a namespace
the namespace to preorder
the address to receive the namespace (this must be passed as the 'revealAddress' in the namespace-reveal transaction)
the address funding the preorder
the number of UTXOs we expect will be required from the payment address.
Estimates the cost of a namespace-ready transaction for a namespace
the namespace to ready
the number of UTXOs we expect will be required from the reveal address
Estimates cost of a namesapce reveal transaction for a namespace
the namespace to reveal
the address to receive the namespace (this must have been passed as 'revealAddress' to a prior namespace preorder)
the address that pays for this transaction
the number of UTXOs we expect will be required from the payment address
Estimates cost of a preorder transaction for a domain name.
the name to preorder
the address to receive the name (this must be passed as the 'registrationAddress' in the register transaction)
the address funding the preorder
the number of UTXOs we expect will be required from the payment address.
Estimates cost of a register transaction for a domain name.
the name to register
the address to receive the name
the address funding the register
whether or not we will broadcast a zonefile hash as part of the register
the number of UTXOs we expect will be required from the payment address.
Estimates cost of an transfer transaction for a domain name.
the name to renew
the next owner of the name
the current owner of the name
the address funding the transfer
whether or not we will broadcast a zonefile hash in the renewal operation
the number of UTXOs we expect will be required from the payment address.
Estimates cost of a revoke transaction for a domain name.
the name to revoke
the current owner of the name
the address funding the revoke
the number of UTXOs we expect will be required from the payment address.
Estimates the cost of a token-transfer transaction
the recipient of the tokens
the type of token to spend
a 64-bit unsigned BigInteger encoding the number of tokens to spend
an arbitrary string to store with the transaction
the number of utxos we expect will be required from the importer address
the number of outputs we expect to add beyond just the recipient output (default = 1, if the token owner is also the bitcoin funder)
Estimates cost of an transfer transaction for a domain name.
the name to transfer
the next owner of the name
the current owner of the name
the address funding the transfer
the number of UTXOs we expect will be required from the payment address.
Estimates cost of an update transaction for a domain name.
the name to update
the owner of the name
the address funding the update
the number of UTXOs we expect will be required from the payment address.
Extracts a profile from an encoded token and optionally verifies it,
if publicKeyOrAddress
is provided.
the token to be extracted
the public key or address of the keypair that is thought to have signed the token
Get the app storage bucket URL
the gaia hub URL
the app private key used to generate the app address
That resolves to the URL of the app index file or rejects if it fails
Retrieve the authentication token from the URL query
the authentication token if it exists otherwise null
Calculate the base64 encoded string length for a given input length. This is equivalent to the byte length when the string is ASCII or UTF8-8 encoded.
Returns a BlockstackError correlating to the given HTTP response, with the provided errorMsg. Throws if the HTTP response is 'ok'.
Retrieves the specified file from the app's data store.
the path to the file to read
that resolves to the raw data in the file or rejects with an error
the path to the file to read
that resolves to the URL or rejects with an error
Get WHOIS-like information for a name, including the address that owns it, the block at which it expires, and the zone file anchored to it (if available). This is intended for use in third-party wallets or in DApps that register names.
the name to query. Can be on-chain of off-chain.
a promise that resolves to the WHOIS-like information
Fetch the public read URL of a user file for the specified app.
the path to the file to read
The Blockstack ID of the user to look up
The app origin
that resolves to the public read URL of the file or rejects with an error
Try to process any pending sign in request by returning a Promise
that resolves
to the user data object if the sign in succeeds.
the endpoint against which to verify public keys match claimed username
the signed authentication response token
the transit private key that corresponds to the transit public key that was provided in the authentication request
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.
Determines if a gaia error response is possible to recover from by refreshing the gaiaHubConfig, and retrying the request.
Check if there is a authentication request that hasn't been handled.
Also checks for a protocol echo reply (which if detected then the page will be automatically redirected after this call).
true
if there is a pending sign in, otherwise false
Detects if the native auth-browser is installed and is successfully launched via a custom protocol URI.
The encoded authRequest to be used as a query param in the custom URI.
The callback that is invoked when the protocol handler was detected.
The callback that is invoked when the protocol handler was not detected.
List the set of files in this application's Gaia storage bucket.
a callback to invoke on each named file that
returns true
to continue the listing operation or false
to end it
that resolves to the total number of listed files. If the call is ended early by the callback, the last file is excluded. If an error occurs the entire call is rejected.
Look up a user profile by blockstack ID
The Blockstack ID of the profile to look up
that resolves to a profile object
Generates an announce transaction
the hash of the message to send. Should be an already-announced zone file hash
the private key that pays for the transaction. Should be the key that owns the name that the message recipients subscribe to
optional boolean, defaults to false, indicating whether the function should attempt to return an unsigned (or not fully signed) transaction. Useful for passing around a TX for multi-sig input signing.
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.
Note: This method should only be used if you want to roll your own authentication
flow. Typically you'd use redirectToSignIn
which takes care of this
under the hood.
hex encoded transit private key
location to redirect user to after sign in approval
location of this app's manifest file
the permissions this app is requesting
the origin of this app
the time at which this request is no longer valid
Any extra parameters you'd like to pass to the authenticator. Use this to pass options that aren't part of the Blockstack auth spec, but might be supported by special authenticators.
the authentication request
Generates a bitcoin spend to a specified address. This will fund up to amount
of satoshis from the payer's UTXOs. It will generate a change output if and only
if the amount of leftover change is greater than the additional fees associated
with the extra output. If the requested amount is not enough to fund the transaction's
associated fees, then this will reject with a InvalidAmountError
UTXOs are selected largest to smallest, and UTXOs which cannot fund the fees associated with their own input will not be included.
If you specify an amount > the total balance of the payer address, then this will generate a maximum spend transaction
the address to receive the bitcoin payment
the private key used to fund the bitcoin spend
the amount in satoshis for the payment address to spend in this transaction
optional boolean, defaults to false, indicating whether the function should attempt to return an unsigned (or not fully signed) transaction. Useful for passing around a TX for multi-sig input signing.
Generates a name import transaction for a namespace
the name to import
the address to receive the name
the hash of the zonefile to give this name
the private key that pays for the import
optional boolean, defaults to false, indicating whether the function should attempt to return an unsigned (or not fully signed) transaction. Useful for passing around a TX for multi-sig input signing.
Generates a namespace ready transaction for a namespace
the namespace to launch
the private key of the 'revealAddress' used to reveal the namespace
optional boolean, defaults to false, indicating whether the function should attempt to return an unsigned (or not fully signed) transaction. Useful for passing around a TX for multi-sig input signing.
Generates a namespace reveal transaction for a namespace
the namespace to reveal
the address to receive the namespace (this must be passed as the 'revealAddress' in the namespace-reveal transaction)
a hex string (or a TransactionSigner object) of the private key used to fund the transaction
optional boolean, defaults to false, indicating whether the function should attempt to return an unsigned (or not fully signed) transaction. Useful for passing around a TX for multi-sig input signing.
Generates a preorder transaction for a domain name.
the name to pre-order
the address to receive the name (this must be passed as the 'registrationAddress' in the register transaction)
a hex string of the private key used to fund the transaction or a transaction signer object
optional boolean, defaults to false, indicating whether the function should attempt to return an unsigned (or not fully signed) transaction. Useful for passing around a TX for multi-sig input signing.
Generates a register transaction for a domain name.
the name to register
the address to receive the name (this must have been passed as the 'destinationAddress' in the preorder transaction) this address will receive a dust UTXO
a hex string of the private key (or a TransactionSigner object) used to fund the transaction (this must be the same as the payment address used to fund the preorder)
the zonefile data to include (this will be hashed to include in the transaction), the zonefile itself must be published after the UPDATE propagates.
the hash of the zone file data to include. It will be used instead of zonefile, if given
optional boolean, defaults to false, indicating whether the function should attempt to return an unsigned (or not fully signed) transaction. Useful for passing around a TX for multi-sig input signing.
Generates a renewal transaction for a domain name.
the name to transfer
the address to receive the name after renewal this address will receive a dust UTXO
a hex string of the current owner's private key (or a TransactionSigner object)
a hex string of the private key used to fund the renewal (or a TransactionSigner object)
the zonefile data to include, if given (this will be hashed to include in the transaction), the zonefile itself must be published after the RENEWAL propagates.
the raw zone file hash to include (this will be used instead of zonefile, if given).
optional boolean, defaults to false, indicating whether the function should attempt to return an unsigned (or not fully signed) transaction. Useful for passing around a TX for multi-sig input signing.
Generates a revoke transaction for a domain name.
the name to revoke
a hex string of the current owner's private key (or a TransactionSigner object)
a hex string of the private key used to fund the transaction (or a TransactionSigner object)
optional boolean, defaults to false, indicating whether the function should attempt to return an unsigned (or not fully signed) transaction. Useful for passing around a TX for multi-sig input signing.
Generates a token-transfer transaction
the address to receive the tokens
the type of tokens to send
the BigInteger encoding of an unsigned 64-bit number of tokens to send
an arbitrary string to include with the transaction
the hex-encoded private key to send the tokens
the hex-encoded private key to fund the bitcoin fees for the transaction. Optional -- if not passed, will attempt to fund with sender key.
optional boolean, defaults to false, indicating whether the function should attempt to return an unsigned (or not fully signed) transaction. Useful for passing around a TX for multi-sig input signing.
Generates a transfer transaction for a domain name.
the name to transfer
the address to receive the name. this address will receive a dust UTXO
a hex string of the current owner's private key (or a TransactionSigner object)
a hex string of the private key used to fund the transaction (or a TransactionSigner object)
if true, then preserve the name's zone file
optional boolean, defaults to false, indicating whether the function should attempt to return an unsigned (or not fully signed) transaction. Useful for passing around a TX for multi-sig input signing.
Generates an update transaction for a domain name.
the name to update
a hex string of the owner key, or a transaction signer object. This will provide one UTXO input, and also recieve a dust output.
a hex string, or a transaction signer object, of the private key used to fund the transaction's txfees
the zonefile data to update (this will be hashed to include in the transaction), the zonefile itself must be published after the UPDATE propagates.
if given, this is the hash to store (instead of zonefile). zonefile will be ignored if this is given.
optional boolean, defaults to false, indicating whether the function should attempt to return an unsigned (or not fully signed) transaction. Useful for passing around a TX for multi-sig input signing.
Stores the data provided in the app's data store to to the file specified.
internal use only: the usersession
the path to store the data in
the data to store in the file
the putfile options
that resolves if the operation succeed and rejects if it failed
Redirects the user to the Blockstack browser to approve the sign in request given.
The user is redirected to the blockstackIDHost
if the blockstack:
protocol handler is not detected. Please note that the protocol handler detection
does not work on all browsers.
the authentication request generated by makeAuthRequest
the URL to redirect the user to if the blockstack protocol handler is not detected
Signs a profile token
the JSON of the profile to be signed
the signing private key
the entity that the information is about
the entity that is issuing the token
the signing algorithm to use
the time of issuance of the token
the time of expiration of the token
Sign the user out and optionally redirect to given location.
Location to redirect user to after sign out.
Only used in environments with window
available
Validates the social proofs in a user's profile. Currently supports validation of Facebook, Twitter, GitHub, Instagram, LinkedIn and HackerNews accounts.
The JSON of the profile to be validated
The owner bitcoin address to be validated
that resolves to an array of validated proof objects
Verifies a profile token
the token to be verified
the public key or address of the keypair that is thought to have signed the token
Wraps a token for a profile token file
the token to be wrapped
token
and decodedToken
Generated using TypeDoc
Optional function to generate cryptographically secure random bytes