diff options
| author | Adam Soltys <[email protected]> | 2025-01-14 16:55:44 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-01-14 16:55:44 -0800 |
| commit | 81a576c2007805849f963242bc93ef60bee8efa4 (patch) | |
| tree | cfb4e4f62f749b658271d91f03d819ed698b1da3 /lib/utils.ts | |
| parent | 0a8a8988d27d26feec689a28447eed85c1069584 (diff) | |
| download | coinos-server-81a576c2007805849f963242bc93ef60bee8efa4.tar.gz coinos-server-81a576c2007805849f963242bc93ef60bee8efa4.zip | |
public fields
Diffstat (limited to 'lib/utils.ts')
| -rw-r--r-- | lib/utils.ts | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/lib/utils.ts b/lib/utils.ts index 9cb6a690..fc0ee176 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -51,25 +51,7 @@ export const bip21 = (address, { amount, memo, tip, type }) => { return `${network}:${address}?${url.toString()}`; }; -export const fields = [ - "pubkey", - "password", - "username", - "currency", - "currencies", - "fiat", - "otpsecret", - "balance", - "ip", - "pin", - "display", - "haspin", - "profile", - "prompt", - "banner", -]; - -export const getUser = async (username, fields = whitelist) => { +export const getUser = async (username, fields) => { let update; if (username === "undefined") fail("invalid user"); const user = await migrate(username); @@ -97,7 +79,7 @@ export const getUser = async (username, fields = whitelist) => { if (update) s(`user:${user.id}`, user); - return user; + return fields ? pick(user, fields) : user; }; export const getInvoice = async (hash) => { @@ -208,7 +190,7 @@ export const fmt = (sats) => export const link = (id) => `${URL}/payment/${id}`; -export const publicFields = [ +export const fields = [ "about", "anon", "banner", |
