Skip to content

Commit

Permalink
fixed key.getPublic().encode("hex", false);
Browse files Browse the repository at this point in the history
  • Loading branch information
jshuo committed Jun 24, 2024
1 parent 13517ef commit a1e2187
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class EthrDID {
// var key = ec.genKeyPair();
const privateKey = '736f625c9dda78a94bb16840c82779bb7bc18014b8ede52f0f03429902fc4ba8';
const key = ec.keyFromPrivate(privateKey);
const publicKey = key.getPublic().toString();
const publicKey = key.getPublic().encode("hex", false);
const address = computeAddress(publicKey);
const net = typeof chainNameOrId === 'number' ? bytes.hexValue(chainNameOrId) : chainNameOrId;
const identifier = net ? `did:ethr:${net}:${publicKey}` : publicKey;
Expand Down
2 changes: 1 addition & 1 deletion lib/index.cjs.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/index.module.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/index.module.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/index.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/index.umd.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class EthrDID {
const privateKey =
'736f625c9dda78a94bb16840c82779bb7bc18014b8ede52f0f03429902fc4ba8';
const key = ec.keyFromPrivate(privateKey);
const publicKey = key.getPublic().toString();
const publicKey = key.getPublic().encode("hex", false);
const address = computeAddress(publicKey)
const net = typeof chainNameOrId === 'number' ? hexValue(chainNameOrId) : chainNameOrId
const identifier = net ? `did:ethr:${net}:${publicKey}` : publicKey
Expand Down
5 changes: 2 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3627,10 +3627,9 @@ [email protected]:
minimalistic-assert "^1.0.1"
minimalistic-crypto-utils "^1.0.1"

elliptic@^6.5.4, elliptic@^6.5.5:
elliptic@^6.5.4, "elliptic@git+https://github.com/jshuo/elliptic.git#60abff2a352b946fd42d8803de120a045429fc69":
version "6.5.5"
resolved "https://registry.npmjs.org/elliptic/-/elliptic-6.5.5.tgz"
integrity sha512-7EjbcmUm17NQFu4Pmgmq2olYMj8nwMnpcddByChSUjArp8F5DQWcIcpriwO4ZToLNAJig0yiyjswfyGNje/ixw==
resolved "git+https://github.com/jshuo/elliptic.git#60abff2a352b946fd42d8803de120a045429fc69"
dependencies:
bn.js "^4.11.9"
brorand "^1.1.0"
Expand Down

0 comments on commit a1e2187

Please sign in to comment.