@arcblock/did 1.15.6 → 1.16.1

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.
Files changed (2) hide show
  1. package/lib/index.d.ts +45 -16
  2. package/package.json +4 -4
package/lib/index.d.ts CHANGED
@@ -1,5 +1,13 @@
1
1
  // Generate by [js2dts@0.3.3](https://github.com/whxaxes/js2dts#readme)
2
2
 
3
+ /**
4
+ * Ensure the hex length is even number, 2, 4, 6, 8
5
+ *
6
+ * @param {string} hex
7
+ * @param {number} length
8
+ * @returns {string} hex
9
+ */
10
+ declare function toStrictHex(hex: string, length: number): string;
3
11
  /**
4
12
  * Convert did to address: remove `did:abt:` prefix
5
13
  *
@@ -18,6 +26,34 @@ declare function toAddress(did: string): string;
18
26
  * @returns {string}
19
27
  */
20
28
  declare function toDid(address: any): string;
29
+ /**
30
+ * Checks if the given string is an address
31
+ *
32
+ * @method isEthereumDid
33
+ * @param {String} address the given HEX address
34
+ * @return {Boolean}
35
+ */
36
+ declare function isEthereumDid(did: any): boolean;
37
+ declare function isEthereumType(type: any): any;
38
+ /**
39
+ * Get type info from did (base58 format)
40
+ *
41
+ * @public
42
+ * @static
43
+ * @param {string} did - address string
44
+ * @param {boolean} [returnString=true]
45
+ * @returns {object} wallet type {@see @arcblock/did#DidType}
46
+ */
47
+ declare function toTypeInfo(did: string, returnString?: boolean): object;
48
+ /**
49
+ * Convert type info object to hex string
50
+ *
51
+ * @public
52
+ * @static
53
+ * @param {object} type - wallet type, {@see @arcblock/did#DidType}
54
+ * @returns string
55
+ */
56
+ declare function fromTypeInfo(type: object): string;
21
57
  /**
22
58
  * The structure of a forge wallet type
23
59
  *
@@ -48,21 +84,12 @@ declare function toDid(address: any): string;
48
84
  * hash: types.HashType.SHA3,
49
85
  * });
50
86
  */
51
- declare function DidType(type?: string | DidType_1): any;
52
- declare const _Lib: _Lib.T102;
87
+ declare function DidType(type?: DidType | string): object;
88
+ declare const _Lib: _Lib.T100;
53
89
  declare namespace _Lib {
54
90
  export interface T100 {
55
- [key: string]: any;
56
- }
57
- export interface T101 {
58
- role: any;
59
- pk: any;
60
- hash: any;
61
- address: any;
62
- }
63
- export interface T102 {
64
91
  types: any;
65
- toStrictHex: (hex: string, length: number) => string;
92
+ toStrictHex: typeof toStrictHex;
66
93
  fromSecretKey: (sk: string, type: any) => string;
67
94
  fromPublicKey: (pk: string, type: any) => string;
68
95
  fromPublicKeyHash: (buffer: any, type: any) => string;
@@ -71,11 +98,13 @@ declare namespace _Lib {
71
98
  toDid: typeof toDid;
72
99
  isFromPublicKey: (did: string, pk: string) => boolean;
73
100
  isValid: (did: string) => boolean;
74
- toTypeInfo: (did: string, returnString?: boolean) => any;
75
- fromTypeInfo: (type: any) => string;
101
+ isEthereumDid: typeof isEthereumDid;
102
+ isEthereumType: typeof isEthereumType;
103
+ toTypeInfo: typeof toTypeInfo;
104
+ fromTypeInfo: typeof fromTypeInfo;
76
105
  DidType: typeof DidType;
77
- DID_TYPE_ARCBLOCK: _Lib.T101;
78
- DID_TYPE_ETHEREUM: _Lib.T101;
106
+ DID_TYPE_ARCBLOCK: typeof DID_TYPE_ARCBLOCK;
107
+ DID_TYPE_ETHEREUM: typeof DID_TYPE_ETHEREUM;
79
108
  }
80
109
  }
81
110
  export = _Lib;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/did",
3
- "version": "1.15.6",
3
+ "version": "1.16.1",
4
4
  "description": "Javascript lib to work with ArcBlock DID",
5
5
  "keywords": [
6
6
  "forge",
@@ -45,11 +45,11 @@
45
45
  "url": "https://github.com/ArcBlock/asset-chain/issues"
46
46
  },
47
47
  "dependencies": {
48
- "@ocap/mcrypto": "1.15.6",
49
- "@ocap/util": "1.15.6",
48
+ "@ocap/mcrypto": "1.16.1",
49
+ "@ocap/util": "1.16.1",
50
50
  "bn.js": "^5.2.0",
51
51
  "debug": "^4.3.3",
52
52
  "lodash": "^4.17.21"
53
53
  },
54
- "gitHead": "866970f65d02e32255f909a3e3a5d1d3a87ec89a"
54
+ "gitHead": "9d396112e1a0bdabea753d6104117ca9e1fede26"
55
55
  }