Skip to content

Commit

Permalink
fix: bbs+ fixes and updates
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Mar 10, 2023
1 parent fa72b2e commit ae9e903
Show file tree
Hide file tree
Showing 21 changed files with 294 additions and 27,300 deletions.
47 changes: 22 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@
"test:watch": "yarn test --watch --verbose",
"test:lint": "eslint . --ext .ts",
"prettier": "prettier --write \"{packages,__tests__,!dist}/**/*.{ts,tsx,js,json,md,yml}\"",
"build-clean": "rimraf ./packages/*/dist ./packages/*/api ./packages/*/node_modules ./packages/*/tsconfig.tsbuildinfo && jest --clearCache",
"build-clean": "rimraf --glob ./packages/*/dist ./packages/*/api ./packages/*/node_modules ./packages/*/tsconfig.tsbuildinfo && jest --clearCache",
"publish:latest": "lerna publish --conventional-commits --include-merged-tags --create-release github --yes --dist-tag latest --registry https://registry.npmjs.org",
"publish:next": "lerna publish --conventional-prerelease --force-publish --canary --no-git-tag-version --include-merged-tags --preid next --pre-dist-tag next --yes --registry https://registry.npmjs.org",
"publish:unstable": "lerna publish --conventional-prerelease --force-publish --canary --no-git-tag-version --include-merged-tags --preid unstable --pre-dist-tag unstable --yes --registry https://registry.npmjs.org",
"postinstall": "patch-package"
},
"workspaces": {
"nohoist": [
"**disabled-replace-by-package-names**"
"patch-package",
"jsonld1",
"jsonld-signatures1"
],
"packages": [
"./packages/*"
Expand Down Expand Up @@ -64,45 +66,40 @@
"@veramo/remote-server": "4.2.0",
"@veramo/selective-disclosure": "4.2.0",
"@veramo/url-handler": "4.2.0",
"jsonld": "npm:@digitalcredentials/jsonld@^5.2.1",
"jsonld-signatures": "npm:@digitalcredentials/jsonld-signatures@^9.3.1",
"**/@digitalcredentials/ed25519-verification-key-2020": "3.2.2",
"**/isomorphic-webcrypto": "link:./@sphereon/isomorphic-webcrypto"
"**/@mattrglobal/jsonld-signatures-bbs/jsonld": "4.0.1",
"**/jsonld" : "link:./node_modules/@digitalcredentials/jsonld",
"**/isomorphic-webcrypto": "link:./node_modules/@sphereon/isomorphic-webcrypto"
},
"dependencies": {
"@veramo/core": "4.2.0"
},
"devDependencies": {
"@digitalcredentials/jsonld": "^5.2.1",
"@microsoft/api-documenter": "^7.14.1",
"@microsoft/api-extractor": "^7.19.4",
"@microsoft/api-extractor-model": "^7.15.3",
"@types/jest": "^27.4.0",
"@types/node": "^18.14.2",
"@typescript-eslint/eslint-plugin": "^5.9.1",
"@typescript-eslint/parser": "^5.9.1",
"@types/jest": "^27.5.2",
"@types/debug": "^4.1.7",
"@types/node": "^16.18.14",
"@typescript-eslint/eslint-plugin": "^5.54.1",
"@typescript-eslint/parser": "^5.54.1",
"codecov": "^3.8.3",
"cross-fetch": "^3.1.5",
"eslint": "^8.7.0",
"eslint-config-prettier": "^8.3.0",
"eslint": "^8.35.0",
"eslint-config-prettier": "^8.7.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.25.4",
"jest": "^27.4.7",
"eslint-plugin-import": "^2.27.5",
"jest": "^27.5.1",
"jest-fetch-mock": "^3.0.3",
"json-schema": "^0.4.0",
"lerna": "^6.5.1",
"lerna-changelog": "^2.2.0",
"oas-resolver": "^2.5.6",
"openapi-types": "^10.0.0",
"openapi-types": "^12.1.0",
"patch-package": "^6.5.1",
"prettier": "^2.5.1",
"prettier": "^2.8.4",
"pretty-quick": "^3.1.3",
"rimraf": "^3.0.2",
"rimraf": "^4.4.0",
"semantic-release": "^19.0.5",
"ts-jest": "^27.1.3",
"ts-json-schema-generator": "1.1.2",
"ts-node": "^10.4.0",
"typescript": "4.6.4"
"ts-jest": "^27.1.5",
"ts-node": "^10.9.1",
"typescript": "4.9.5"
},
"engines": {
"node": ">= 16.0.0"
Expand Down
17 changes: 16 additions & 1 deletion packages/mnemonic-seed-manager/api-extractor.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
{
"extends": "../include/api-extractor-base.json"
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"apiReport": {
"enabled": true,
"reportFolder": "./api",
"reportTempFolder": "./api"
},

"docModel": {
"enabled": true,
"apiJsonFilePath": "./api/<unscopedPackageName>.api.json"
},

"dtsRollup": {
"enabled": false
},
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts"
}
19 changes: 0 additions & 19 deletions packages/mnemonic-seed-manager/jest.json

This file was deleted.

14 changes: 3 additions & 11 deletions packages/mnemonic-seed-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,14 @@
"@veramo/key-manager": "4.2.0",
"@veramo/kms-local": "4.2.0",
"@veramo/utils": "4.2.0",
"bip39": "^3.0.4",
"bip39": "^3.1.0",
"debug": "^4.3.4",
"typeorm": "^0.3.10"
},
"devDependencies": {
"@types/bip39": "^3.0.0",
"@types/debug": "^4.1.7",
"@types/jest": "^27.0.2",
"@types/node": "^17.0.4",
"@veramo/cli": "4.2.0",
"ed25519-hd-key": "^1.2.0",
"jest": "^27.0.2",
"prettier": "^2.4.1",
"ts-jest": "^27.0.7",
"ts-node": "^10.9.1"
"ed25519-hd-key": "^1.3.0"
},
"files": [
"dist/**/*",
Expand All @@ -56,7 +49,6 @@
"keywords": [
"SSI",
"mnemonic",
"seed",
"Veramo"
"seed"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import { IMnemonicSeedManager } from '../types/IMnemonicSeedManager'

import { MnemonicEntity } from '../entities/MnemonicEntity'

/**
* @public
*/
export class MnemonicSeedManager implements IAgentPlugin {
readonly schema = schema.IMnemonicInfoGenerator
readonly methods: IMnemonicSeedManager = {
Expand Down
14 changes: 14 additions & 0 deletions packages/mnemonic-seed-manager/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
import { MnemonicEntity } from './entities/MnemonicEntity'

/**
* @internal
*/
const schema = require('../plugin.schema.json')
export { schema }
/**
* @public
*/
export { MnemonicSeedManager } from './agent/MnemonicSeedManager'
export * from './types/IMnemonicSeedManager'

/**
* @internal
*/
export const MnemonicSeedManagerEntities = [MnemonicEntity]

/**
* @internal
*/
export { MnemonicSeedManagerMigrations } from './migrations'
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { CreateMnemonics1659567079429 } from './1-CreateMnemonics'
*
* These ensure the correct creation of tables and the proper migrations of data when tables change between versions.
*
* @public
* @internal
*/
export const MnemonicSeedManagerMigrations = [CreateMnemonics1659567079429]
84 changes: 61 additions & 23 deletions packages/mnemonic-seed-manager/src/types/IMnemonicSeedManager.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
import { IAgentContext, IDataStore, IKeyManager, IPluginMethodMap, ManagedKeyInfo } from '@veramo/core'
import { ObjectLiteral } from 'typeorm/browser/common/ObjectLiteral'

/**
* @public
*/
export interface IMnemonicSeedManager extends IPluginMethodMap {
generateMnemonic(args: IMnemonicGeneratorArgs): Promise<IMnemonicInfoResult>

verifyMnemonic(args: IMnemonicVerificationArgs): Promise<IMnemonicInfoResult>

verifyPartialMnemonic(args: IPartialMnemonicVerificationArgs): Promise<IMnemonicInfoResult>

generateSeed(args: ISeedGeneratorArgs): Promise<IMnemonicInfoResult>

saveMnemonicInfo(args: IMnemonicInfoStoreArgs): Promise<IMnemonicInfoResult>

getMnemonicInfo(args: IMnemonicInfoStoreArgs): Promise<IMnemonicInfoResult>

deleteMnemonicInfo(args: IMnemonicInfoStoreArgs): Promise<DeleteResult>

generateMasterKey(args: IMnemonicInfoStoreArgs): Promise<IMnemonicInfoKeyResult>

generateKeysFromMnemonic(args: IMnemonicInfoStoreArgs, context: IRequiredContext): Promise<ManagedKeyInfo>
}

/**
* @param { 128 | 160 | 192 | 224 | 256 } bits - Affects the number of words in the mnemonic,
* which is 12, 15, 18, 21 and 24 respectively.
* @param { string } id - Optional user defined id for the mnemonic
* @param { boolean } persist - Whether the mnemonic should be persisted into the database
* @param bits - Affects the number of words in the mnemonic, which is 12, 15, 18, 21 and 24 respectively.
* @param id - Optional user defined id for the mnemonic
* @param persist - Whether the mnemonic should be persisted into the database
* @public
*/
export interface IMnemonicGeneratorArgs {
bits: 128 | 160 | 192 | 224 | 256
Expand All @@ -26,9 +36,11 @@ export interface IMnemonicGeneratorArgs {
}

/**
* @param { string } id - Optional user defined id for the mnemonic
* @param { string } hash - Optional sha256 hash of the mnemonic
* @param { string[] } wordList - List containing all the words of the mnemonic in order.
* @param id - Optional user defined id for the mnemonic
* @param hash - Optional sha256 hash of the mnemonic
* @param wordList - List containing all the words of the mnemonic in order.
*
* @public
*/
export interface IMnemonicVerificationArgs {
id?: string
Expand All @@ -37,11 +49,12 @@ export interface IMnemonicVerificationArgs {
}

/**
* @param { string } id - Optional user defined id for the mnemonic
* @param { string } hash - Optional sha256 hash of the mnemonic
* @param { number, string][] } indexedWordList - List partially containing the words
* @param id - Optional user defined id for the mnemonic
* @param hash - Optional sha256 hash of the mnemonic
* @param indexedWordList - List partially containing the words
* with their indexes corresponding the position in which they appear in the mnemonic.
* It must be in the same order as in the mnemonic.
* @public
*/
export interface IPartialMnemonicVerificationArgs {
id?: string
Expand All @@ -50,22 +63,25 @@ export interface IPartialMnemonicVerificationArgs {
}

/**
* @param { string[] } mnemonic - Array representation of the mnemonic string
* @param mnemonic - Array representation of the mnemonic string
* @public
*/
export interface ISeedGeneratorArgs {
mnemonic: string[]
}

/**
* @param { string } id - Optional user defined id for the mnemonic
* @param { string } hash - Optional sha256 hash of the mnemonic
* @param { string[] } mnemonic - Array representation of the mnemonic string
* @param { string } masterKey - The master key generated from the seed
* @param { string } chainCode - The chain code generated with the keys
* @param { string } kms - The key management service to be used
* @param { string } path - The derivation path to be used
* @param { boolean } withZeroBytes - Whether the public key should be generated with zero bytes
* @param { 'Ed25519' | 'Secp256k1' } - The type of the key generated
* @param { boolean } persist - Whether the information should be persisted
* @param id - Optional user defined id for the mnemonic
* @param hash - Optional sha256 hash of the mnemonic
* @param mnemonic - Array representation of the mnemonic string
* @param masterKey - The master key generated from the seed
* @param chainCode - The chain code generated with the keys
* @param kms - The key management service to be used
* @param path - The derivation path to be used
* @param withZeroBytes - Whether the public key should be generated with zero bytes
* @param type - The type of the key generated
* @param persist - Whether the information should be persisted
* @public
*/
export interface IMnemonicInfoStoreArgs {
id?: string
Expand All @@ -80,23 +96,45 @@ export interface IMnemonicInfoStoreArgs {
persist?: boolean
}

/**
* @public
*/
export interface IMnemonicInfoKeyResult {
masterKey?: string
chainCode?: string
}

/**
* @public
*/
export interface DeleteResult {
raw: unknown
affected?: number | null
}

/**
* @public
*/
export interface UpdateResult extends DeleteResult {
generatedMaps: ObjectLiteral[]
generatedMaps: ObjectLiteral
}

/**
* @public
*/
export interface ObjectLiteral {
[key: string]: any
}

/**
* @public
*/
export interface IMnemonicInfoResult extends IMnemonicInfoStoreArgs {
succeeded?: boolean
seed?: string
}

/**
* @public
*/
export type IRequiredContext = IAgentContext<IKeyManager & IDataStore>

0 comments on commit ae9e903

Please sign in to comment.