Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/crypto-utils-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Crypto Utils tests

on: [pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v4
with:
node-version: "22.x"
- run: yarn install --frozen-lockfile --ignore-scripts
- run: npm install -g turbo@2.0.5
- run: turbo telemetry disable
- run: turbo run build test --filter @docknetwork/crypto-utils
9 changes: 9 additions & 0 deletions examples/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @docknetwork/sdk-examples

## 0.22.7

### Patch Changes

- Updated dependencies
- @docknetwork/credential-sdk@0.56.0
- @docknetwork/cheqd-blockchain-api@6.0.0
- @docknetwork/cheqd-blockchain-modules@6.0.0

## 0.22.6

### Minor Changes
Expand Down
8 changes: 4 additions & 4 deletions examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@docknetwork/sdk-examples",
"private": true,
"type": "module",
"version": "0.22.6",
"version": "0.22.7",
"scripts": {
"bbs-dock-example": "babel-node ./src/bbs-dock.js",
"claim-deduction-example": "babel-node ./src/claim-deduction.js",
Expand All @@ -18,9 +18,9 @@
"lint": "eslint \"src/**/*.js\""
},
"dependencies": {
"@docknetwork/credential-sdk": "0.55.0",
"@docknetwork/cheqd-blockchain-api": "5.1.0",
"@docknetwork/cheqd-blockchain-modules": "5.0.0"
"@docknetwork/credential-sdk": "0.56.0",
"@docknetwork/cheqd-blockchain-api": "6.0.0",
"@docknetwork/cheqd-blockchain-modules": "6.0.0"
},
"devDependencies": {
"babel-eslint": "^10.1.0",
Expand Down
8 changes: 7 additions & 1 deletion packages/cheqd-blockchain-api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# @docknetwork/cheqd-blockchain-api

## 6.0.0

### Patch Changes

- Updated dependencies
- @docknetwork/credential-sdk@0.56.0

## 5.1.0

### Minor Changes

- Upgrade Cheqd SDK


## 5.0.0

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions packages/cheqd-blockchain-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@docknetwork/cheqd-blockchain-api",
"version": "5.1.0",
"version": "6.0.0",
"license": "MIT",
"main": "./dist/esm/index.js",
"type": "module",
Expand Down Expand Up @@ -32,7 +32,7 @@
"node": ">=22.0.0"
},
"peerDependencies": {
"@docknetwork/credential-sdk": "^0.55.0"
"@docknetwork/credential-sdk": "^0.56.0"
},
"dependencies": {
"@cheqd/sdk": "5.5.1",
Expand All @@ -46,7 +46,7 @@
"@babel/plugin-transform-modules-commonjs": "^7.24.1",
"@babel/preset-env": "^7.24.3",
"@comunica/types": "^1.0.0",
"@docknetwork/credential-sdk": "^0.55.0",
"@docknetwork/credential-sdk": "^0.56.0",
"@helia/strings": "^3.0.1",
"@rollup/plugin-alias": "^4.0.2",
"@rollup/plugin-commonjs": "^24.0.0",
Expand Down
7 changes: 7 additions & 0 deletions packages/cheqd-blockchain-modules/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @docknetwork/cheqd-blockchain-modules

## 6.0.0

### Patch Changes

- Updated dependencies
- @docknetwork/credential-sdk@0.56.0

## 5.0.0

### Patch Changes
Expand Down
8 changes: 4 additions & 4 deletions packages/cheqd-blockchain-modules/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@docknetwork/cheqd-blockchain-modules",
"version": "5.0.0",
"version": "6.0.0",
"type": "module",
"license": "MIT",
"main": "./dist/esm/index.js",
Expand Down Expand Up @@ -32,7 +32,7 @@
"node": ">=22.0.0"
},
"peerDependencies": {
"@docknetwork/credential-sdk": "^0.55.0"
"@docknetwork/credential-sdk": "^0.56.0"
},
"devDependencies": {
"@babel/cli": "^7.24.1",
Expand All @@ -41,8 +41,8 @@
"@babel/plugin-syntax-import-attributes": "^7.25.6",
"@babel/plugin-transform-modules-commonjs": "^7.24.1",
"@babel/preset-env": "^7.24.3",
"@docknetwork/cheqd-blockchain-api": "5.1.0",
"@docknetwork/credential-sdk": "^0.55.0",
"@docknetwork/cheqd-blockchain-api": "6.0.0",
"@docknetwork/credential-sdk": "^0.56.0",
"@rollup/plugin-alias": "^4.0.2",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^24.0.0",
Expand Down
11 changes: 11 additions & 0 deletions packages/credential-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# @docknetwork/credential-sdk

## 0.56.0

### Minor Changes

- Create crypto-utils package

### Patch Changes

- Updated dependencies
- @docknetwork/crypto-utils@0.2.0

## 0.55.0

### Minor Changes
Expand Down
5 changes: 4 additions & 1 deletion packages/credential-sdk/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
export default {
bail: true,
moduleNameMapper: {},
moduleNameMapper: {
"^@docknetwork/crypto-utils$": "<rootDir>/../crypto-utils/src/index.js",
"^@docknetwork/crypto-utils/(.*)$": "<rootDir>/../crypto-utils/src/$1",
},
clearMocks: true,
testTimeout: 30000,
testEnvironment: "./tests/test-environment",
Expand Down
11 changes: 8 additions & 3 deletions packages/credential-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@docknetwork/credential-sdk",
"version": "0.55.0",
"version": "0.56.0",
"license": "MIT",
"type": "module",
"files": [
Expand All @@ -17,6 +17,11 @@
"require": "./dist/cjs/*/index.cjs",
"default": "./dist/esm/*/index.js"
},
"./src/vc/helpers": {
"import": "./dist/esm/vc/helpers.js",
"require": "./dist/cjs/vc/helpers.cjs",
"default": "./dist/esm/vc/helpers.js"
},
"./src/*": {
"import": "./dist/esm/*",
"require": "./dist/cjs/*",
Expand All @@ -38,18 +43,18 @@
"dependencies": {
"@astronautlabs/jsonpath": "^1.1.2",
"@digitalcredentials/vc-status-list": "^9.0.0",
"@docknetwork/crypto-utils": "0.2.0",
"@docknetwork/crypto-wasm-ts": "^0.63.0",
"@docknetwork/vc-delegation-engine": "1.0.4",
"@juanelas/base64": "^1.1.5",
"@sphereon/pex": "^5.0.0-unstable.28",
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "^0.26.0",
"@stablelib/ed25519": "^1.0.0",
"@transmute/json-web-signature": "^0.7.0-unstable.82",
"base64url": "^3.0.1",
"blake2b": "2.1.4",
"blakejs": "^1.2.1",
"bs58": "^5.0.0",
"deep-equal": "^2.2.3",
"elliptic": "6.6.1",
"js-sha256": "^0.11.0",
"json-canonicalize": "1.0.4",
"json-stringify-deterministic": "^1.0.12",
Expand Down
124 changes: 1 addition & 123 deletions packages/credential-sdk/src/keypairs/dock-keypair.js
Original file line number Diff line number Diff line change
@@ -1,123 +1 @@
import {
withExtendedPrototypeProperties,
withExtendedStaticProperties,
} from '../utils';
import { randomAsHex } from '../utils/types/bytes';

/**
* Abstract keypair used to sign byte sequences of arbitrary size.
*/
class DockKeypair {
/**
* Instantiates new `DockKeypair` with the provided underlying keypair.
*
* @param {*} keyPair
*/
constructor(keyPair) {
this.keyPair = keyPair;
}

/**
* Generates `DockKeypair` from the supplied entropy.
* @param {Uint8Array} entropy
* @returns {DockKeypair}
*/
static fromEntropy(entropy) {
// eslint-disable-next-line no-underscore-dangle
return new this(entropy, 'entropy');
}

/**
* Generates `DockKeypair` from the supplied seed.
* @param {Uint8Array} seed
* @returns {DockKeypair}
*/
static fromSeed(seed) {
// eslint-disable-next-line no-underscore-dangle
return new this(seed, 'seed');
}

/**
* Generates `DockKeypair` from the supplied private key.
* @param {Uint8Array} privateKey
* @returns {DockKeypair}
*/
static fromPrivateKey(privateKey) {
// eslint-disable-next-line no-underscore-dangle
return new this(privateKey, 'private');
}

/**
* Generates random `DockKeypair`.
* @returns {DockKeypair}
*/
static random() {
return new this(randomAsHex(this.SeedSize));
}

/**
* Returns underlying verification key type.
*/
get verKeyType() {
return this.constructor.VerKeyType;
}

/**
* Returns underlying public key.
*/
publicKey() {
// eslint-disable-next-line no-underscore-dangle
return new this.constructor.Signature.PublicKey(this._publicKey());
}

/**
* Returns underlying private key.
*/
privateKey() {
throw new Error('Unimplemented');
}

/**
* Signs supplied message using underlying keypair.
* @param {*} message
*/
sign(message) {
// eslint-disable-next-line no-underscore-dangle
return new this.constructor.Signature(this._sign(message));
}

/**
* Returns raw bytes of the underlying public key.
* @returns {Uint8Array}
*/
_publicKey() {
throw new Error('Unimplemented');
}

/**
* Signs supplied message and returns raw signature bytes.
* @returns {Uint8Array}
*/
_sign(_message) {
throw new Error('Unimplemented');
}

/**
* Verifies signature produced over supplied message's using given public key.
* @param {Uint8Array} _message
* @param {Uint8Array | Signature} _signature
* @param {Uint8Array | PublicKey} _publicKey
* @returns {boolean}
*/
static verify(_message, _signature, _publicKey) {
throw new Error('Unimplemented');
}
}

export default withExtendedPrototypeProperties(
['privateKey', '_publicKey', '_sign'],
withExtendedStaticProperties(
['Signature', 'VerKeyType', 'SeedSize', 'verify', 'constructor'],
DockKeypair,
),
);
export { DockKeypair as default } from '@docknetwork/crypto-utils/keypairs';
10 changes: 6 additions & 4 deletions packages/credential-sdk/src/keypairs/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export { default as DockKeypair } from './dock-keypair';
export { default as Ed25519Keypair } from './keypair-ed25519';
export { default as Secp256k1Keypair } from './keypair-secp256k1';
export { default as Secp256r1Keypair } from './keypair-secp256r1';
export {
DockKeypair,
Ed25519Keypair,
Secp256k1Keypair,
Secp256r1Keypair,
} from '@docknetwork/crypto-utils/keypairs';
export { default as DidKeypair } from './did-keypair';
Loading
Loading