@arcblock/did 1.27.15 → 1.28.0

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/esm/util.d.ts CHANGED
@@ -1,4 +1,6 @@
1
- import { BN } from '@ocap/util';
1
+ import { BN } from "@ocap/util";
2
+
3
+ //#region src/util.d.ts
2
4
  declare const DID_PREFIX = "did:abt:";
3
5
  /**
4
6
  * Convert did to bytes with length of 26
@@ -18,5 +20,6 @@ declare const toBits: (number: string | number | BN, length: number) => string;
18
20
  * @param {number} length
19
21
  * @returns {string} hex
20
22
  */
21
- declare const toStrictHex: (hex: string, length?: number) => any;
22
- export { DID_PREFIX, toBits, toBytes, toStrictHex };
23
+ declare const toStrictHex: (hex: string, length?: number) => string;
24
+ //#endregion
25
+ export { DID_PREFIX, toBits, toBytes, toStrictHex };
package/esm/util.js CHANGED
@@ -1,45 +1,40 @@
1
- /* eslint-disable @typescript-eslint/ban-ts-comment */
2
- import padStart from 'lodash/padStart';
3
- import { toBN, fromBase58, isHexStrict, stripHexPrefix } from '@ocap/util';
4
- const DID_PREFIX = 'did:abt:';
1
+ import { fromBase58, isHexStrict, stripHexPrefix, toBN } from "@ocap/util";
2
+ import padStart from "lodash/padStart.js";
3
+
4
+ //#region src/util.ts
5
+ const DID_PREFIX = "did:abt:";
5
6
  /**
6
- * Convert did to bytes with length of 26
7
- *
8
- * @param {string} did
9
- * @returns {Buffer}
10
- */
7
+ * Convert did to bytes with length of 26
8
+ *
9
+ * @param {string} did
10
+ * @returns {Buffer}
11
+ */
11
12
  const toBytes = (did) => {
12
- try {
13
- if (isHexStrict(did)) {
14
- return Buffer.from(stripHexPrefix(did), 'hex');
15
- }
16
- let bytes = fromBase58(did.replace(DID_PREFIX, ''));
17
- while (bytes.length < 26) {
18
- bytes = Buffer.concat([Buffer.from([0]), bytes]);
19
- }
20
- return bytes;
21
- }
22
- catch (err) {
23
- // @ts-ignore
24
- throw new Error(`Cannot convert DID string to byte array: ${err.message}`);
25
- }
13
+ try {
14
+ if (isHexStrict(did)) return Buffer.from(stripHexPrefix(did), "hex");
15
+ let bytes = fromBase58(did.replace(DID_PREFIX, ""));
16
+ while (bytes.length < 26) bytes = Buffer.concat([Buffer.from([0]), bytes]);
17
+ return bytes;
18
+ } catch (err) {
19
+ throw new Error(`Cannot convert DID string to byte array: ${err.message}`);
20
+ }
26
21
  };
27
22
  /**
28
- * Convert number to bit string with predefined length
29
- */
30
- const toBits = (number, length) => padStart(toBN(number).toString(2), length, '0');
23
+ * Convert number to bit string with predefined length
24
+ */
25
+ const toBits = (number, length) => padStart(toBN(number).toString(2), length, "0");
31
26
  /**
32
- * Ensure the hex length is even number, 2, 4, 6, 8
33
- *
34
- * @param {string} hex
35
- * @param {number} length
36
- * @returns {string} hex
37
- */
27
+ * Ensure the hex length is even number, 2, 4, 6, 8
28
+ *
29
+ * @param {string} hex
30
+ * @param {number} length
31
+ * @returns {string} hex
32
+ */
38
33
  const toStrictHex = (hex, length) => {
39
- const str = hex.replace(/^0x/i, '');
40
- if (typeof length === 'number' && length % 2 === 0) {
41
- return padStart(hex, length, '0');
42
- }
43
- return str.length % 2 === 0 ? str : `0${str}`;
34
+ const str = hex.replace(/^0x/i, "");
35
+ if (typeof length === "number" && length % 2 === 0) return padStart(hex, length, "0");
36
+ return str.length % 2 === 0 ? str : `0${str}`;
44
37
  };
