@ckb-ccc/joy-id 0.0.12-alpha.0 → 0.0.12

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 (53) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +5 -5
  3. package/dist/btc/index.d.ts +9 -12
  4. package/dist/btc/index.d.ts.map +1 -1
  5. package/dist/btc/index.js +9 -12
  6. package/dist/ckb/index.d.ts +26 -33
  7. package/dist/ckb/index.d.ts.map +1 -1
  8. package/dist/ckb/index.js +26 -33
  9. package/dist/common/index.d.ts +3 -4
  10. package/dist/common/index.d.ts.map +1 -1
  11. package/dist/common/index.js +3 -3
  12. package/dist/connectionsStorage/index.d.ts +31 -26
  13. package/dist/connectionsStorage/index.d.ts.map +1 -1
  14. package/dist/connectionsStorage/index.js +11 -13
  15. package/dist/evm/index.d.ts +11 -16
  16. package/dist/evm/index.d.ts.map +1 -1
  17. package/dist/evm/index.js +11 -16
  18. package/dist/nostr/index.d.ts +9 -14
  19. package/dist/nostr/index.d.ts.map +1 -1
  20. package/dist/nostr/index.js +9 -14
  21. package/dist/signerFactory/index.d.ts +6 -4
  22. package/dist/signerFactory/index.d.ts.map +1 -1
  23. package/dist/signerFactory/index.js +6 -4
  24. package/dist.commonjs/btc/index.d.ts +9 -12
  25. package/dist.commonjs/btc/index.d.ts.map +1 -1
  26. package/dist.commonjs/btc/index.js +9 -12
  27. package/dist.commonjs/ckb/index.d.ts +26 -33
  28. package/dist.commonjs/ckb/index.d.ts.map +1 -1
  29. package/dist.commonjs/ckb/index.js +26 -33
  30. package/dist.commonjs/common/index.d.ts +3 -4
  31. package/dist.commonjs/common/index.d.ts.map +1 -1
  32. package/dist.commonjs/common/index.js +3 -3
  33. package/dist.commonjs/connectionsStorage/index.d.ts +31 -26
  34. package/dist.commonjs/connectionsStorage/index.d.ts.map +1 -1
  35. package/dist.commonjs/connectionsStorage/index.js +11 -13
  36. package/dist.commonjs/evm/index.d.ts +11 -16
  37. package/dist.commonjs/evm/index.d.ts.map +1 -1
  38. package/dist.commonjs/evm/index.js +11 -16
  39. package/dist.commonjs/nostr/index.d.ts +9 -14
  40. package/dist.commonjs/nostr/index.d.ts.map +1 -1
  41. package/dist.commonjs/nostr/index.js +9 -14
  42. package/dist.commonjs/signerFactory/index.d.ts +6 -4
  43. package/dist.commonjs/signerFactory/index.d.ts.map +1 -1
  44. package/dist.commonjs/signerFactory/index.js +6 -4
  45. package/package.json +9 -10
  46. package/src/btc/index.ts +9 -12
  47. package/src/ckb/index.ts +26 -33
  48. package/src/common/index.ts +3 -4
  49. package/src/connectionsStorage/index.ts +31 -26
  50. package/src/evm/index.ts +11 -16
  51. package/src/nostr/index.ts +9 -14
  52. package/src/signerFactory/index.ts +6 -4
  53. package/typedoc.json +6 -0
@@ -1,80 +1,85 @@
1
1
  import { ccc } from "@ckb-ccc/core";
2
2
  /**
3
3
  * Type representing an account selector with a URI and address type.
4
- * @typedef {Object} AccountSelector
5
- * @property {string} uri - The URI of the account.
6
- * @property {string} addressType - The address type of the account.
7
4
  */
8
5
  export type AccountSelector = {
6
+ /**
7
+ * The URI of the account.
8
+ */
9
9
  uri: string;
10
+ /**
11
+ * The address type of the account.
12
+ */
10
13
  addressType: string;
11
14
  };
12
15
  /**
13
- * Checks if two AccountSelectors are equal.
14
- * @param {AccountSelector} a - The first account selector.
15
- * @param {AccountSelector} b - The second account selector.
16
- * @returns {boolean} True if the selectors are equal, false otherwise.
16
+ * Checks if a AccountSelector matches the filter
17
+ * @param a - The first account selector.
18
+ * @param filter - The account selector filter.
19
+ * @returns True if the selector matches the filter
17
20
  */
