TypeScript Types Othent exported TypeScript types.
Events
See Events .
Copy type OthentEventType = "auth" | "error"
Copy type AuthListener = (
userDetails : UserDetails | null ,
isAuthenticated : boolean ,
) => void ;
Copy type ErrorListener = (err : Error | OthentError ) => void ;
Dispatch
See dispatch()
;
Copy interface DispatchOptions {
arweave ?: Arweave ;
node ?: UrlString ;
}
Copy interface ArDriveBundledTransactionResponseData {
id : string ;
timestamp : number ;
winc : string ;
version : string ;
deadlineHeight : number ;
dataCaches : string [];
fastFinalityIndexes : string [];
public : string ;
signature : string ;
owner : string ;
}
Copy interface ArDriveBundledTransactionData
extends ArDriveBundledTransactionResponseData {
type : "BUNDLED" ;
}
Copy interface UploadedTransactionData {
type : "BASE" ;
id : string ;
signature : string ;
owner : string ;
}
DataItem
See signDataItem()
;
Copy type OthentEventType = "auth" | "error" ;
Copy interface TagData {
name : string ;
value : string ;
}
Copy interface DataItem {
data : string | Uint8Array ;
target ?: string ;
anchor ?: string ;
tags ?: TagData [];
}
See constructor()
and config
.
Copy type OthentStorageKey = `othent ${ string } ` ;
Copy type Auth0Strategy = "cross-site-cookies" | "refresh-tokens" ;
Copy type Auth0Cache = "memory" | "localstorage" | ICache ;
Copy type Auth0CacheType = "memory" | "localstorage" | "custom" ;
Copy type Auth0RedirectUri =
| UrlString
| ` ${ string } .auth0:// ${ string } /ios/ ${ string } /callback`
| ` ${ string } .auth0:// ${ string } /android/ ${ string } /callback` ;
Copy type Auth0RedirectUriWithParams = ` ${ Auth0RedirectUri } ? ${ string } ` ;
Copy type Auth0LogInMethod = "popup" | "redirect" ;
Copy type AutoConnect = "eager" | "lazy" | "off" ;
Copy interface AppInfo {
name : string ;
version : string ;
env : string ;
logo ?: UrlString ;
}
Copy interface OthentConfig { ... } // Listed in constructor()'s docs page.
Copy interface OthentOptions { ... } // Listed in constructor()'s docs page.
See getUserDetails()
.
Copy type Auth0Provider =
| `apple`
| `auth0`
| `google-oauth2`
| `<LinkedIn>`
| `<X>`
| `<Meta>`
| `<Twitch>`
| `github` ;
Copy type Auth0Sub = ` ${ Auth0Provider } |( ${ string } )` ;
Copy type Auth0ProviderLabel =
| `Apple`
| `E-Mail`
| `Google`
| `LinkedIn`
| `X`
| `Meta`
| `Twitch`
| `GitHub`
| `Unknown Provider` ;
Copy type Auth0WalletAddressLabel = ` ${ Auth0ProviderLabel } ( ${ string } )` ;
Copy type ANSDomain = ` ${ string } .ar` ;
Copy type OthentWalletAddressLabel = Auth0WalletAddressLabel | ANSDomain ;
Copy export interface UserDetails {
// Default from Auth0's User:
sub : Auth0Sub ;
name : string ;
givenName : string ;
middleName : string ;
familyName : string ;
nickname : string ;
preferredUsername : string ;
profile : string ;
picture : string ;
website : string ;
locale : string ;
updatedAt : string ;
email : string ;
emailVerified : boolean ;
// Custom from Auth0's Add User Metadata action:
owner : B64UrlString ;
walletAddress : B64UrlString ;
walletAddressLabel : OthentWalletAddressLabel ;
authSystem : "KMS" ;
authProvider : Auth0Provider ;
}
These types are only exported for backwards compatibility with @othent/kms
version 1.X.X
and to facilitate the migration to version 2 for those that might have stored this BufferObject
entity.
Copy interface BufferObject {
type : "Buffer" ;
data : number [];
}
Copy function isBufferObject (obj : any ) : obj is BufferObject {
return (
obj .type === "Buffer" &&
Array .isArray ( obj .data) &&
typeof obj[ 0 ] === "number"
);
}
Note that the DispatchResult
, AppInfo
and DateItem
types defined in arconnect
/ arconnectio/types
are not exported as Othent overrides and extends them.
Copy type PermissionType =
| "ACCESS_ADDRESS"
| "ACCESS_PUBLIC_KEY"
| "ACCESS_ALL_ADDRESSES"
| "SIGN_TRANSACTION"
| "ENCRYPT"
| "DECRYPT"
| "SIGNATURE"
| "ACCESS_ARWEAVE_CONFIG"
| "DISPATCH" ;
Copy interface GatewayConfig {
host : string ;
port : number ;
protocol : "http" | "https" ;
}
Copy interface SignMessageOptions {
hashAlgorithm ?: "SHA-256" | "SHA-384" | "SHA-512" ;
}
An enum OthentErrorID
and class OthentError
(extends Error
) are exported from error.ts
.
See Error Handling .
Copy type UrlString = `http:// ${ string } ` | `https:// ${ string } ` ;