This repository was archived by the owner on Nov 14, 2023. It is now read-only.
Description In order to transform this library into more OOP-conform code I went through the code and wrote together some classes:
Auth
Profiles
Storage
interface GaiaHubConfig
address: string
url_prefix: string
token: string
server: string
class GaiaHub
public static getBucketUrl(gaiaHubUrl: string, appPrivateKey: string): Promise<string>
public static getFullReadUrl(filename: string, gaiaHubConfig: GaiaHubConfig): string
public static connect(gaiaHubUrl: string, challengeSignerHex: string): Promise<GaiaHubConfig>
public static setLocalConnection(): Promise<GaiaHubConfig>
public static getOrSetLocalConnection(): Promise<GaiaHubConfig>
public static upload(path: string, contents: any, gaiaHubConfig: GaiaHubConfig, contentType: string = 'application/octet-stream'): Promise<string>
public getAppBucketUrl(gaiaHubUrl: string, appPrivateKey: string): Promise<string>
public getAppFullReadUrl(path: string, username: string, appOrigin: string, zoneFileLookupURL: string = 'http://localhost:6270/v1/names/'): Promise<string>
public getFile(path: string, decrypt: boolean = true, username?: string, app?: string, zoneFileLookupURL?: string): Promise<string | ArrayBuffer>
public putFile(path: string, content: string | Buffer, encrypt: boolean = true): Promise<string>
public deleteFile(path: string): Promise<void>
Zone files
Then later getting back to the crypto and operations part of this and trying to put these things into proper classes too.
Reactions are currently unavailable
In order to transform this library into more OOP-conform code I went through the code and wrote together some classes:
Auth
AppAuthRequestAuthResponseProfiles
ProfileLoginProfilePersonOrganizationCreativeWorkProfileTokenProof?ServiceFacebookGithubHackerNewsInstagramLinkedInTwitterStorage
interface GaiaHubConfigaddress: stringurl_prefix: stringtoken: stringserver: stringclass GaiaHubpublic static getBucketUrl(gaiaHubUrl: string, appPrivateKey: string): Promise<string>public static getFullReadUrl(filename: string, gaiaHubConfig: GaiaHubConfig): stringpublic static connect(gaiaHubUrl: string, challengeSignerHex: string): Promise<GaiaHubConfig>public static setLocalConnection(): Promise<GaiaHubConfig>public static getOrSetLocalConnection(): Promise<GaiaHubConfig>public static upload(path: string, contents: any, gaiaHubConfig: GaiaHubConfig, contentType: string = 'application/octet-stream'): Promise<string>public getAppBucketUrl(gaiaHubUrl: string, appPrivateKey: string): Promise<string>public getAppFullReadUrl(path: string, username: string, appOrigin: string, zoneFileLookupURL: string = 'http://localhost:6270/v1/names/'): Promise<string>public getFile(path: string, decrypt: boolean = true, username?: string, app?: string, zoneFileLookupURL?: string): Promise<string | ArrayBuffer>public putFile(path: string, content: string | Buffer, encrypt: boolean = true): Promise<string>public deleteFile(path: string): Promise<void>Zone files
class ProfileZoneFilepublic static fromJSON(json: JsonZoneFile): ProfileZoneFilepublic static fromString(string: string): ProfileZoneFilepublic readonly name: stringpublic readonly profileTokenUrl: stringconstructor(name: string, profileTokenUrl: string)public getProfileTokenUrl(): stringpublic toJSON(): JsonZoneFilepublic toString(): stringpublic resolveToProfile(): Promise<Profile>public resolveToPerson(): Promise<Person>Then later getting back to the crypto and operations part of this and trying to put these things into proper classes too.