@talismn/keyring 0.0.0-pr2277-20251211070508 → 0.0.0-pr2295-20260110031023

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talismn/keyring",
3
- "version": "0.0.0-pr2277-20251211070508",
3
+ "version": "0.0.0-pr2295-20260110031023",
4
4
  "author": "Talisman",
5
5
  "homepage": "https://talisman.xyz",
6
6
  "license": "GPL-3.0-or-later",
@@ -12,16 +12,16 @@
12
12
  "type": "git",
13
13
  "url": "https://github.com/talismansociety/talisman.git"
14
14
  },
15
- "main": "dist/talismn-keyring.cjs.js",
16
- "module": "dist/talismn-keyring.esm.js",
15
+ "main": "./dist/index.js",
16
+ "module": "./dist/index.mjs",
17
17
  "files": [
18
- "/dist"
18
+ "dist"
19
19
  ],
20
20
  "engines": {
21
21
  "node": ">=20"
22
22
  },
23
23
  "dependencies": {
24
- "@talismn/crypto": "0.0.0-pr2277-20251211070508"
24
+ "@talismn/crypto": "0.0.0-pr2295-20260110031023"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/jest": "^29.5.14",
@@ -31,7 +31,7 @@
31
31
  "jest-fixed-jsdom": "^0.0.9",
32
32
  "ts-jest": "^29.2.5",
33
33
  "typescript": "^5.6.3",
34
- "@talismn/eslint-config": "0.0.3",
34
+ "@talismn/eslint-config": "0.0.0-pr2295-20260110031023",
35
35
  "@talismn/tsconfig": "0.0.3"
36
36
  },
37
37
  "preconstruct": {
@@ -45,9 +45,23 @@
45
45
  "@talismn/eslint-config/base"
46
46
  ]
47
47
  },
48
+ "types": "./dist/index.d.ts",
49
+ "exports": {
50
+ ".": {
51
+ "import": {
52
+ "types": "./dist/index.d.mts",
53
+ "default": "./dist/index.mjs"
54
+ },
55
+ "require": {
56
+ "types": "./dist/index.d.ts",
57
+ "default": "./dist/index.js"
58
+ }
59
+ }
60
+ },
48
61
  "scripts": {
49
62
  "test": "jest",
50
63
  "lint": "eslint src --max-warnings 0",
51
- "clean": "rm -rf dist .turbo node_modules"
64
+ "clean": "rm -rf dist .turbo node_modules",
65
+ "build": "tsup"
52
66
  }
53
67
  }
