diff --git a/README.md b/README.md index 31291bc..9b43e43 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,9 @@ New users require registration. This can be done with a claim payload like this const vcClaim = { "@context": "https://schema.org", "@type": "RegisterAction", - agent: { did: identity0.did }, + agent: { identifier: identity0.did }, object: SERVICE_ID, - participant: { did: newIdentity.did }, + participant: { identifier: newIdentity.did }, }; ``` @@ -62,6 +62,14 @@ See [this page](openssl_signing_console.rst) See [Configuration Reference](https://cli.vuejs.org/config/). +## Dependencies + +See https://tea.xyz + +| Project | Version | +| ---------- | --------- | +| nodejs.org | ^16.0.0 | +| npmjs.com | ^8.0.0 | ## Other diff --git a/src/db/index.ts b/src/db/index.ts index be9d9f4..26dcee0 100644 --- a/src/db/index.ts +++ b/src/db/index.ts @@ -1,6 +1,6 @@ -import BaseDexie from "dexie"; +import BaseDexie, { Table } from "dexie"; import { encrypted, Encryption } from "@pvermeer/dexie-encrypted-addon"; -import { accountsSchema, AccountsTable } from "./tables/accounts"; +import { Account, accountsSchema } from "./tables/accounts"; /** * In order to make the next line be acceptable, the program needs to have its linter suppress a rule: @@ -10,9 +10,11 @@ import { accountsSchema, AccountsTable } from "./tables/accounts"; * * https://9to5answer.com/how-to-bypass-warning-unexpected-any-specify-a-different-type-typescript-eslint-no-explicit-any */ -type DexieTables = AccountsTable; +type DexieTables = { + accounts: Table; +}; export type Dexie = BaseDexie & T; -export const db = new BaseDexie("kickStarter") as Dexie; +export const db = new BaseDexie("KickStart") as Dexie; const schema = Object.assign({}, accountsSchema); /** diff --git a/src/db/tables/accounts.ts b/src/db/tables/accounts.ts index 8ed1bd2..d4a4e61 100644 --- a/src/db/tables/accounts.ts +++ b/src/db/tables/accounts.ts @@ -1,18 +1,15 @@ -import { Table } from "dexie"; - export type Account = { - id?: number; - publicKey: string; - mnemonic: string; + id?: number; // auto-generated by Dexie + dateCreated: Date; + derivationPath: string; identity: string; - dateCreated: number; -}; - -export type AccountsTable = { - accounts: Table; + publicKeyHex: string; + mnemonic: string; }; // mark encrypted field by starting with a $ character +// see https://github.com/PVermeer/dexie-addon-suite-monorepo/tree/master/packages/dexie-encrypted-addon export const accountsSchema = { - accounts: "++id, publicKey, $mnemonic, $identity, dateCreated", + accounts: + "++id, dateCreated, derivationPath, $identity, $mnemonic, publicKeyHex", }; diff --git a/src/libs/crypto/index.ts b/src/libs/crypto/index.ts index a760295..bec075e 100644 --- a/src/libs/crypto/index.ts +++ b/src/libs/crypto/index.ts @@ -65,7 +65,7 @@ export const deriveAddress = ( * * @return {*} {string} */ -export const createIdentifier = (): string => { +export const generateSeed = (): string => { const entropy: Uint8Array = getRandomBytesSync(32); const mnemonic = entropyToMnemonic(entropy, wordlist); @@ -87,9 +87,9 @@ export const accessToken = async (identifier: IIdentifier) => { const nowEpoch = Math.floor(Date.now() / 1000); const endEpoch = nowEpoch + 60; // add one minute - const uportTokenPayload = { exp: endEpoch, iat: nowEpoch, iss: did }; + const tokenPayload = { exp: endEpoch, iat: nowEpoch, iss: did }; const alg = undefined; // defaults to 'ES256K', more standardized but harder to verify vs ES256K-R - const jwt: string = await didJwt.createJWT(uportTokenPayload, { + const jwt: string = await didJwt.createJWT(tokenPayload, { alg, issuer: did, signer, diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index 0bc56fa..098f35b 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -111,8 +111,8 @@
Derivation Path
{{ UPORT_ROOT_DERIVATION_PATH }} - @@ -174,10 +174,9 @@