Class: TrustPool
Defined in: db/session.ts:491
Each commit in the graph is signed with the private key of the session that generated it. The trust pool manages all known sessions and their public keys which are later used to verify that the commits in the graph make only modifications that are valid. Each commit's signature is checked against its session's public key, and then the modifications themselves are checked to ensure the creator only made changes within their scope of permissions.
Constructors
Constructor
new TrustPool(
orgId,currentSession,roots?,trustedSessions?,changeCallback?):TrustPool
Defined in: db/session.ts:497
Parameters
| Parameter | Type |
|---|---|
orgId | string |
currentSession | OwnedSession |
roots? | Session[] |
trustedSessions? | Session[] |
changeCallback? | () => void |
Returns
TrustPool
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
orgId | readonly | string | db/session.ts:498 |
roots | readonly | Session[] | db/session.ts:492 |
Accessors
currentSession
Get Signature
get currentSession():
OwnedSession
Defined in: db/session.ts:514
Returns
OwnedSession
trustedSessions
Get Signature
get trustedSessions():
Session[]
Defined in: db/session.ts:518
Returns
Session[]
Methods
addSession()
addSession(
s,commit):Promise<boolean>
Defined in: db/session.ts:571
When a commit containing a session is discovered, use this method to add it to the trust pool. This method does the necessary checks to ensure the integrity of this commit, then if all checks pass it adds the session to the trust pool.
Parameters
| Parameter | Type | Description |
|---|---|---|
s | Session | - |
commit | Commit | - |
Returns
Promise<boolean>
addSessionUnsafe()
addSessionUnsafe(
s):boolean
Defined in: db/session.ts:586
Adds the given session to the trust pool, without verifying its origin commit. Be very careful to only use this method for verified sessions.
Parameters
| Parameter | Type | Description |
|---|---|---|
s | Session | The session to add to this trust pool. |
Returns
boolean
Whether the session has been added or not.
getSession()
getSession(
id):Session
Defined in: db/session.ts:631
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
Session
sessions()
sessions():
Generator<Session>
Defined in: db/session.ts:522
Returns
Generator<Session>
verify()
verify(
commit):Promise<boolean>
Defined in: db/session.ts:637
Parameters
| Parameter | Type |
|---|---|
commit | Commit |
Returns
Promise<boolean>