@@ -1,2 +0,0 @@
1
- export * from "./types";
2
- export * from "./keyring";
@@ -1,44 +0,0 @@
1
- import { KeypairCurve } from "@talismn/crypto";
2
- import type { Account, Mnemonic } from "../types";
3
- import type { AddAccountDeriveOptions, AddAccountExternalOptions, AddAccountKeypairOptions, AddMnemonicOptions, UpdateAccountOptions, UpdateMnemonicOptions } from "../types/keyring";
4
- import type { AccountStorage, MnemonicStorage } from "./types";
5
- export type KeyringStorage = {
6
- passwordCheck: string | null;
7
- mnemonics: MnemonicStorage[];
8
- accounts: AccountStorage[];
9
- };
10
- export declare class Keyring {
11
- #private;
12
- protected constructor(data: KeyringStorage);
13
- static create(): Keyring;
14
- static load(data: KeyringStorage): Keyring;
15
- private checkPassword;
16
- toJson(): KeyringStorage;
17
- export(password: string, jsonPassword: string): Promise<KeyringStorage>;
18
- getMnemonics(): Mnemonic[];
19
- addMnemonic({ name, mnemonic, confirmed }: AddMnemonicOptions, password: string): Promise<Mnemonic>;
20
- getMnemonic(id: string): Mnemonic | null;
21
- updateMnemonic(id: string, { name, confirmed }: UpdateMnemonicOptions): Mnemonic;
22
- removeMnemonic(id: string): void;
23
- getMnemonicText(id: string, password: string): Promise<string>;
24
- getExistingMnemonicId(mnemonic: string): string | null;
25
- getAccounts(): Account[];
26
- getAccount(address: string): Account | null;
27
- updateAccount(address: string, { name, isPortfolio, genesisHash }: UpdateAccountOptions): Account;
28
- removeAccount(address: string): void;
29
- addAccountExternal(options: AddAccountExternalOptions): Account;
30
- /**
31
- * Needs to be called before deriving an account from a mnemonic.
32
- *
33
- * This will ensure that it is present (or add it if possible) in the keyring before actually creating the account.
34
- *
35
- * @param options
36
- * @param password
37
- * @returns the id of the mnemonic
38
- */
39
- private ensureMnemonic;
40
- addAccountDerive(options: AddAccountDeriveOptions, password: string): Promise<Account>;
41
- addAccountKeypair({ curve, name, secretKey }: AddAccountKeypairOptions, password: string): Promise<Account>;
42
- getAccountSecretKey(address: string, password: string): Promise<Uint8Array>;
43
- getDerivedAddress(mnemonicId: string, derivationPath: string, curve: KeypairCurve, password: string): Promise<string>;
44
- }
@@ -1,3 +0,0 @@
1
- export declare const encryptData: (data: Uint8Array, password: string) => Promise<string>;
2
- export declare const decryptData: (encryptedData: string, password: string) => Promise<Uint8Array>;
3
- export declare const changeEncryptedDataPassword: (encryptedData: string, oldPassword: string, newPassword: string) => Promise<string>;
@@ -1 +0,0 @@
1
- export * from "./Keyring";
@@ -1,9 +0,0 @@
1
- import type { AccountContact, AccountKeypair, AccountLedgerEthereum, AccountLedgerPolkadot, AccountLedgerSolana, AccountPolkadotVault, AccountSignet, AccountWatchOnly } from "../types/account";
2
- import type { Mnemonic } from "../types/mnemonic";
3
- export type MnemonicStorage = Mnemonic & {
4
- entropy: string;
5
- };
6
- export type AccountKeypairStorage = AccountKeypair & {
7
- secretKey: string;
8
- };
9
- export type AccountStorage = AccountKeypairStorage | AccountContact | AccountWatchOnly | AccountLedgerEthereum | AccountLedgerPolkadot | AccountLedgerSolana | AccountPolkadotVault | AccountSignet;
@@ -1,4 +0,0 @@
1
- type HexString = `0x${string}`;
2
- export declare const REGEX_HEX_STRING: RegExp;
3
- export declare const isHexString: (value: unknown) => value is HexString;
4
- export {};
@@ -1,48 +0,0 @@
1
- import type { KeypairCurve } from "@talismn/crypto";
2
- export type LedgerPolkadotCurve = "ed25519" | "ethereum";
3
- export type AccountBase = {
4
- address: string;
5
- name: string;
6
- createdAt: number;
7
- };
8
- export type AccountKeypair = AccountBase & {
9
- type: "keypair";
10
- curve: KeypairCurve;
11
- mnemonicId?: string;
12
- derivationPath?: string;
13
- };
14
- export type AccountContact = AccountBase & {
15
- type: "contact";
16
- genesisHash?: `0x${string}`;
17
- };
18
- export type AccountWatchOnly = AccountBase & {
19
- type: "watch-only";
20
- isPortfolio: boolean;
21
- };
22
- export type AccountLedgerPolkadot = AccountBase & {
23
- type: "ledger-polkadot";
24
- curve: LedgerPolkadotCurve;
25
- app: string;
26
- accountIndex: number;
27
- addressOffset: number;
28
- genesisHash?: `0x${string}`;
29
- };
30
- export type AccountLedgerEthereum = AccountBase & {
31
- type: "ledger-ethereum";
32
- derivationPath: string;
33
- };
34
- export type AccountLedgerSolana = AccountBase & {
35
- type: "ledger-solana";
36
- derivationPath: string;
37
- };
38
- export type AccountPolkadotVault = AccountBase & {
39
- type: "polkadot-vault";
40
- genesisHash: `0x${string}` | null;
41
- };
42
- export type AccountSignet = AccountBase & {
43
- type: "signet";
44
- genesisHash: `0x${string}`;
45
- url: string;
46
- };
47
- export type Account = AccountKeypair | AccountContact | AccountWatchOnly | AccountLedgerEthereum | AccountLedgerPolkadot | AccountLedgerSolana | AccountPolkadotVault | AccountSignet;
48
- export type AccountType = Account["type"];
@@ -1,4 +0,0 @@
1
- export * from "./mnemonic";
2
- export * from "./account";
3
- export * from "./utils";
4
- export * from "./keyring";
@@ -1,38 +0,0 @@
1
- import type { KeypairCurve } from "@talismn/crypto";
2
- import type { AccountBase, AccountContact, AccountLedgerEthereum, AccountLedgerPolkadot, AccountLedgerSolana, AccountPolkadotVault, AccountSignet, AccountWatchOnly } from "./account";
3
- export type AddMnemonicOptions = {
4
- mnemonic: string;
5
- name: string;
6
- confirmed: boolean;
7
- };
8
- export type UpdateMnemonicOptions = {
9
- name?: string;
10
- confirmed?: boolean;
11
- };
12
- type DeriveFromNewMnemonic = {
13
- type: "new-mnemonic";
14
- mnemonic: string;
15
- mnemonicName: string;
16
- confirmed: boolean;
17
- curve: KeypairCurve;
18
- derivationPath: string;
19
- };
20
- type DeriveFromExistingMnemonic = {
21
- type: "existing-mnemonic";
22
- mnemonicId: string;
23
- curve: KeypairCurve;
24
- derivationPath: string;
25
- };
26
- type DeriveFromMnemonicOptions = DeriveFromNewMnemonic | DeriveFromExistingMnemonic;
27
- export type AddAccountDeriveOptions = Omit<AccountBase, "createdAt" | "address"> & DeriveFromMnemonicOptions;
28
- export type AddAccountKeypairOptions = Omit<AccountBase, "createdAt" | "address"> & {
29
- curve: KeypairCurve;
30
- secretKey: Uint8Array;
31
- };
32
- export type AddAccountExternalOptions = Omit<AccountContact, "createdAt"> | Omit<AccountWatchOnly, "createdAt"> | Omit<AccountLedgerEthereum, "createdAt"> | Omit<AccountLedgerPolkadot, "createdAt"> | Omit<AccountLedgerSolana, "createdAt"> | Omit<AccountPolkadotVault, "createdAt"> | Omit<AccountSignet, "createdAt">;
33
- export type UpdateAccountOptions = {
34
- name?: string;
35
- isPortfolio?: boolean;
36
- genesisHash?: `0x${string}`;
37
- };
38
- export {};
@@ -1,6 +0,0 @@
1
- export type Mnemonic = {
2
- id: string;
3
- name: string;
4
- confirmed: boolean;
5
- createdAt: number;
6
- };
@@ -1,59 +0,0 @@
1
- import type { Account, AccountLedgerPolkadot, AccountType } from "./account";
2
- export type AccountOfType<Type extends AccountType> = Extract<Account, {
3
- type: Type;
4
- }>;
5
- export declare const isAccountOfType: <Type extends AccountType>(account: Account | null | undefined, type: Type) => account is AccountOfType<Type>;
6
- export declare const isAccountInTypes: <Types extends AccountType[]>(account: Account | null | undefined, types: Types) => account is AccountOfType<Types[number]>;
7
- declare const ACCOUNT_TYPES_OWNED: readonly ["keypair", "ledger-ethereum", "ledger-polkadot", "ledger-solana", "polkadot-vault"];
8
- declare const ACCOUNT_TYPES_EXTERNAL: readonly ["contact", "watch-only", "ledger-ethereum", "ledger-polkadot", "ledger-solana", "polkadot-vault", "signet"];
9
- declare const ACCOUNT_TYPES_ADDRESS_ETHEREUM: readonly ["contact", "watch-only", "keypair", "ledger-ethereum", "ledger-polkadot"];
10
- declare const ACCOUNT_TYPES_PLATFORM_ETHEREUM: readonly ["contact", "watch-only", "keypair", "ledger-ethereum"];
11
- declare const ACCOUNT_TYPES_PLATFORM_POLKADOT: readonly ["contact", "watch-only", "keypair", "ledger-polkadot", "polkadot-vault", "signet"];
12
- declare const ACCOUNT_TYPES_ADDRESS_SS58: readonly ["contact", "watch-only", "keypair", "ledger-polkadot", "polkadot-vault", "signet"];
13
- declare const ACCOUNT_TYPES_PLATFORM_SOLANA: readonly ["contact", "watch-only", "keypair", "ledger-solana"];
14
- declare const ACCOUNT_TYPES_BITCOIN: readonly ["contact", "watch-only"];
15
- export declare const isAccountExternal: (account: Account | null | undefined) => account is AccountOfType<(typeof ACCOUNT_TYPES_EXTERNAL)[number]>;
16
- export declare const isAccountOwned: (account: Account | null | undefined) => account is AccountOfType<(typeof ACCOUNT_TYPES_OWNED)[number]>;
17
- export declare const isAccountPortfolio: (account: Account | null | undefined) => account is Account;
18
- export declare const isAccountNotContact: (acc: Account) => acc is import("./account").AccountKeypair | import("./account").AccountWatchOnly | AccountLedgerPolkadot | import("./account").AccountLedgerEthereum | import("./account").AccountLedgerSolana | import("./account").AccountPolkadotVault | import("./account").AccountSignet;
19
- type AccountAddressEthereum = Extract<Account, {
20
- type: (typeof ACCOUNT_TYPES_ADDRESS_ETHEREUM)[number];
21
- }> & {
22
- address: `0x${string}`;
23
- };
24
- export declare const isAccountAddressEthereum: (account: Account | null | undefined) => account is AccountAddressEthereum;
25
- type AccountPlatformEthereum = Extract<Account, {
26
- type: (typeof ACCOUNT_TYPES_PLATFORM_ETHEREUM)[number];
27
- }> & {
28
- address: `0x${string}`;
29
- };
30
- export declare const isAccountPlatformEthereum: (account: Account | null | undefined) => account is AccountPlatformEthereum;
31
- type AccountPlatformSolana = Extract<Account, {
32
- type: (typeof ACCOUNT_TYPES_PLATFORM_SOLANA)[number];
33
- }>;
34
- export declare const isAccountPlatformSolana: (account: Account | null | undefined) => account is AccountPlatformSolana;
35
- type AccountPlatformPolkadot = Extract<Account, {
36
- type: (typeof ACCOUNT_TYPES_PLATFORM_POLKADOT)[number];
37
- }>;
38
- export declare const isAccountPlatformPolkadot: (account: Account | null | undefined) => account is AccountPlatformPolkadot;
39
- type AccountAddressSs58 = Extract<Account, {
40
- type: (typeof ACCOUNT_TYPES_ADDRESS_SS58)[number];
41
- }> & {
42
- genesisHash?: `0x${string}`;
43
- };
44
- export declare const isAccountAddressSs58: (account: Account | null | undefined) => account is AccountAddressSs58;
45
- export declare const isAccountLedgerPolkadot: (account: Account | null | undefined) => account is AccountLedgerPolkadot;
46
- export declare const isAccountLedgerPolkadotGeneric: (account: Account | null | undefined) => account is AccountLedgerPolkadot & {
47
- genesisHash: undefined;
48
- };
49
- export declare const isAccountLedgerPolkadotLegacy: (account: Account | null | undefined) => account is AccountLedgerPolkadot & {
50
- genesisHash: `0x${string}`;
51
- };
52
- type AccountBitcoin = Extract<Account, {
53
- type: (typeof ACCOUNT_TYPES_BITCOIN)[number];
54
- }>;
55
- export declare const isAccountBitcoin: (account: Account | null | undefined) => account is AccountBitcoin;
56
- export declare const getAccountGenesisHash: (account: Account | null | undefined) => `0x${string}` | undefined;
57
- export declare const getAccountSignetUrl: (account: Account | null | undefined) => string | undefined;
58
- export declare const getAccountPlatform: (account: Account | null | undefined) => import("@talismn/crypto").AccountPlatform | undefined;
59
- export {};
@@ -1 +0,0 @@
1
- export * from "./declarations/src/index";