Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Refactor everything into classes #15

Open
20 tasks
vsund opened this issue Apr 3, 2018 · 0 comments
Open
20 tasks

Refactor everything into classes #15

vsund opened this issue Apr 3, 2018 · 0 comments
Labels
size/big Item requires much work type/enhancement Request to improve a current feature

Comments

@vsund
Copy link
Member

vsund commented Apr 3, 2018

In order to transform this library into more OOP-conform code I went through the code and wrote together some classes:

Auth

  • App
  • AuthRequest
  • AuthResponse

Profiles

  • Profile
    • LoginProfile
      • Person
      • Organization
    • CreativeWork
  • ProfileToken
  • Proof?
  • Service
    • Facebook
    • Github
    • HackerNews
    • Instagram
    • LinkedIn
    • Twitter

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

  • class ProfileZoneFile
    • public static fromJSON(json: JsonZoneFile): ProfileZoneFile
    • public static fromString(string: string): ProfileZoneFile
    • public readonly name: string
    • public readonly profileTokenUrl: string
    • constructor(name: string, profileTokenUrl: string)
    • public getProfileTokenUrl(): string
    • public toJSON(): JsonZoneFile
    • public toString(): string
    • public 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.

@vsund vsund added type/enhancement Request to improve a current feature size/big Item requires much work labels Apr 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
size/big Item requires much work type/enhancement Request to improve a current feature
Projects
None yet
Development

No branches or pull requests

1 participant