45
- export { DID_PREFIX, toBits, toBytes, toStrictHex };
38
+
39
+ //#endregion
40
+ export { DID_PREFIX, toBits, toBytes, toStrictHex };
@@ -0,0 +1,29 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+
29
+ exports.__toESM = __toESM;
package/lib/index.d.ts CHANGED
@@ -1,7 +1,10 @@
1
- import { types } from '@ocap/mcrypto';
2
- import { toAddress, toDid, BytesType } from '@ocap/util';
3
- import { DidType, DIDType, DIDTypeShortcut, DIDTypeStr, DIDTypeArg, DID_TYPE_ARCBLOCK, DID_TYPE_ETHEREUM, DID_TYPE_PASSKEY, fromTypeInfo, isEthereumDid, isEthereumType, toTypeInfo, toTypeInfoStr } from './type';
4
- import { DID_PREFIX, toStrictHex } from './util';
1
+ import { DIDType, DIDTypeArg, DIDTypeShortcut, DIDTypeStr, DID_TYPE_ARCBLOCK, DID_TYPE_ETHEREUM, DID_TYPE_PASSKEY, DidType, fromTypeInfo, isEthereumDid, isEthereumType, toTypeInfo, toTypeInfoStr } from "./type.js";
2
+ import { DID_PREFIX, toStrictHex } from "./util.js";
3
+ import { types } from "@ocap/mcrypto";
4
+ import { BytesType, toAddress, toDid } from "@ocap/util";
5
+
6
+ //#region src/index.d.ts
7
+
5
8
  /**
6
9
  * Gen DID from private key and type config
7
10
  *
@@ -54,4 +57,5 @@ declare const isFromPublicKey: (did: string, pk: BytesType) => boolean;
54
57
  * @returns {boolean}
55
58
  */
56
59
  declare const isValid: (did: string) => boolean;
