@abtnode/util 1.8.50 → 1.8.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/base32.js CHANGED
@@ -1,4 +1,4 @@
1
- const { fromBase58 } = require('@ocap/util');
1
+ const { toBuffer } = require('@ocap/util');
2
2
  const { base32 } = require('multiformats/bases/base32');
3
3
 
4
4
  const encode = (did) => {
@@ -6,7 +6,7 @@ const encode = (did) => {
6
6
  return did;
7
7
  }
8
8
 
9
- const buffer = fromBase58(did);
9
+ const buffer = toBuffer(did);
10
10
 
11
11
  return base32.encode(buffer);
12
12
  };
@@ -6,7 +6,17 @@ const debug = require('debug')('@abtnode/util:did-document');
6
6
  const axios = require('./axios');
7
7
  const { encode: encodeBase32 } = require('./base32');
8
8
 
9
- const getDID = (address) => `did:abt:${address}`;
9
+ const getDID = (address) => {
10
+ if (!address || typeof address !== 'string') {
11
+ return address;
12
+ }
13
+
14
+ if (address.startsWith('did:abt:')) {
15
+ return address;
16
+ }
17
+
18
+ return `did:abt:${address}`;
19
+ };
10
20
 
11
21
  const update = async ({ services, didRegistryUrl, wallet }) => {
12
22
  debug('update did document', { didRegistryUrl });
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.8.50",
6
+ "version": "1.8.52",
7
7
  "description": "ArcBlock's JavaScript utility",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -18,13 +18,13 @@
18
18
  "author": "polunzh <polunzh@gmail.com> (http://github.com/polunzh)",
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@abtnode/constant": "1.8.50",
22
- "@abtnode/logger": "1.8.50",
23
- "@arcblock/jwt": "^1.18.32",
24
- "@blocklet/constant": "1.8.50",
25
- "@ocap/mcrypto": "1.18.32",
26
- "@ocap/util": "1.18.32",
27
- "@ocap/wallet": "1.18.32",
21
+ "@abtnode/constant": "1.8.52",
22
+ "@abtnode/logger": "1.8.52",
23
+ "@arcblock/jwt": "^1.18.34",
24
+ "@blocklet/constant": "1.8.52",
25
+ "@ocap/mcrypto": "1.18.34",
26
+ "@ocap/util": "1.18.34",
27
+ "@ocap/wallet": "1.18.34",
28
28
  "axios": "^0.27.2",
29
29
  "axios-mock-adapter": "^1.21.2",
30
30
  "axon": "^2.0.3",
@@ -64,5 +64,5 @@
64
64
  "fs-extra": "^10.1.0",
65
65
  "jest": "^27.5.1"
66
66
  },
67
- "gitHead": "7f3ccb957659a6791b93b6fc4fbcbbd2c42f1efd"
67
+ "gitHead": "80217320b7cbd8c815172f8a985584586c32e858"
68
68
  }