sdk.AWF_Auth
sdk.api.auth
Authentication module
Constructors
constructor
new AWF_Auth(db
, web3
, globalChannel
, log
, settings
, gql
, lit
, ceramic
)
Parameters
Name | Type |
---|---|
db | DB |
web3 | Web3Connector |
globalChannel | EventBus |
log | Logging |
settings | Settings |
gql | Gql |
lit | default |
ceramic | default |
Defined in
Properties
currentUserKey
Readonly
currentUserKey: "@currentUserType"
Defined in
encoder
Readonly
encoder: TextEncoder
Defined in
waitForAuth
Readonly
waitForAuth: "waitForAuth"
Defined in
Methods
_connectAddress
_connectAddress(): Promise
<undefined
| null
| string
>
Returns
Promise
<undefined
| null
| string
>
Defined in
addDevKeyFromBase64Message
addDevKeyFromBase64Message(message
, name?
): Promise
<void
>
validate and add pubKey to the dev account
Parameters
Name | Type | Description |
---|---|---|
message | string | encrypted message with claims info |
name? | string | human-readable string to identify the key |
Returns
Promise
<void
>
Defined in
authenticateMutationData
authenticateMutationData(data
): Promise
<{ signedData
: { signature
: string
= 'fakeSignature' } ; token
: string
= 'fakeToken' }>
Utility method for sending mutation graphql requests
Parameters
Name | Type | Description |
---|---|---|
data | string | Record <string , unknown > | Record <string , unknown >[] | mutation data |
Returns
Promise
<{ signedData
: { signature
: string
= 'fakeSignature' } ; token
: string
= 'fakeToken' }>
Defined in
checkIfSignedUp
checkIfSignedUp(ethAddress
): Promise
<boolean
>
Verifies if an ethereum address is already registered Throws an UserNotRegistered error for addresses that are not registered
Parameters
Name | Type | Description |
---|---|---|
ethAddress | string | the eth address |
Returns
Promise
<boolean
>
Defined in
connectAddress
connectAddress(): Promise
<undefined
| null
| string
>
Returns
Promise
<undefined
| null
| string
>
Defined in
createEncryptedMessage
createEncryptedMessage(to
, message
): Promise
<JWE
>
Parameters
Name | Type | Description |
---|---|---|
to | string | DID of the recipient |
message | string | body text to be encrypted |
Returns
Promise
<JWE
>
Defined in
getConversation
getConversation(_pubKey
): Promise
<{ data
: never
[] }>
Parameters
Name | Type |
---|---|
_pubKey | string |
Returns
Promise
<{ data
: never
[] }>
Defined in
getCurrentUser
getCurrentUser(): Promise
<null
| { ethAddress?
: string
; id?
: string
}>
Returns
Promise
<null
| { ethAddress?
: string
; id?
: string
}>
Defined in
getDevKeys
getDevKeys(): Promise
<{ addedAt
: string
; name?
: string
; pubKey
: string
}[]>
Returns
Promise
<{ addedAt
: string
; name?
: string
; pubKey
: string
}[]>
Defined in
getMessages
getMessages(args?
): Promise
<{ data
: IMessage
[] }>
Returns all the inbox messages from Textile Users
Parameters
Name | Type | Description |
---|---|---|
args? | Object | InboxListOptions |
args.limit? | number | - |
Returns
Promise
<{ data
: IMessage
[] }>
Defined in
getSession
getSession(): Promise
<{ data
: undefined
| { ethAddress?
: string
; id?
: string
} }>
Returns current session objects for textile
Returns
Promise
<{ data
: undefined
| { ethAddress?
: string
; id?
: string
} }>
Defined in
getToken
getToken(): Promise
<string
>
Returns
Promise
<string
>
Defined in
hasNewNotifications
hasNewNotifications(): Promise
<{ data
: boolean
}>
Checks the Textile Users inbox and looks for specific notification message type
Returns
Promise
<{ data
: boolean
}>
Defined in
markMessageAsRead
markMessageAsRead(messageId
): Promise
<boolean
>
Parameters
Name | Type |
---|---|
messageId | string |
Returns
Promise
<boolean
>
Defined in
prepareIndexedID
prepareIndexedID(id
): Promise
<{ capability
: undefined
| Cacao
; jws
: DagJWS
= jws }>
Parameters
Name | Type |
---|---|
id | string |
Returns
Promise
<{ capability
: undefined
| Cacao
; jws
: DagJWS
= jws }>
Defined in
removeDevKey
removeDevKey(pubKey
): Promise
<void
>
Parameters
Name | Type |
---|---|
pubKey | string |
Returns
Promise
<void
>
Defined in
sendMessage
sendMessage(to
, content
): Promise
<{ data
: {} }>
Parameters
Name | Type |
---|---|
to | string |
content | unknown |
Returns
Promise
<{ data
: {} }>
Defined in
signData
signData(data
, base64Format?
): Promise
<{ signature
: string
= 'fakeSignature' }>
Parameters
Name | Type | Default value |
---|---|---|
data | string | Record <string , unknown > | Record <string , unknown >[] | undefined |
base64Format | boolean | false |
Returns
Promise
<{ signature
: string
= 'fakeSignature' }>
Defined in
signDataWithDID
signDataWithDID(data
): Promise
<DagJWS
>
Sign data with the identity key
Parameters
Name | Type |
---|---|
data | string | Record <string , unknown > |
Returns
Promise
<DagJWS
>
Defined in
signIn
signIn(args
): Promise
<{ data
: null
| { ethAddress?
: string
; id?
: string
} & { isNewUser
: boolean
} }>
Parameters
Name | Type |
---|---|
args | Object |
args.checkRegistered | boolean |
args.provider? | EthProviders |
args.resumeSignIn? | boolean |
Returns
Promise
<{ data
: null
| { ethAddress?
: string
; id?
: string
} & { isNewUser
: boolean
} }>
Defined in
signOut
signOut(): Promise
<{ data
: boolean
}>
Destroy all the session objects
Returns
Promise
<{ data
: boolean
}>
Defined in
validateDevKeyFromBase64Message
validateDevKeyFromBase64Message(message
): Promise
<void
>
Parameters
Name | Type |
---|---|
message | string |
Returns
Promise
<void
>
Defined in
validateInvite
validateInvite(inviteCode
): Promise
<boolean
>
Parameters
Name | Type |
---|---|
inviteCode | string |
Returns
Promise
<boolean
>
Defined in
verifyDIDSignature
verifyDIDSignature(args
): Promise
<undefined
| VerifyJWSResult
>
Parameters
Name | Type |
---|---|
args | string | DagJWS |
Returns
Promise
<undefined
| VerifyJWSResult
>
Defined in
serializeMessage
Static
serializeMessage(content
): undefined
| Uint8Array
Parameters
Name | Type |
---|---|
content | any |
Returns
undefined
| Uint8Array