Baseline

@baseline-protocol/baseline

The core baseline package provides unified access to internal integration middleware interfaces for systems of record.

Installation

npm install @baseline-protocol/baseline(npm package soon to be published)

Building

You can build the package locally with npm run build.

Testing

Run the local test suite with npm test.

Baseline JSON-RPC Module

An initial set of JSON-RPC methods have been defined for inclusion in the specification. These methods allow easy interaction with on-chain shield contracts (which contain merkle-tree fragments) and maintain full merkle-trees (along with metadata) in local off-chain storage.
Method
Params
Description
baseline_getCommit
address, commitIndex
Retrieve a single commit from a tree at the given shield contract address
baseline_getCommits
address, startIndex, count
Retrieve multiple commits from a tree at the given shield contract address
baseline_getRoot
address
Retrieve the root of a tree at the given shield contract address
baseline_getProof
address, commitIndex
Retrieve the membership proof for the given commit index
baseline_getTracked
Retrieve a list of the shield contract addresses being tracked and persisted
baseline_verifyAndPush
sender, address, proof, publicInputs, commit
Inserts a single commit in a tree for a given shield contract address
baseline_track
address
Initialize a merkle tree database for the given shield contract address
baseline_untrack
address
Remove event listeners for a given shield contract address
baseline_verify
address, value, siblings
Verify a proof for a given root and commit value

Ethereum clients that support baseline JSON-RPC

Interfaces

IBaselineRPC
1
getCommit(address: string, index: number): Promise<MerkleTreeNode>;
2
getCommits(address: string, startIndex: number, count: number): Promise<MerkleTreeNode[]>;
3
getRoot(address: string): Promise<string>;
4
getProof(address: string, commitIndex: number): Promise<MerkleTreeNode[]>;
5
getTracked(): Promise<string[]>;
6
verifyAndPush(sender: string, address: string, proof: number[], publicInputs: string[], commit: string): Promise<string>;
7
track(address: string): Promise<boolean>;
8
untrack(address: string): Promise<boolean>;
9
verify(address: string, root: string, commit: string, siblingPath: MerkleTreeNode[]): Promise<boolean>;;
Copied!
IRegistry
1
// workgroups
2
createWorkgroup(params: object): Promise<any>;
3
updateWorkgroup(workgroupId: string, params: object): Promise<any>;
4
fetchWorkgroups(params: object): Promise<any>;
5
fetchWorkgroupDetails(workgroupId: string): Promise<any>;
6
fetchWorkgroupOrganizations(workgroupId: string, params: object): Promise<any>;
7
createWorkgroupOrganization(workgroupId: string, params: object): Promise<any>;
8
updateWorkgroupOrganization(workgroupId: string, organizationId: string, params: object): Promise<any>;
9
fetchWorkgroupInvitations(workgroupId: string, params: object): Promise<any>;
10
fetchWorkgroupUsers(workgroupId: string, params: object): Promise<any>;
11
createWorkgroupUser(workgroupId: string, params: object): Promise<any>;
12
updateWorkgroupUser(workgroupId: string, userId: string, params: object): Promise<any>;
13
deleteWorkgroupUser(workgroupId: string, userId: string): Promise<any>;
14
15
// organizations
16
createOrganization(params: object): Promise<any>;
17
fetchOrganizations(params: object): Promise<any>;
18
fetchOrganizationDetails(organizationId: string): Promise<any>;
19
updateOrganization(organizationId: string, params: object): Promise<any>;
20
21
// organization users
22
fetchOrganizationInvitations(organizationId: string, params: object): Promise<any>;
23
fetchOrganizationUsers(organizationId: string, params: object): Promise<any>;
24
inviteOrganizationUser(organizationId: string, params: object): Promise<any>;
Copied!
IVault
1
createVault(params: object): Promise<any>;
2
fetchVaults(params: object): Promise<any>;
3
fetchVaultKeys(vaultId: string, params: object): Promise<any>;
4
createVaultKey(vaultId: string, params: object): Promise<any>;
5
deleteVaultKey(vaultId: string, keyId: string): Promise<any>;
6
encrypt(vaultId: string, keyId: string, payload: string): Promise<any>;
7
decrypt(vaultId: string, keyId: string, payload: string): Promise<any>;
8
signMessage(vaultId: string, keyId: string, msg: string): Promise<any>;
9
verifySignature(vaultId: string, keyId: string, msg: string, sig: string): Promise<any>;
10
fetchVaultSecrets(vaultId: string, params: object): Promise<any>;
11
createVaultSecret(vaultId: string, params: object): Promise<any>;
12
deleteVaultSecret(vaultId: string, secretId: string): Promise<any>;
Copied!

Supported Providers & Protocols

The following providers of the Baseline API are available:
  • Ethers.js - example provider; not yet implemented but included here for illustrative purposes
  • Provide - BRI-1 reference implementation (see examples/bri-1/base-example)
  • RPC - generic JSON-RPC provider
Last modified 4mo ago