18
21
  export declare function isSelectorMatch(a: AccountSelector, filter: AccountSelector): boolean;
19
22
  /**
20
23
  * Type representing a connection with an address, public key, and key type.
21
- * @typedef {Object} Connection
22
- * @property {string} address - The address of the connection.
23
- * @property {ccc.Hex} publicKey - The public key of the connection.
24
- * @property {string} keyType - The key type of the connection.
25
24
  */
26
25
  export type Connection = {
26
+ /**
27
+ * The address of the connection.
28
+ */
27
29
  readonly address: string;
30
+ /**
31
+ * The public key of the connection.
32
+ */
28
33
  readonly publicKey: ccc.Hex;
34
+ /**
35
+ * The key type of the connection.
36
+ */
29
37
  readonly keyType: string;
30
38
  };
31
39
  /**
32
40
  * Interface representing a repository for managing connections.
33
- * @interface
34
41
  */
35
42
  export interface ConnectionsRepo {
36
43
  /**
37
44
  * Gets a connection for the given selector.
38
- * @param {AccountSelector} selector - The account selector.
39
- * @returns {Promise<Connection | undefined>} A promise that resolves to the connection, if found.
45
+ * @param selector - The account selector.
46
+ * @returns A promise that resolves to the connection, if found.
40
47
  */
41
48
  get(selector: AccountSelector): Promise<Connection | undefined>;
42
49
  /**
43
50
  * Sets a connection for the given selector.
44
- * @param {AccountSelector} selector - The account selector.
45
- * @param {Connection | undefined} connection - The connection to set.
46
- * @returns {Promise<void>} A promise that resolves when the connection is set.
51
+ * @param selector - The account selector.
52
+ * @param connection - The connection to set.
53
+ * @returns A promise that resolves when the connection is set.
47
54
  */
48
55
  set(selector: AccountSelector, connection: Connection | undefined): Promise<void>;
49
56
  }
50
57
  /**
51
58
  * Class representing a local storage-based repository for managing connections.
52
- * @class
53
- * @implements {ConnectionsRepo}
54
59
  */
