applesauce-accounts 0.0.0-next-20250124224517 → 0.0.0-next-20250124224944
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/dist/manager.d.ts +5 -1
- package/dist/manager.js +8 -0
- package/package.json +2 -2
package/dist/manager.d.ts
CHANGED
|
@@ -10,7 +10,11 @@ export declare class AccountManager<Metadata extends unknown = any> {
|
|
|
10
10
|
/** Remove account type */
|
|
11
11
|
unregisterType(type: string): void;
|
|
12
12
|
/** gets an account in the manager */
|
|
13
|
-
getAccount<
|
|
13
|
+
getAccount<Signer extends Nip07Interface>(id: string | IAccount<Signer, any, Metadata>): IAccount<Signer, any, Metadata> | undefined;
|
|
14
|
+
/** Return the first account for a pubkey */
|
|
15
|
+
getAccountForPubkey(pubkey: string): IAccount<any, any, Metadata> | undefined;
|
|
16
|
+
/** Returns all accounts for a pubkey */
|
|
17
|
+
getAccountsForPubkey(pubkey: string): IAccount<any, any, Metadata>[];
|
|
14
18
|
/** adds an account to the manager */
|
|
15
19
|
addAccount(account: IAccount<any, any, Metadata>): void;
|
|
16
20
|
/** Removes an account from the manager */
|
package/dist/manager.js
CHANGED
|
@@ -26,6 +26,14 @@ export class AccountManager {
|
|
|
26
26
|
else
|
|
27
27
|
return undefined;
|
|
28
28
|
}
|
|
29
|
+
/** Return the first account for a pubkey */
|
|
30
|
+
getAccountForPubkey(pubkey) {
|
|
31
|
+
return Object.values(this.accounts.value).find((account) => account.pubkey === pubkey);
|
|
32
|
+
}
|
|
33
|
+
/** Returns all accounts for a pubkey */
|
|
34
|
+
getAccountsForPubkey(pubkey) {
|
|
35
|
+
return Object.values(this.accounts.value).filter((account) => account.pubkey === pubkey);
|
|
36
|
+
}
|
|
29
37
|
/** adds an account to the manager */
|
|
30
38
|
addAccount(account) {
|
|
31
39
|
if (this.getAccount(account.id))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "applesauce-accounts",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20250124224944",
|
|
4
4
|
"description": "A simple nostr account management system",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@noble/hashes": "^1.5.0",
|
|
35
|
-
"applesauce-signer": "0.0.0-next-
|
|
35
|
+
"applesauce-signer": "0.0.0-next-20250124224944",
|
|
36
36
|
"nanoid": "^5.0.9",
|
|
37
37
|
"nostr-tools": "^2.10.3",
|
|
38
38
|
"rxjs": "^7.8.1"
|