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

Refactor everything into classes #15

@vsund

Description

@vsund

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    size/bigItem requires much worktype/enhancementRequest to improve a current feature

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions