Auth is just the Client class, accessToken is a method of Client

This commit is contained in:
array-in-a-matrix 2023-12-14 18:48:14 -05:00
parent b129fb0c60
commit b66bc60f9c
3 changed files with 8 additions and 10 deletions

View file

@ -1,11 +1,11 @@
# Things here have been tested to work
import nimbotsdk/matrixTypes
export ICryptoStorageProvider, Storage, CryptoStore, Auth, Client, Content,
export ICryptoStorageProvider, Storage, CryptoStore, Client, Content,
Unsigned, Event, Filter, Appservice
import nimbotsdk/MatrixAuth
export newMatrixAuth, passwordLogin, accessToken
export newMatrixAuth, passwordLogin
import nimbotsdk/MatrixClient
export newMatrixClient

View file

@ -2,12 +2,10 @@
import matrixTypes
proc newMatrixAuth*(homeserver: cstring): Auth {.importjs: "new MatrixAuth(#)".}
proc newMatrixAuth*(homeserver: cstring): Client {.importjs: "new MatrixAuth(#)".}
proc passwordLogin*(auth: Auth, username, password: cstring): Client {.importjs: "await #.passwordLogin(#, #)".}
proc passwordLogin*(auth: Auth, username, password, deviceName: cstring): Client {.importjs: "await #.passwordLogin(#, #, #)".}
proc passwordLogin*(auth: Client, username, password: cstring): Client {.importjs: "await #.passwordLogin(#, #)".}
proc passwordLogin*(auth: Client, username, password, deviceName: cstring): Client {.importjs: "await #.passwordLogin(#, #, #)".}
proc passwordRegister*(localpart, password: cstring): Client {.importjs: "await #.passwordRegister(#, #)".}
proc passwordRegister*(localpart, password, deviceName: cstring): Client {.importjs: "await #.passwordRegister(#, #, #)".}
proc accessToken*(client: Client): cstring {.importjs: "#.accessToken".}

View file

@ -4,13 +4,13 @@ type Storage* = ref object
type CryptoStore* = ref object
type Auth* = ref object
homeserverUrl: cstring
type Client* = ref object
homeserverUrl*: cstring
accessToken*: cstring
cryptoStore*: ICryptoStorageProvider
storage*: Storage
syncingTimeout*: int
userId*: cstring
type Content* = ref object
body*, msgtype*: cstring