57
- export { DIDType, DIDTypeStr, DIDTypeArg, DIDTypeShortcut, types, toStrictHex, fromSecretKey, fromPublicKey, fromPublicKeyHash, fromHash, toAddress, toDid, isFromPublicKey, isValid, isEthereumDid, isEthereumType, toTypeInfo, toTypeInfoStr, fromTypeInfo, DidType, DID_PREFIX, DID_TYPE_ARCBLOCK, DID_TYPE_ETHEREUM, DID_TYPE_PASSKEY, };
60
+ //#endregion
61
+ export { type DIDType, type DIDTypeArg, type DIDTypeShortcut, type DIDTypeStr, DID_PREFIX, DID_TYPE_ARCBLOCK, DID_TYPE_ETHEREUM, DID_TYPE_PASSKEY, DidType, fromHash, fromPublicKey, fromPublicKeyHash, fromSecretKey, fromTypeInfo, isEthereumDid, isEthereumType, isFromPublicKey, isValid, toAddress, toDid, toStrictHex, toTypeInfo, toTypeInfoStr, types };
package/lib/index.js CHANGED
@@ -1,145 +1,115 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DID_TYPE_PASSKEY = exports.DID_TYPE_ETHEREUM = exports.DID_TYPE_ARCBLOCK = exports.DID_PREFIX = exports.DidType = exports.fromTypeInfo = exports.toTypeInfoStr = exports.toTypeInfo = exports.isEthereumType = exports.isEthereumDid = exports.isValid = exports.isFromPublicKey = exports.toDid = exports.toAddress = exports.fromHash = exports.fromPublicKeyHash = exports.fromPublicKey = exports.fromSecretKey = exports.toStrictHex = exports.types = void 0;
4
- /* eslint-disable @typescript-eslint/no-use-before-define */
5
- /* eslint-disable @typescript-eslint/ban-ts-comment */
6
- const mcrypto_1 = require("@ocap/mcrypto");
7
- Object.defineProperty(exports, "types", { enumerable: true, get: function () { return mcrypto_1.types; } });
8
- const util_1 = require("@ocap/util");
9
- Object.defineProperty(exports, "toAddress", { enumerable: true, get: function () { return util_1.toAddress; } });
10
- Object.defineProperty(exports, "toDid", { enumerable: true, get: function () { return util_1.toDid; } });
11
- const type_1 = require("./type");
12
- Object.defineProperty(exports, "DidType", { enumerable: true, get: function () { return type_1.DidType; } });
13
- Object.defineProperty(exports, "DID_TYPE_ARCBLOCK", { enumerable: true, get: function () { return type_1.DID_TYPE_ARCBLOCK; } });
14
- Object.defineProperty(exports, "DID_TYPE_ETHEREUM", { enumerable: true, get: function () { return type_1.DID_TYPE_ETHEREUM; } });
15
- Object.defineProperty(exports, "DID_TYPE_PASSKEY", { enumerable: true, get: function () { return type_1.DID_TYPE_PASSKEY; } });
16
- Object.defineProperty(exports, "fromTypeInfo", { enumerable: true, get: function () { return type_1.fromTypeInfo; } });
17
- Object.defineProperty(exports, "isEthereumDid", { enumerable: true, get: function () { return type_1.isEthereumDid; } });
18
- Object.defineProperty(exports, "isEthereumType", { enumerable: true, get: function () { return type_1.isEthereumType; } });
19
- Object.defineProperty(exports, "toTypeInfo", { enumerable: true, get: function () { return type_1.toTypeInfo; } });
20
- Object.defineProperty(exports, "toTypeInfoStr", { enumerable: true, get: function () { return type_1.toTypeInfoStr; } });
21
- const util_2 = require("./util");
22
- Object.defineProperty(exports, "DID_PREFIX", { enumerable: true, get: function () { return util_2.DID_PREFIX; } });
23
- Object.defineProperty(exports, "toStrictHex", { enumerable: true, get: function () { return util_2.toStrictHex; } });
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.js');
2
+ const require_util = require('./util.js');
3
+ const require_type = require('./type.js');
4
+ let _ocap_mcrypto = require("@ocap/mcrypto");
5
+ let _ocap_util = require("@ocap/util");
6
+
7
+ //#region src/index.ts
24
8
  /**
25
- * Gen DID from private key and type config
26
- *
27
- * Spec: https://github.com/ArcBlock/ABT-DID-Protocol#create-did
28
- *
29
- * @public
30
- * @static
31
- * @param {string} sk - hex encoded secret key string
32
- * @param {object} type - wallet type, {@see @ocap/wallet#WalletType}
33
- * @returns {string} DID string
34
- */
9
+ * Gen DID from private key and type config
10
+ *
11
+ * Spec: https://github.com/ArcBlock/ABT-DID-Protocol#create-did
12
+ *
13
+ * @public
14
+ * @static
15
+ * @param {string} sk - hex encoded secret key string
16
+ * @param {object} type - wallet type, {@see @ocap/wallet#WalletType}
17
+ * @returns {string} DID string
18
+ */
35
19
  const fromSecretKey = (sk, type) => {
36
- const info = (0, type_1.DidType)(type);
37
- const pub = (0, mcrypto_1.getSigner)(info.pk).getPublicKey(sk);
38
- return fromPublicKey(pub.indexOf('0x') === 0 ? pub : `0x${pub}`, info);
20
+ const info = require_type.DidType(type);
21
+ const pub = (0, _ocap_mcrypto.getSigner)(info.pk).getPublicKey(sk);
22
+ return fromPublicKey(pub.indexOf("0x") === 0 ? pub : `0x${pub}`, info);
39
23
  };
40
- exports.fromSecretKey = fromSecretKey;
41
24
  /**
42
- * Gen DID from public key and type config
43
- *
44
- * @public
45
- * @static
46
- * @param {string} pk - hex encoded public key
47
- * @param {object} type - wallet type, {@see @ocap/wallet#WalletType}
48
- * @returns {string} DID string
49
- */
25
+ * Gen DID from public key and type config
26
+ *
27
+ * @public
28
+ * @static
29
+ * @param {string} pk - hex encoded public key
30
+ * @param {object} type - wallet type, {@see @ocap/wallet#WalletType}
31
+ * @returns {string} DID string
32
+ */
50
33
  const fromPublicKey = (pk, type) => {
51
- const info = (0, type_1.DidType)(type);
52
- const hashFn = (0, mcrypto_1.getHasher)(info.hash);
53
- const pkHash = hashFn(pk, 1);
54
- return fromPublicKeyHash(pkHash, info);
34
+ const info = require_type.DidType(type);
35
+ return fromPublicKeyHash((0, _ocap_mcrypto.getHasher)(info.hash)(pk, 1), info);
55
36
  };
56
- exports.fromPublicKey = fromPublicKey;
57
37
  const fromPublicKeyHash = (buffer, type) => {
58
- const info = (0, type_1.DidType)(type);
59
- const pkHash = (0, util_1.stripHexPrefix)(buffer).slice(0, 40); // 20 bytes
60
- const hashFn = (0, mcrypto_1.getHasher)(info.hash);
61
- const typeHex = (0, type_1.fromTypeInfo)(info);
62
- const checksum = (0, util_1.stripHexPrefix)(hashFn(`0x${typeHex}${pkHash}`, 1)).slice(0, 8); // 4 bytes
63
- const didHash = `0x${typeHex}${pkHash}${checksum}`;
64
- // ethereum-compatible address, this address does not contain any type info
65
- // but we can infer from the address itself
66
- if ((0, type_1.isEthereumType)(info)) {
67
- return (0, type_1.toChecksumAddress)(`0x${buffer.slice(-40)}`);
68
- }
69
- // default forge-compatible did
70
- if (info.address === mcrypto_1.types.EncodingType.BASE58) {
71
- return (0, util_1.toBase58)(didHash);
72
- }
73
- // fallback base16 encoding
74
- return didHash;
38
+ const info = require_type.DidType(type);
39
+ const pkHash = (0, _ocap_util.stripHexPrefix)(buffer).slice(0, 40);
40
+ const hashFn = (0, _ocap_mcrypto.getHasher)(info.hash);
41
+ const typeHex = require_type.fromTypeInfo(info);
42
+ const didHash = `0x${typeHex}${pkHash}${(0, _ocap_util.stripHexPrefix)(hashFn(`0x${typeHex}${pkHash}`, 1)).slice(0, 8)}`;
43
+ if (require_type.isEthereumType(info)) return require_type.toChecksumAddress(`0x${buffer.slice(-40)}`);
44
+ if (info.address === _ocap_mcrypto.types.EncodingType.BASE58) return (0, _ocap_util.toBase58)(didHash);
45
+ return didHash;
75
46
  };
76
- exports.fromPublicKeyHash = fromPublicKeyHash;
77
47
  /**
78
- * Gen DID from an hex encoded hash and role type
79
- *
80
- * @public
81
- * @static
82
- * @param {string} hash - hex encoded hash
83
- * @param {enum} role - role type, {@see @ocap/mcrypto#types}
84
- * @returns {string} DID string
85
- */
86
- const fromHash = (hash, role = mcrypto_1.types.RoleType.ROLE_ACCOUNT) => {
87
- const roleKeys = Object.keys(mcrypto_1.types.RoleType);
88
- const roleValues = Object.values(mcrypto_1.types.RoleType);
89
- if (roleValues.indexOf(role) === -1) {
90
- throw new Error(`Unsupported role type ${role} when gen ddi from hash`);
91
- }
92
- const type = (0, type_1.DidType)({
93
- // @ts-ignore
94
- role: mcrypto_1.types.RoleType[roleKeys[roleValues.indexOf(role)]],
95
- });
96
- return fromPublicKeyHash(hash, type);
48
+ * Gen DID from an hex encoded hash and role type
49
+ *
50
+ * @public
51
+ * @static
52
+ * @param {string} hash - hex encoded hash
53
+ * @param {enum} role - role type, {@see @ocap/mcrypto#types}
54
+ * @returns {string} DID string
55
+ */
56
+ const fromHash = (hash, role = _ocap_mcrypto.types.RoleType.ROLE_ACCOUNT) => {
57
+ const roleKeys = Object.keys(_ocap_mcrypto.types.RoleType);
58
+ const roleValues = Object.values(_ocap_mcrypto.types.RoleType);
59
+ if (roleValues.indexOf(role) === -1) throw new Error(`Unsupported role type ${role} when gen ddi from hash`);
60
+ return fromPublicKeyHash(hash, require_type.DidType({ role: _ocap_mcrypto.types.RoleType[roleKeys[roleValues.indexOf(role)]] }));
97
61
  };
98
- exports.fromHash = fromHash;
99
62
  /**
100
- * Check if an DID is generated from a publicKey
101
- *
102
- * @public
103
- * @static
104
- * @param {string} did - string of the did, usually base58btc format
105
- * @param {string} pk - hex encoded publicKey string
106
- * @returns {boolean}
107
- */
63
+ * Check if an DID is generated from a publicKey
64
+ *
65
+ * @public
66
+ * @static
67
+ * @param {string} did - string of the did, usually base58btc format
68
+ * @param {string} pk - hex encoded publicKey string
69
+ * @returns {boolean}
70
+ */
108
71
  const isFromPublicKey = (did, pk) => {
109
- if (isValid(did) === false) {
110
- return false;
111
- }
112
- const type = (0, type_1.toTypeInfo)(did);
113
- const didNew = fromPublicKey(pk, type);
114
- const didClean = did.replace(util_2.DID_PREFIX, '');
115
- return didNew === didClean;
72
+ if (isValid(did) === false) return false;
73
+ return fromPublicKey(pk, require_type.toTypeInfo(did)) === did.replace(require_util.DID_PREFIX, "");
116
74
  };
117
- exports.isFromPublicKey = isFromPublicKey;
118
75
  /**
119
- * Check if a DID string is valid
120
- *
121
- * @public
122
- * @static
123
- * @param {string} did - address string
124
- * @returns {boolean}
125
- */
76
+ * Check if a DID string is valid
77
+ *
78
+ * @public
79
+ * @static
80
+ * @param {string} did - address string
81
+ * @returns {boolean}
82
+ */
126
83
  const isValid = (did) => {
127
- if (!did) {
128
- return false;
129
- }
130
- const address = (0, util_1.toAddress)(String(did));
131
- const { hash } = (0, type_1.toTypeInfo)(address);
132
- if (typeof hash === 'undefined') {
133
- return false;
134
- }
135
- if ((0, type_1.isEthereumDid)(address)) {
136
- return true;
137
- }
138
- const hashFn = (0, mcrypto_1.getHasher)(hash);
139
- const bytes = (0, util_2.toBytes)(address);
140
- const bytesHex = (0, util_2.toStrictHex)(Buffer.from(bytes.slice(0, 22)).toString('hex'));
141
- const didChecksum = (0, util_2.toStrictHex)(Buffer.from(bytes.slice(22, 26)).toString('hex'));
142
- const checksum = (0, util_1.stripHexPrefix)(hashFn(`0x${bytesHex}`, 1)).slice(0, 8);
143
- return didChecksum === checksum;
84
+ if (!did) return false;
85
+ const address = (0, _ocap_util.toAddress)(String(did));
86
+ const { hash } = require_type.toTypeInfo(address);
87
+ if (typeof hash === "undefined") return false;
88
+ if (require_type.isEthereumDid(address)) return true;
89
+ const hashFn = (0, _ocap_mcrypto.getHasher)(hash);
90
+ const bytes = require_util.toBytes(address);
91
+ const bytesHex = require_util.toStrictHex(Buffer.from(bytes.slice(0, 22)).toString("hex"));
92
+ return require_util.toStrictHex(Buffer.from(bytes.slice(22, 26)).toString("hex")) === (0, _ocap_util.stripHexPrefix)(hashFn(`0x${bytesHex}`, 1)).slice(0, 8);
144
93
  };
94
+
95
+ //#endregion
96
+ exports.DID_PREFIX = require_util.DID_PREFIX;
97
+ exports.DID_TYPE_ARCBLOCK = require_type.DID_TYPE_ARCBLOCK;
98
+ exports.DID_TYPE_ETHEREUM = require_type.DID_TYPE_ETHEREUM;
99
+ exports.DID_TYPE_PASSKEY = require_type.DID_TYPE_PASSKEY;
100
+ exports.DidType = require_type.DidType;
101
+ exports.fromHash = fromHash;
102
+ exports.fromPublicKey = fromPublicKey;
103
+ exports.fromPublicKeyHash = fromPublicKeyHash;
104
+ exports.fromSecretKey = fromSecretKey;
105
+ exports.fromTypeInfo = require_type.fromTypeInfo;
106
+ exports.isEthereumDid = require_type.isEthereumDid;
107
+ exports.isEthereumType = require_type.isEthereumType;
108
+ exports.isFromPublicKey = isFromPublicKey;
145
109
  exports.isValid = isValid;
110
+ exports.toAddress = _ocap_util.toAddress;
111
+ exports.toDid = _ocap_util.toDid;
112
+ exports.toStrictHex = require_util.toStrictHex;
113
+ exports.toTypeInfo = require_type.toTypeInfo;
114
+ exports.toTypeInfoStr = require_type.toTypeInfoStr;
115
+ exports.types = _ocap_mcrypto.types;
File without changes
@@ -0,0 +1,5 @@
1
+ //#region src/lodash.d.ts
2
+ declare module 'lodash/isEqual';
3
+ declare module 'lodash/pick';
4
+ declare module 'lodash/padStart';
5
+ declare module 'lodash/upperFirst';
package/lib/type.d.ts CHANGED
@@ -1,17 +1,15 @@
1
- import type { LiteralUnion } from 'type-fest';
2
- export type DIDTypeKey = LiteralUnion<'role' | 'pk' | 'hash' | 'address', string>;
3
- export type DIDTypeShortcut = LiteralUnion<'default' | 'arcblock' | 'eth' | 'ethereum' | 'passkey', string>;
4
- export type DIDType = {
5
- [key in DIDTypeKey]?: number;
6
- };
7
- export type DIDTypeStr = {
8
- [key in DIDTypeKey]?: string;
9
- };
10
- export type DIDTypeArg = DIDTypeShortcut | DIDType;
1
+ import { LiteralUnion } from "type-fest";
2
+
3
+ //#region src/type.d.ts
4
+ type DIDTypeKey = LiteralUnion<'role' | 'pk' | 'hash' | 'address', string>;
5
+ type DIDTypeShortcut = LiteralUnion<'default' | 'arcblock' | 'eth' | 'ethereum' | 'passkey', string>;
6
+ type DIDType = { [key in DIDTypeKey]?: number };
7
+ type DIDTypeStr = { [key in DIDTypeKey]?: string };
8
+ type DIDTypeArg = DIDTypeShortcut | DIDType;
11
9
  declare const DID_TYPE_ARCBLOCK: DIDType;
12
10
  declare const DID_TYPE_PASSKEY: DIDType;
13
11
  declare const DID_TYPE_ETHEREUM: DIDType;
14
- declare const isEthereumType: (type: DIDType) => any;
12
+ declare const isEthereumType: (type: DIDType) => boolean;
15
13
  /**
16
14
  * Checks if the given string is an address
17
15
  *
@@ -33,8 +31,8 @@ declare const toChecksumAddress: (address: string) => string;
33
31
  */
34
32
  declare function DidType(type?: DIDTypeArg): DIDType;
35
33
  declare namespace DidType {
36
- var toJSON: (type: DIDType) => DIDTypeStr;
37
- var fromJSON: (json: DIDTypeStr) => DIDType;
34
+ var toJSON: (type: DIDType) => DIDTypeStr;
35
+ var fromJSON: (json: DIDTypeStr) => DIDType;
38
36
  }
39
37
  /**
40
38
  * Convert type info object to hex string
@@ -50,4 +48,5 @@ declare const fromTypeInfo: (type: DIDTypeArg) => string;
50
48
  */
51
49
  declare const toTypeInfo: (did: string) => DIDType;
52
50
  declare const toTypeInfoStr: (did: string) => DIDTypeStr;
53
- export { DID_TYPE_ARCBLOCK, DID_TYPE_ETHEREUM, DID_TYPE_PASSKEY, fromTypeInfo, toTypeInfo, toTypeInfoStr, isEthereumType, isEthereumDid, toChecksumAddress, DidType, };
51
+ //#endregion
52
+ export { DIDType, DIDTypeArg, DIDTypeKey, DIDTypeShortcut, DIDTypeStr, DID_TYPE_ARCBLOCK, DID_TYPE_ETHEREUM, DID_TYPE_PASSKEY, DidType, fromTypeInfo, isEthereumDid, isEthereumType, toChecksumAddress, toTypeInfo, toTypeInfoStr };