55
60
  export declare class ConnectionsRepoLocalStorage implements ConnectionsRepo {
56
61
  private readonly storageKey;
57
62
  /**
58
63
  * Creates an instance of ConnectionsRepoLocalStorage.
59
- * @param {string} [storageKey="ccc-joy-id-signer"] - The local storage key.
64
+ * @param [storageKey="ccc-joy-id-signer"] - The local storage key.
60
65
  */
61
66
  constructor(storageKey?: string);
62
67
  /**
63
68
  * Reads all connections from local storage.
64
- * @returns {Promise<[AccountSelector, Connection][]>} A promise that resolves to an array of selectors and connections.
69
+ * @returns A promise that resolves to an array of selectors and connections.
65
70
  */
66
71
  readConnections(): Promise<[AccountSelector, Connection][]>;
67
72
  /**
68
73
  * Gets a connection for the given selector.
69
- * @param {AccountSelector} selector - The account selector.
70
- * @returns {Promise<Connection | undefined>} A promise that resolves to the connection, if found.
74
+ * @param selector - The account selector.
75
+ * @returns A promise that resolves to the connection, if found.
71
76
  */
72
77
  get(selector: AccountSelector): Promise<Connection | undefined>;
73
78
  /**
74
79
  * Sets a connection for the given selector.
75
- * @param {AccountSelector} selector - The account selector.
76
- * @param {Connection | undefined} connection - The connection to set.
77
- * @returns {Promise<void>}
80
+ * @param selector - The account selector.
81
+ * @param connection - The connection to set.
82
+ * @returns
78
83
  */
79
84
  set(selector: AccountSelector, connection: Connection | undefined): Promise<void>;
80
85
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connectionsStorage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,CAAC,EAAE,eAAe,EAClB,MAAM,EAAE,eAAe,GACtB,OAAO,CAET;AAED;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,GAAG,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,GAAG,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;IAEhE;;;;;OAKG;IACH,GAAG,CACD,QAAQ,EAAE,eAAe,EACzB,UAAU,EAAE,UAAU,GAAG,SAAS,GACjC,OAAO,CAAC,IAAI,CAAC,CAAC;CAClB;AAED;;;;GAIG;AACH,qBAAa,2BAA4B,YAAW,eAAe;IAKrD,OAAO,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AAC;CAClB;AAED;;GAEG;AACH,qBAAa,2BAA4B,YAAW,eAAe;IAKrD,OAAO,CAAC,QAAQ,CAAC,UAAU;IAJvC;;;OAGG;gBAC0B,UAAU,SAAsB;IAE7D;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,CAAC,eAAe,EAAE,UAAU,CAAC,EAAE,CAAC;IAIjE;;;;OAIG;IACG,GAAG,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAMrE;;;;;OAKG;IACG,GAAG,CACP,QAAQ,EAAE,eAAe,EACzB,UAAU,EAAE,UAAU,GAAG,SAAS,GACjC,OAAO,CAAC,IAAI,CAAC;CAoBjB"}
@@ -1,45 +1,43 @@
1
1
  /**
2
- * Checks if two AccountSelectors are equal.
3
- * @param {AccountSelector} a - The first account selector.
4
- * @param {AccountSelector} b - The second account selector.
5
- * @returns {boolean} True if the selectors are equal, false otherwise.
2
+ * Checks if a AccountSelector matches the filter
3
+ * @param a - The first account selector.
4
+ * @param filter - The account selector filter.
5
+ * @returns True if the selector matches the filter
6
6
  */
7
7
  export function isSelectorMatch(a, filter) {
8
8
  return a.uri === filter.uri && a.addressType.startsWith(filter.addressType);
9
9
  }
10
10
  /**
11
11
  * Class representing a local storage-based repository for managing connections.
12
- * @class
13
- * @implements {ConnectionsRepo}
14
12
  */
15
13
  export class ConnectionsRepoLocalStorage {
16
14
  /**
17
15
  * Creates an instance of ConnectionsRepoLocalStorage.
18
- * @param {string} [storageKey="ccc-joy-id-signer"] - The local storage key.
16
+ * @param [storageKey="ccc-joy-id-signer"] - The local storage key.
19
17
  */
20
18
  constructor(storageKey = "ccc-joy-id-signer") {
21
19
  this.storageKey = storageKey;
22
20
  }
23
21
  /**
24
22
  * Reads all connections from local storage.
25
- * @returns {Promise<[AccountSelector, Connection][]>} A promise that resolves to an array of selectors and connections.
23
+ * @returns A promise that resolves to an array of selectors and connections.
26
24
  */
27
25
  async readConnections() {
28
26
  return JSON.parse(window.localStorage.getItem(this.storageKey) ?? "[]");
29
27
  }
30
28
  /**
31
29
  * Gets a connection for the given selector.
32
- * @param {AccountSelector} selector - The account selector.
33
- * @returns {Promise<Connection | undefined>} A promise that resolves to the connection, if found.
30
+ * @param selector - The account selector.
31
+ * @returns A promise that resolves to the connection, if found.
34
32
  */
35
33
  async get(selector) {
36
34
  return (await this.readConnections()).find(([s]) => isSelectorMatch(selector, s))?.[1];
37
35
  }
38
36
  /**
39
37
  * Sets a connection for the given selector.
40
- * @param {AccountSelector} selector - The account selector.
41
- * @param {Connection | undefined} connection - The connection to set.
42
- * @returns {Promise<void>}
38
+ * @param selector - The account selector.
39
+ * @param connection - The connection to set.
40
+ * @returns
43
41
  */
44
42
  async set(selector, connection) {
45
43
  const connections = await this.readConnections();
@@ -1,9 +1,8 @@
1
1
  import { ccc } from "@ckb-ccc/core";
2
2
  import { ConnectionsRepo } from "../connectionsStorage/index.js";
3
3
  /**
4
- * Class representing an EVM signer that extends SignerEvm from @ckb-ccc/core.
5
- * @class
6
- * @extends {ccc.SignerEvm}
4
+ * Class representing an EVM signer that extends SignerEvm
5
+ * @public
7
6
  */
8
7
  export declare class EvmSigner extends ccc.SignerEvm {
9
8
  private readonly name;
@@ -13,9 +12,8 @@ export declare class EvmSigner extends ccc.SignerEvm {
13
12
  private connection?;
14
13
  /**
15
14
  * Ensures that the signer is connected and returns the connection.
16
- * @private
17
15
  * @throws Will throw an error if not connected.
18
- * @returns {Connection} The current connection.
16
+ * @returns The current connection.
19
17
  */
20
18
  private assertConnection;
21
19
  /**
@@ -23,14 +21,13 @@ export declare class EvmSigner extends ccc.SignerEvm {
23
21
  * @param client - The client instance.
24
22
  * @param name - The name of the signer.
25
23
  * @param icon - The icon URL of the signer.
26
- * @param appUri - The application URI.
24
+ * @param _appUri - The application URI.
27
25
  * @param connectionsRepo - The connections repository.
28
26
  */
29
27
  constructor(client: ccc.Client, name: string, icon: string, _appUri?: string | undefined, connectionsRepo?: ConnectionsRepo);
30
28
  /**
31
29
  * Gets the configuration for JoyID.
32
- * @private
33
- * @returns {object} The configuration object.
30
+ * @returns The configuration object.
34
31
  */
35
32
  private getConfig;
36
33
  /**
@@ -40,31 +37,29 @@ export declare class EvmSigner extends ccc.SignerEvm {
40
37
  getEvmAccount(): Promise<ccc.Hex>;
41
38
  /**
42
39
  * Connects to the provider by requesting authentication.
43
- * @returns {Promise<void>} A promise that resolves when the connection is established.
40
+ * @returns A promise that resolves when the connection is established.
44
41
  */
45
42
  connect(): Promise<void>;
46
43
  disconnect(): Promise<void>;
47
44
  /**
48
45
  * Checks if the signer is connected.
49
- * @returns {Promise<boolean>} A promise that resolves to true if connected, false otherwise.
46
+ * @returns A promise that resolves to true if connected, false otherwise.
50
47
  */
51
48
  isConnected(): Promise<boolean>;
52
49
  /**
53
50
  * Signs a raw message with the EVM account.
54
- * @param {string | ccc.BytesLike} message - The message to sign.
55
- * @returns {Promise<ccc.Hex>} A promise that resolves to the signed message.
51
+ * @param message - The message to sign.
52
+ * @returns A promise that resolves to the signed message.
56
53
  */
57
54
  signMessageRaw(message: string | ccc.BytesLike): Promise<ccc.Hex>;
58
55
  /**
59
56
  * Saves the current connection.
60
- * @private
61
- * @returns {Promise<void>}
57
+ * @returns
62
58
  */
63
59
  private saveConnection;
64
60
  /**
65
61
  * Restores the previous connection.
66
- * @private
67
- * @returns {Promise<void>}
62
+ * @returns
68
63
  */
69
64
  private restoreConnection;
70
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/evm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AAExC;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,GAAG,CAAC,SAAS;IA2BxC,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC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;OAOG;gBAED,MAAM,EAAE,GAAG,CAAC,MAAM,EACD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,oBAAQ,EAChB,eAAe,GAAE,eAAmD;IAKvF;;;OAGG;IACH,OAAO,CAAC,SAAS;IAajB;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IAIvC;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBxB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAOjC;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAQrC;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IAuBvE;;;OAGG;YACW,cAAc;IAU5B;;;OAGG;YACW,iBAAiB;CAMhC"}
package/dist/evm/index.js CHANGED
@@ -3,16 +3,14 @@ import { DappRequestType, buildJoyIDURL } from "@joyid/common";
3
3
  import { createPopup } from "../common/index.js";
4
4
  import { ConnectionsRepoLocalStorage, } from "../connectionsStorage/index.js";
5
5
  /**
6
- * Class representing an EVM signer that extends SignerEvm from @ckb-ccc/core.
7
- * @class
8
- * @extends {ccc.SignerEvm}
6
+ * Class representing an EVM signer that extends SignerEvm
7
+ * @public
9
8
  */
10
9
  export class EvmSigner extends ccc.SignerEvm {
11
10
  /**
12
11
  * Ensures that the signer is connected and returns the connection.
13
- * @private
14
12
  * @throws Will throw an error if not connected.
15
- * @returns {Connection} The current connection.
13
+ * @returns The current connection.
16
14
  */
17
15
  assertConnection() {
18
16
  if (!this.isConnected() || !this.connection) {
@@ -25,7 +23,7 @@ export class EvmSigner extends ccc.SignerEvm {
25
23
  * @param client - The client instance.
26
24
  * @param name - The name of the signer.
27
25
  * @param icon - The icon URL of the signer.
28
- * @param appUri - The application URI.
26
+ * @param _appUri - The application URI.
29
27
  * @param connectionsRepo - The connections repository.
30
28
  */
31
29
  constructor(client, name, icon, _appUri, connectionsRepo = new ConnectionsRepoLocalStorage()) {
@@ -37,8 +35,7 @@ export class EvmSigner extends ccc.SignerEvm {
37
35
  }
38
36
  /**
39
37
  * Gets the configuration for JoyID.
40
- * @private
41
- * @returns {object} The configuration object.
38
+ * @returns The configuration object.
42
39
  */
43
40
  getConfig() {
44
41
  return {
@@ -60,7 +57,7 @@ export class EvmSigner extends ccc.SignerEvm {
60
57
  }
61
58
  /**
62
59
  * Connects to the provider by requesting authentication.
63
- * @returns {Promise<void>} A promise that resolves when the connection is established.
60
+ * @returns A promise that resolves when the connection is established.
64
61
  */
65
62
  async connect() {
66
63
  const config = this.getConfig();
@@ -82,7 +79,7 @@ export class EvmSigner extends ccc.SignerEvm {
82
79
  }
83
80
  /**
84
81
  * Checks if the signer is connected.
85
- * @returns {Promise<boolean>} A promise that resolves to true if connected, false otherwise.
82
+ * @returns A promise that resolves to true if connected, false otherwise.
86
83
  */
87
84
  async isConnected() {
88
85
  if (this.connection) {
@@ -93,8 +90,8 @@ export class EvmSigner extends ccc.SignerEvm {
93
90
  }
94
91
  /**
95
92
  * Signs a raw message with the EVM account.
96
- * @param {string | ccc.BytesLike} message - The message to sign.
97
- * @returns {Promise<ccc.Hex>} A promise that resolves to the signed message.
93
+ * @param message - The message to sign.
94
+ * @returns A promise that resolves to the signed message.
98
95
  */
99
96
  async signMessageRaw(message) {
100
97
  const { address } = this.assertConnection();
@@ -110,8 +107,7 @@ export class EvmSigner extends ccc.SignerEvm {
110
107
  }
111
108
  /**
112
109
  * Saves the current connection.
113
- * @private
114
- * @returns {Promise<void>}
110
+ * @returns
115
111
  */
116
112
  async saveConnection() {
117
113
  return this.connectionsRepo.set({
@@ -121,8 +117,7 @@ export class EvmSigner extends ccc.SignerEvm {
121
117
  }
122
118
  /**
123
119
  * Restores the previous connection.
124
- * @private
125
- * @returns {Promise<void>}
120
+ * @returns
126
121
  */
127
122
  async restoreConnection() {
128
123
  this.connection = await this.connectionsRepo.get({
@@ -1,9 +1,8 @@
1
1
  import { ccc } from "@ckb-ccc/core";
2
2
  import { ConnectionsRepo } from "../connectionsStorage/index.js";
3
3
  /**
4
- * Class representing a Nostr signer that extends SignerNostr from @ckb-ccc/core.
5
- * @class
6
- * @extends {ccc.SignerNostr}
4
+ * Class representing a Nostr signer that extends SignerNostr
5
+ * @public
7
6
  */
8
7
  export declare class NostrSigner extends ccc.SignerNostr {
9
8
  private readonly name;
@@ -13,9 +12,8 @@ export declare class NostrSigner extends ccc.SignerNostr {
13
12
  private connection?;
14
13
  /**
15
14
  * Ensures that the signer is connected and returns the connection.
16
- * @private
17
15
  * @throws Will throw an error if not connected.
18
- * @returns {Connection} The current connection.
16
+ * @returns The current connection.
19
17
  */
20
18
  private assertConnection;
21
19
  /**
@@ -23,39 +21,36 @@ export declare class NostrSigner extends ccc.SignerNostr {
23
21
  * @param client - The client instance.
24
22
  * @param name - The name of the signer.
25
23
  * @param icon - The icon URL of the signer.
26
- * @param appUri - The application URI.
24
+ * @param _appUri - The application URI.
27
25
  * @param connectionsRepo - The connections repository.
28
26
  */
29
27
  constructor(client: ccc.Client, name: string, icon: string, _appUri?: string | undefined, connectionsRepo?: ConnectionsRepo);
30
28
  /**
31
29
  * Gets the configuration for JoyID.
32
- * @private
33
- * @returns {object} The configuration object.
30
+ * @returns The configuration object.
34
31
  */
35
32
  private getConfig;
36
33
  /**
37
34
  * Connects to the provider by requesting authentication.
38
- * @returns {Promise<void>} A promise that resolves when the connection is established.
35
+ * @returns A promise that resolves when the connection is established.
39
36
  */
40
37
  connect(): Promise<void>;
41
38
  disconnect(): Promise<void>;
42
39
  /**
43
40
  * Checks if the signer is connected.
44
- * @returns {Promise<boolean>} A promise that resolves to true if connected, false otherwise.
41
+ * @returns A promise that resolves to true if connected, false otherwise.
45
42
  */
46
43
  isConnected(): Promise<boolean>;
47
44
  getNostrPublicKey(): Promise<ccc.Hex>;
48
45
  signNostrEvent(event: ccc.NostrEvent): Promise<Required<ccc.NostrEvent>>;
49
46
  /**
50
47
  * Saves the current connection.
51
- * @private
52
- * @returns {Promise<void>}
48
+ * @returns
53
49
  */
54
50
  private saveConnection;
55
51
  /**
56
52
  * Restores the previous connection.
57
- * @private
58
- * @returns {Promise<void>}
53
+ * @returns
59
54
  */
60
55
  private restoreConnection;
61
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/nostr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AAExC;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,GAAG,CAAC,WAAW;IA2B5C,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,eAAe;IA7BlC,OAAO,CAAC,UAAU,CAAC,CAAa;IAEhC;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAQxB;;;;;;;OAOG;gBAED,MAAM,EAAE,GAAG,CAAC,MAAM,EACD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,oBAAQ,EAChB,eAAe,GAAE,eAAmD;IAKvF;;;;OAIG;IACH,OAAO,CAAC,SAAS;IAajB;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAexB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAOjC;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAS/B,iBAAiB,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IAIrC,cAAc,CAClB,KAAK,EAAE,GAAG,CAAC,UAAU,GACpB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAYpC;;;;OAIG;YACW,cAAc;IAU5B;;;;OAIG;YACW,iBAAiB;CAMhC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/nostr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AAExC;;;GAGG;AACH,qBAAa,WAAY,SAAQ,GAAG,CAAC,WAAW;IA0B5C,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,eAAe;IA5BlC,OAAO,CAAC,UAAU,CAAC,CAAa;IAEhC;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAQxB;;;;;;;OAOG;gBAED,MAAM,EAAE,GAAG,CAAC,MAAM,EACD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,oBAAQ,EAChB,eAAe,GAAE,eAAmD;IAKvF;;;OAGG;IACH,OAAO,CAAC,SAAS;IAajB;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAexB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAOjC;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAS/B,iBAAiB,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IAIrC,cAAc,CAClB,KAAK,EAAE,GAAG,CAAC,UAAU,GACpB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAYpC;;;OAGG;YACW,cAAc;IAU5B;;;OAGG;YACW,iBAAiB;CAMhC"}
@@ -3,16 +3,14 @@ import { DappRequestType, buildJoyIDURL } from "@joyid/common";
3
3
  import { createPopup } from "../common/index.js";
4
4
  import { ConnectionsRepoLocalStorage, } from "../connectionsStorage/index.js";
5
5
  /**
6
- * Class representing a Nostr signer that extends SignerNostr from @ckb-ccc/core.
7
- * @class
8
- * @extends {ccc.SignerNostr}
6
+ * Class representing a Nostr signer that extends SignerNostr
7
+ * @public
9
8
  */
10
9
  export class NostrSigner extends ccc.SignerNostr {
11
10
  /**
12
11
  * Ensures that the signer is connected and returns the connection.
13
- * @private
14
12
  * @throws Will throw an error if not connected.
15
- * @returns {Connection} The current connection.
13
+ * @returns The current connection.
16
14
  */
17
15
  assertConnection() {
18
16
  if (!this.isConnected() || !this.connection) {
@@ -25,7 +23,7 @@ export class NostrSigner extends ccc.SignerNostr {
25
23
  * @param client - The client instance.
26
24
  * @param name - The name of the signer.
27
25
  * @param icon - The icon URL of the signer.
28
- * @param appUri - The application URI.
26
+ * @param _appUri - The application URI.
29
27
  * @param connectionsRepo - The connections repository.
30
28
  */
31
29
  constructor(client, name, icon, _appUri, connectionsRepo = new ConnectionsRepoLocalStorage()) {
@@ -37,8 +35,7 @@ export class NostrSigner extends ccc.SignerNostr {
37
35
  }
38
36
  /**
39
37
  * Gets the configuration for JoyID.
40
- * @private
41
- * @returns {object} The configuration object.
38
+ * @returns The configuration object.
42
39
  */
43
40
  getConfig() {
44
41
  return {
@@ -53,7 +50,7 @@ export class NostrSigner extends ccc.SignerNostr {
53
50
  }
54
51
  /**
55
52
  * Connects to the provider by requesting authentication.
56
- * @returns {Promise<void>} A promise that resolves when the connection is established.
53
+ * @returns A promise that resolves when the connection is established.
57
54
  */
58
55
  async connect() {
59
56
  const config = this.getConfig();
@@ -75,7 +72,7 @@ export class NostrSigner extends ccc.SignerNostr {
75
72
  }
76
73
  /**
77
74
  * Checks if the signer is connected.
78
- * @returns {Promise<boolean>} A promise that resolves to true if connected, false otherwise.
75
+ * @returns A promise that resolves to true if connected, false otherwise.
79
76
  */
80
77
  async isConnected() {
81
78
  if (this.connection) {
@@ -97,8 +94,7 @@ export class NostrSigner extends ccc.SignerNostr {
97
94
  }
98
95
  /**
99
96
  * Saves the current connection.
100
- * @private
101
- * @returns {Promise<void>}
97
+ * @returns
102
98
  */
103
99
  async saveConnection() {
104
100
  return this.connectionsRepo.set({
@@ -108,8 +104,7 @@ export class NostrSigner extends ccc.SignerNostr {
108
104
  }
109
105
  /**
110
106
  * Restores the previous connection.
111
- * @private
112
- * @returns {Promise<void>}
107
+ * @returns
113
108
  */
114
109
  async restoreConnection() {
115
110
  this.connection = await this.connectionsRepo.get({
@@ -3,10 +3,12 @@ import { ccc } from "@ckb-ccc/core";
3
3
  * Gets the JoyID signers based on the client, name, and icon.
4
4
  * If the browser is standalone or a webview, returns SignerAlwaysError instances.
5
5
  * Otherwise, returns instances of CkbSigner, BitcoinSigner, and EvmSigner.
6
- * @param {ccc.Client} client - The client instance.
7
- * @param {string} name - The name of the signer.
8
- * @param {string} icon - The icon URL of the signer.
9
- * @returns {ccc.SignerInfo[]} An array of signer information objects.
6
+ * @public
7
+ *
8
+ * @param client - The client instance.
9
+ * @param name - The name of the signer.
10
+ * @param icon - The icon URL of the signer.
11
+ * @returns An array of signer information objects.
10
12
  */
11
13
  export declare function getJoyIdSigners(client: ccc.Client, name: string, icon: string, preferredNetworks?: ccc.NetworkPreference[]): ccc.SignerInfo[];
12
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/signerFactory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAOpC;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,iBAAiB,CAAC,EAAE,GAAG,CAAC,iBAAiB,EAAE,GAC1C,GAAG,CAAC,UAAU,EAAE,CA8ClB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/signerFactory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAOpC;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,iBAAiB,CAAC,EAAE,GAAG,CAAC,iBAAiB,EAAE,GAC1C,GAAG,CAAC,UAAU,EAAE,CA8ClB"}
@@ -8,10 +8,12 @@ import { NostrSigner } from "../nostr/index.js";
8
8
  * Gets the JoyID signers based on the client, name, and icon.
9
9
  * If the browser is standalone or a webview, returns SignerAlwaysError instances.
10
10
  * Otherwise, returns instances of CkbSigner, BitcoinSigner, and EvmSigner.
11
- * @param {ccc.Client} client - The client instance.
12
- * @param {string} name - The name of the signer.
13
- * @param {string} icon - The icon URL of the signer.
14
- * @returns {ccc.SignerInfo[]} An array of signer information objects.
11
+ * @public
12
+ *
13
+ * @param client - The client instance.
14
+ * @param name - The name of the signer.
15
+ * @param icon - The icon URL of the signer.
16
+ * @returns An array of signer information objects.
15
17
  */
16
18
  export function getJoyIdSigners(client, name, icon, preferredNetworks) {
17
19
  if (isStandaloneBrowser() || ccc.isWebview(window.navigator.userAgent)) {
@@ -1,9 +1,8 @@
1
1
  import { ccc } from "@ckb-ccc/core";
2
2
  import { ConnectionsRepo } from "../connectionsStorage/index.js";
3
3
  /**
4
- * Class representing a Bitcoin signer that extends SignerBtc from @ckb-ccc/core.
5
- * @class
6
- * @extends {ccc.SignerBtc}
4
+ * Class representing a Bitcoin signer that extends SignerBtc
5
+ * @public
7
6
  */
8
7
  export declare class BitcoinSigner extends ccc.SignerBtc {
9
8
  readonly name: string;
@@ -16,9 +15,8 @@ export declare class BitcoinSigner extends ccc.SignerBtc {
16
15
  private network;
17
16
  /**
18
17
  * Ensures that the signer is connected and returns the connection.
19
- * @private
20
18
  * @throws Will throw an error if not connected.
21
- * @returns {Connection} The current connection.
19
+ * @returns The current connection.
22
20
  */
23
21
  private assertConnection;
24
22
  /**
@@ -33,35 +31,34 @@ export declare class BitcoinSigner extends ccc.SignerBtc {
33
31
  constructor(client: ccc.Client, name: string, icon: string, preferredNetworks?: ccc.NetworkPreference[], addressType?: "auto" | "p2wpkh" | "p2tr", _appUri?: string | undefined, connectionsRepo?: ConnectionsRepo);
34
32
  /**
35
33
  * Gets the configuration for JoyID.
36
- * @private
37
34
  * @returns The configuration object.
38
35
  */
39
36
  private getConfig;
40
37
  disconnect(): Promise<void>;
41
38
  /**
42
39
  * Gets the Bitcoin account address.
43
- * @returns {Promise<string>} A promise that resolves to the Bitcoin account address.
40
+ * @returns A promise that resolves to the Bitcoin account address.
44
41
  */
45
42
  getBtcAccount(): Promise<string>;
46
43
  /**
47
44
  * Gets the Bitcoin public key.
48
- * @returns {Promise<ccc.Hex>} A promise that resolves to the Bitcoin public key.
45
+ * @returns A promise that resolves to the Bitcoin public key.
49
46
  */
50
47
  getBtcPublicKey(): Promise<ccc.Hex>;
51
48
  /**
52
49
  * Connects to the provider by requesting authentication.
53
- * @returns {Promise<void>} A promise that resolves when the connection is established.
50
+ * @returns A promise that resolves when the connection is established.
54
51
  */
55
52
  connect(): Promise<void>;
56
53
  /**
57
54
  * Checks if the signer is connected.
58
- * @returns {Promise<boolean>} A promise that resolves to true if connected, false otherwise.
55
+ * @returns A promise that resolves to true if connected, false otherwise.
59
56
  */
60
57
  isConnected(): Promise<boolean>;
61
58
  /**
62
59
  * Signs a raw message with the Bitcoin account.
63
- * @param {string | ccc.BytesLike} message - The message to sign.
64
- * @returns {Promise<string>} A promise that resolves to the signed message.
60
+ * @param message - The message to sign.
61
+ * @returns A promise that resolves to the signed message.
65
62
  */
66
63
  signMessageRaw(message: string | ccc.BytesLike): Promise<string>;
67
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/btc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EAEL,eAAe,EAEhB,MAAM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