Skip to content

Commit

Permalink
Mainnet release (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
tahpot authored Dec 25, 2023
1 parent 032961c commit 010115e
Show file tree
Hide file tree
Showing 94 changed files with 2,499 additions and 329 deletions.
7 changes: 7 additions & 0 deletions packages/account-node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2023-12-26 (v.2.4.0)
-------------------

- Fix: In some instances, duplicate storage nodes are selected
- Fix: Missing await on multiple `this.ensureAuthenticated()` calls
- Fix: Make `getDidClient()` async

2023-05-12 (v.2.3.5)
-------------------

Expand Down
14 changes: 7 additions & 7 deletions packages/account-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@verida/account-node",
"version": "2.3.9",
"version": "2.4.0-rc6",
"main": "dist/index.js",
"license": "ISC",
"directories": {
Expand All @@ -17,12 +17,12 @@
"node": ">=14.0.0"
},
"dependencies": {
"@verida/account": "^2.3.9",
"@verida/did-client": "^2.3.9",
"@verida/did-document": "^2.3.3",
"@verida/encryption-utils": "^2.2.3",
"@verida/keyring": "^2.3.3",
"@verida/types": "^2.3.1",
"@verida/account": "^2.4.0-rc6",
"@verida/did-client": "^2.4.0-rc6",
"@verida/did-document": "^2.4.0-rc1",
"@verida/encryption-utils": "^2.2.2",
"@verida/keyring": "^2.4.0-rc1",
"@verida/types": "^2.4.0-rc1",
"axios": "^0.27.2",
"did-resolver": "^4.0.1"
},
Expand Down
12 changes: 6 additions & 6 deletions packages/account-node/src/auto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default class AutoAccount extends Account {
}

public async storageConfig(contextName: string, forceCreate?: boolean): Promise<SecureContextConfig | undefined> {
this.ensureAuthenticated()
await this.ensureAuthenticated()

const did = await this.did()
let storageConfig = await StorageLink.getLink(this.didClient, did, contextName, true)
Expand Down Expand Up @@ -136,7 +136,7 @@ export default class AutoAccount extends Account {
* @param storageConfig
*/
public async linkStorage(storageConfig: SecureContextConfig): Promise<boolean> {
this.ensureAuthenticated()
await this.ensureAuthenticated()
const keyring = await this.keyring(storageConfig.id)
const result = await StorageLink.setLink(this.didClient, storageConfig, keyring, this.wallet.privateKey)

Expand All @@ -156,7 +156,7 @@ export default class AutoAccount extends Account {
* @param contextName
*/
public async unlinkStorage(contextName: string): Promise<boolean> {
this.ensureAuthenticated()
await this.ensureAuthenticated()
let result = await StorageLink.unlink(this.didClient, contextName)
if (!result) {
return false
Expand All @@ -178,7 +178,7 @@ export default class AutoAccount extends Account {
*
*/
public async linkStorageContextService(contextName: string, endpointType: SecureContextEndpointType, serverType: string, endpointUris: string[]): Promise<boolean> {
this.ensureAuthenticated()
await this.ensureAuthenticated()
const result = await StorageLink.setContextService(this.didClient, contextName, endpointType, serverType, endpointUris)

for (let i in result) {
Expand All @@ -191,8 +191,8 @@ export default class AutoAccount extends Account {
return true
}

public getDidClient(): DIDClient {
this.ensureAuthenticated()
public async getDidClient(): Promise<DIDClient> {
await this.ensureAuthenticated()
return this.didClient
}

Expand Down
5 changes: 4 additions & 1 deletion packages/account-node/src/nodeSelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export class NodeSelector {
const regionNodes = await this.nodesByRegion()
let possibleNodes: StorageNode[]


if (!regionNodes[region]) {
// no region nodes, find global nodes
possibleNodes = await this.loadStorageNodes()
Expand All @@ -104,7 +105,7 @@ export class NodeSelector {
if (selectedNodes.length < numNodes) {
// Not enough region nodes, try to find global nodes
const globalNodes = await this.loadStorageNodes()
const globalFoundNodes = await this.selectNodesFromList(globalNodes, selectedNodes, numNodes - selectedNodes.length)
const globalFoundNodes = await this.selectNodesFromList(globalNodes, selectedNodes.concat(ignoredNodes), numNodes - selectedNodes.length)
return selectedNodes.concat(globalFoundNodes)
}

Expand All @@ -118,6 +119,8 @@ export class NodeSelector {
while (selectedNodes.length < numNodes && possibleNodes.length > 0) {
const nodeIndex = getRandomInt(0, possibleNodes.length)
const possibleNode = possibleNodes[nodeIndex]

// check if the node is in the ignore list
if (ignoredNodeIds.indexOf(possibleNode.id) !== -1) {
possibleNodes.splice(nodeIndex, 1)
continue
Expand Down
4 changes: 2 additions & 2 deletions packages/account-node/test/nodeSelector.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ describe('Storage node selector tests', () => {
defaultTimeout: 5000
})

//nodeSelector.loadStorageNodes(TEST_NODES)
nodeSelector.loadStorageNodes(TEST_NODES)
})

it('can avoid duplicates', async function() {
// Loop 5x to find nodes in a particular country and ensure
// the same node isn't included more than once
let i = 0
while (i++ < 5) {
const nodes = await nodeSelector.selectNodesByCountry('IN', 3)
const nodes = await nodeSelector.selectNodesByCountry('AF', 3)
const nodeIds = nodes.map((item) => item.id)
const dedupeIds = nodeIds.filter((item, pos) => nodeIds.indexOf(item) == pos)
assert.equal(nodeIds.length, dedupeIds.length, 'Duplicates found')
Expand Down
5 changes: 5 additions & 0 deletions packages/account-web-vault/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2023-12-26 (v.2.4.0)
-------------------

- Fix: Don't inject modal if it is already in the DOM

2023-04-20 (v2.3.0)
-------------------

Expand Down
10 changes: 5 additions & 5 deletions packages/account-web-vault/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@verida/account-web-vault",
"version": "2.3.9",
"version": "2.4.0-rc6",
"main": "dist/index.js",
"license": "ISC",
"directories": {
Expand All @@ -15,10 +15,10 @@
"node": ">=14.0.0"
},
"dependencies": {
"@verida/account": "^2.3.9",
"@verida/encryption-utils": "^2.2.3",
"@verida/keyring": "^2.3.3",
"@verida/types": "^2.3.1",
"@verida/account": "^2.4.0-rc6",
"@verida/encryption-utils": "^2.2.2",
"@verida/keyring": "^2.4.0-rc1",
"@verida/types": "^2.4.0-rc1",
"jsonwebtoken": "^8.5.1",
"lodash": "^4.17.21",
"qrcode-with-logos": "^1.0.3",
Expand Down
4 changes: 3 additions & 1 deletion packages/account-web-vault/src/auth-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export default class AuthClient {
schemeUri: 'veridavault://login-request',
loginUri: 'https://vault.verida.io/request/',
deeplinkId: 'verida-auth-client-deeplink',
request: {}
request: {
environment: config.environment
}
}, config)
this.modal = modal

Expand Down
7 changes: 5 additions & 2 deletions packages/account-web-vault/src/vault-account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ const CONFIG_DEFAULTS: Record<EnvironmentType, AccountVaultConfig> = {
loginUri: 'https://vault.verida.io/request',
serverUri: `wss://auth.testnet.verida.io`
},
mainnet: {},
mainnet: {
loginUri: 'https://vault.verida.io/request',
serverUri: `wss://auth.testnet.verida.io`
},
testnet: {
loginUri: 'https://vault.verida.io/request',
serverUri: `wss://auth.testnet.verida.io`
Expand Down Expand Up @@ -85,7 +88,7 @@ export class VaultAccount extends Account {
this.config.request.userAgent = navigator.userAgent

if (!this.config.environment) {
this.config.environment = EnvironmentType.TESTNET
this.config.environment = EnvironmentType.MAINNET
}

this.config = _.merge(CONFIG_DEFAULTS[this.config.environment], this.config)
Expand Down
9 changes: 6 additions & 3 deletions packages/account-web-vault/src/vault-modal-login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,12 @@ export default async function (
</style>
`;

document.body.insertAdjacentHTML("beforeend", modalHTML);
let modal: HTMLElement | null = document.getElementById("verida-modal");
if (!modal) {
document.body.insertAdjacentHTML("beforeend", modalHTML);
modal = document.getElementById("verida-modal");
}

const modal: HTMLElement | null = document.getElementById("verida-modal");
const closeModal: HTMLElement | null =
document.getElementById("verida-modal-close");

Expand All @@ -335,7 +338,7 @@ export default async function (

if (modal && closeModal) {
closeModal.onclick = () => {
modal.style.display = 'none';
modal!.style.display = 'none';
authConfig.callbackRejected!();
}
}
Expand Down
5 changes: 5 additions & 0 deletions packages/account/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2023-12-26 (v.2.4.0)
-------------------

- Fix: Account disconnect should be optional, not throw an exception

2023-04-20 (v2.3.0)
-------------------

Expand Down
8 changes: 4 additions & 4 deletions packages/account/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@verida/account",
"version": "2.3.9",
"version": "2.4.0-rc6",
"main": "dist/index.js",
"license": "ISC",
"directories": {
Expand All @@ -17,9 +17,9 @@
"node": ">=14.0.0"
},
"dependencies": {
"@verida/keyring": "^2.3.3",
"@verida/storage-link": "^2.3.9",
"@verida/types": "^2.3.1",
"@verida/keyring": "^2.4.0-rc1",
"@verida/storage-link": "^2.4.0-rc6",
"@verida/types": "^2.4.0-rc1",
"did-jwt": "^6.11.0",
"did-resolver": "^4.0.1",
"lodash": "^4.17.21",
Expand Down
2 changes: 1 addition & 1 deletion packages/account/src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default class Account implements IAccount {
* For example, in a web browser context, it would remove any stored signatures from local storage.
*/
public async disconnect(contextName?: string): Promise<void> {
throw new Error("Not implemented.")
return
}

public async getAuthContext(contextName: string, contextConfig: SecureContextConfig, authConfig: AuthTypeConfig = {
Expand Down
14 changes: 14 additions & 0 deletions packages/client-ts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
2023-12-26 (v.2.4.0)
-------------------

- Fix: Close outbox database connection after sending a message
- Feature: Expose new `migrateContext()` and `migrateDatase()` utility methods
- Feature: Implement utility method `context.deleteDatabase(databaseName)`
- Fix: Close databases when they are removed from the cache
- Fix: Close databases prior to deletion
- Feature: Support `verifyEncryptionKey: boolean` property on the config options when opening a database
- Fix: Closing encrypted database could have a race condition if called more than once
- Support `verifyWebsite()` helper method on `Profile` object (uses `.well-known/did.json`)
- Feature: Support `client.destroyContext()`
- Feature: Support `client.destroyAccount()`

2023-05-12 (v.2.3.5)
-------------------

Expand Down
20 changes: 10 additions & 10 deletions packages/client-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@verida/client-ts",
"version": "2.3.9",
"version": "2.4.0-rc6.1",
"main": "dist/index.js",
"license": "ISC",
"directories": {
Expand All @@ -17,14 +17,14 @@
"node": ">=14.0.0"
},
"dependencies": {
"@verida/account": "^2.3.9",
"@verida/did-client": "^2.3.9",
"@verida/did-document": "^2.3.3",
"@verida/encryption-utils": "^2.2.3",
"@verida/keyring": "^2.3.3",
"@verida/storage-link": "^2.3.9",
"@verida/types": "^2.3.1",
"@verida/vda-name-client": "^2.3.6",
"@verida/account": "^2.4.0-rc6",
"@verida/did-client": "^2.4.0-rc6",
"@verida/did-document": "^2.4.0-rc1",
"@verida/encryption-utils": "^2.2.2",
"@verida/keyring": "^2.4.0-rc1",
"@verida/storage-link": "^2.4.0-rc6",
"@verida/types": "^2.4.0-rc1",
"@verida/vda-name-client": "^2.4.0-rc5",
"ajv": "^8.6.3",
"ajv-formats": "^2.1.1",
"axios": "^0.21.2",
Expand All @@ -44,7 +44,7 @@
"@types/mocha": "^9.1.1",
"@types/pouchdb": "^6.4.0",
"@types/uuid": "^8.3.4",
"@verida/account-node": "^2.3.9",
"@verida/account-node": "^2.4.0-rc6",
"dependency-cruiser": "^11.3.0",
"mocha": "^8.2.1",
"ts-mocha": "^8.0.0",
Expand Down
Loading

0 comments on commit 010115e

Please sign in to comment.