Skip to content

Commit

Permalink
Merge pull request #187 from identity-com/develop
Browse files Browse the repository at this point in the history
3.1.2 Release PR
  • Loading branch information
rado0x54 authored Sep 23, 2022
2 parents 458c048 + 197a5b7 commit ae5045a
Show file tree
Hide file tree
Showing 6 changed files with 355 additions and 329 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Security

## [3.1.2] - 2022-09-23
### Changed
- Removed `ethers` dependency to reduce package size.

## [3.1.1] - 2022-09-22
### Fixed
Expand Down
4 changes: 2 additions & 2 deletions legacy/client/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.0.3",
"version": "2.0.4",
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down Expand Up @@ -43,7 +43,7 @@
},
"name": "@identity.com/sol-did-client-legacy",
"author": "dankelleher",
"module": "dist/sol-did-client.esm.js",
"module": "dist/sol-did-client-legacy.esm.js",
"size-limit": [
{
"path": "dist/sol-did-client.cjs.production.min.js",
Expand Down
9 changes: 5 additions & 4 deletions sol-did/client/packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@identity.com/sol-did-client",
"version": "3.1.1",
"version": "3.1.2",
"description": "A powerful DID-method on Solana",
"license": "MIT",
"main": "dist/src/index.js",
Expand Down Expand Up @@ -31,13 +31,14 @@
"prepack": "yarn build"
},
"dependencies": {
"@identity.com/sol-did-client-legacy": "^2.0.3",
"@ethersproject/address": "^5.7.0",
"@ethersproject/bytes": "^5.7.0",
"@identity.com/sol-did-client-legacy": "^2.0.4",
"@identity.com/sol-did-idl": "^3.1.0",
"@project-serum/anchor": "0.25.0",
"@solana/web3.js": "^1.59.1",
"bs58": "^5.0.0",
"did-resolver": "^3.2.2",
"ethers": "^5.6.9"
"did-resolver": "^3.2.2"
},
"devDependencies": {
"@types/bn.js": "^5.1.0",
Expand Down
15 changes: 7 additions & 8 deletions sol-did/client/packages/core/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import * as anchor from '@project-serum/anchor';
import { Program, Provider } from '@project-serum/anchor';
import { SolDid, IDL } from '@identity.com/sol-did-idl';
import { Keypair, PublicKey, TransactionInstruction } from '@solana/web3.js';
import { utils as ethersUtils } from 'ethers';
import { getAddress } from '@ethersproject/address';
import { hexlify, arrayify } from '@ethersproject/bytes';
import { decode } from 'bs58';

import {
Expand Down Expand Up @@ -62,7 +63,7 @@ export const ethSignPayload = async (

const signatureFull = await signer.signMessage(message);
// add signature to payload
const signatureBytes = ethersUtils.arrayify(signatureFull);
const signatureBytes = arrayify(signatureFull);
const signature = Array.from(signatureBytes.slice(0, -1));
// // map [0x1b, 0x1c] to [0, 1]
// https://docs.ethers.io/v4/api-utils.html#signatures
Expand Down Expand Up @@ -191,12 +192,10 @@ export const mapVerificationMethodsToDidComponents = (
vm.publicKeyBase58 = new PublicKey(method.keyData).toBase58();
break;
case VerificationMethodType.EcdsaSecp256k1RecoveryMethod2020:
vm.ethereumAddress = ethersUtils.getAddress(
ethersUtils.hexlify(method.keyData)
);
vm.ethereumAddress = getAddress(hexlify(method.keyData));
break;
case VerificationMethodType.EcdsaSecp256k1VerificationKey2019:
vm.publicKeyHex = ethersUtils.hexlify(method.keyData).replace('0x', '');
vm.publicKeyHex = hexlify(method.keyData).replace('0x', '');
break;
default:
throw new Error(
Expand Down Expand Up @@ -285,11 +284,11 @@ export const getKeyDataFromVerificationMethod = (
case VerificationMethodType[
VerificationMethodType.EcdsaSecp256k1RecoveryMethod2020
]:
return Buffer.from(ethersUtils.arrayify(vm.ethereumAddress as string));
return Buffer.from(arrayify(vm.ethereumAddress as string));
case VerificationMethodType[
VerificationMethodType.EcdsaSecp256k1VerificationKey2019
]:
return Buffer.from(ethersUtils.arrayify(vm.publicKeyHex as string));
return Buffer.from(arrayify(vm.publicKeyHex as string));
default:
throw new Error(`Verification method type '${vm.type}' not recognized`);
}
Expand Down
3 changes: 2 additions & 1 deletion sol-did/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
"@project-serum/anchor": "0.25.0"
},
"devDependencies": {
"@identity.com/sol-did-idl": "^3.1.0",
"@identity.com/sol-did-client": "^3.1.0",
"@identity.com/sol-did-idl": "^3.1.0",
"@project-serum/anchor-cli": "https://github.com/kklas/anchor-nightly/releases/download/anchor-cli-latest/anchor-cli-0.25.0-7eb8ca8.tgz",
"@types/bn.js": "^5.1.0",
"@types/chai": "^4.3.0",
"@types/mocha": "^9.0.0",
"chai": "^4.3.4",
"chai-as-promised": "^7.1.1",
"ethers": "^5.7.1",
"mocha": "^10.0.0",
"prettier": "^2.6.2",
"ts-mocha": "^10.0.0",
Expand Down
Loading

0 comments on commit ae5045a

Please sign in to comment.