Skip to content

Commit

Permalink
Clean up project public key in MapeoProject
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanHahn committed Oct 9, 2024
1 parent 6d0a947 commit 7cc3a1f
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/mapeo-project.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ const EMPTY_PROJECT_SETTINGS = Object.freeze({})
* @extends {TypedEmitter<{ close: () => void }>}
*/
export class MapeoProject extends TypedEmitter {
#projectId
#projectPublicId
#projectKey
#deviceId
#identityKeypair
#coreManager
Expand Down Expand Up @@ -129,7 +128,7 @@ export class MapeoProject extends TypedEmitter {

this.#l = Logger.create('project', logger)
this.#deviceId = getDeviceId(keyManager)
this.#projectId = projectKeyToId(projectKey)
this.#projectKey = projectKey
this.#loadingConfig = false

const getReplicationStream = this[kProjectReplicate].bind(
Expand Down Expand Up @@ -318,10 +317,6 @@ export class MapeoProject extends TypedEmitter {
},
})

const projectPublicId = projectKeyToPublicId(projectKey)
// TODO: clean this up
this.#projectPublicId = projectPublicId

this.#blobStore = new BlobStore({
coreManager: this.#coreManager,
})
Expand All @@ -333,7 +328,7 @@ export class MapeoProject extends TypedEmitter {
if (!base.endsWith('/')) {
base += '/'
}
return base + projectPublicId
return base + this.#projectPublicId
},
})

Expand All @@ -345,7 +340,7 @@ export class MapeoProject extends TypedEmitter {
if (!base.endsWith('/')) {
base += '/'
}
return base + projectPublicId
return base + this.#projectPublicId
},
})

Expand Down Expand Up @@ -446,6 +441,14 @@ export class MapeoProject extends TypedEmitter {
return this.#deviceId
}

get #projectId() {
return projectKeyToId(this.#projectKey)
}

get #projectPublicId() {
return projectKeyToPublicId(this.#projectKey)
}

/**
* Resolves when hypercores have all loaded
*
Expand Down

0 comments on commit 7cc3a1f

Please sign in to comment.