Skip to content

Commit c0e4ec2

Browse files
dafugaaaroncox
andauthored
Adding beta web-authenticator plugin (#326)
* Implement authenticator * Fixing lockfile * Linting --------- Co-authored-by: aaroncox <[email protected]>
1 parent e30ded0 commit c0e4ec2

File tree

9 files changed

+27
-95
lines changed

9 files changed

+27
-95
lines changed

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ PUBLIC_FEATURE_ROBO=true
8383
PUBLIC_FEATURE_STAKERESOURCE=true
8484
PUBLIC_FEATURE_STAKING=true
8585
PUBLIC_FEATURE_TIMESERIES=false
86+
PUBLIC_FEATURE_WEB_AUTHENTICATOR_URL=
8687
PUBLIC_FEATURE_UNICOVE_CONTRACT_API=unicove.gm
8788
PUBLIC_FEATURE_UNICOVE_CONTRACT_API_TOKENS=
8889
PUBLIC_FEATURE_WRAM=false
@@ -93,6 +94,7 @@ PUBLIC_WALLET_IMTOKEN=false
9394
PUBLIC_WALLET_METAMASK=false
9495
PUBLIC_WALLET_SCATTER=false
9596
PUBLIC_WALLET_TOKENPOCKET=false
97+
PUBLIC_WALLET_WEB_AUTHENTICATOR=false
9698
PUBLIC_WALLET_WOMBAT=false
9799

98100
BACKEND_API_CHAIN="https://jungle4.greymass.com"

Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,6 @@ config/eos: codegen/clean
143143
config/jungle4: codegen/clean
144144
cp ./configs/.env.jungle4 .env.local
145145

146-
config/jungle4/vaulta: codegen/clean
147-
cp ./configs/.env.jungle4.vaulta .env.local
148-
149146
config/kylin: codegen/clean
150147
cp ./configs/.env.kylin .env.local
151148

bun.lock

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"@wharfkit/hyperion": "^1.0.4",
1414
"@wharfkit/resources": "^1.3.1",
1515
"@wharfkit/roborovski": "^1.1.0",
16-
"@wharfkit/session": "^1.6.0",
16+
"@wharfkit/session": "^1.7.0",
1717
"@wharfkit/transact-plugin-resource-provider": "^1.1.3",
1818
"@wharfkit/wallet-plugin-anchor": "^1.6.0",
1919
"@wharfkit/wallet-plugin-cleos": "^1.2.0",
@@ -23,6 +23,7 @@
2323
"@wharfkit/wallet-plugin-privatekey": "^1.1.0",
2424
"@wharfkit/wallet-plugin-scatter": "^1.5.1",
2525
"@wharfkit/wallet-plugin-tokenpocket": "^1.5.1",
26+
"@wharfkit/wallet-plugin-web-authenticator": "^0.3.1",
2627
"@wharfkit/wallet-plugin-wombat": "^1.5.1",
2728
"@wharfkit/web-renderer": "^1.4.1",
2829
"chart.js": "^4.4.3",
@@ -562,7 +563,7 @@
562563

563564
"@wharfkit/account-creation-plugin-metamask": ["@wharfkit/[email protected]", "", { "dependencies": { "@greymass/create-account": "^1.1.0", "@metamask/providers": "^17.0.0", "tslib": "^2.1.0" }, "peerDependencies": { "@wharfkit/session": "^1.4.0" } }, "sha512-7I/Gw39dUbUvy9z4Qktc9HtEnymYJIT1p1ilEiLdc116iEdufhJfB7YRT1lpdqRHS5hQqVzgJdrZJIYg4TyBBw=="],
564565

565-
"@wharfkit/antelope": ["@wharfkit/antelope@1.0.13", "", { "dependencies": { "bn.js": "^4.11.9", "brorand": "^1.1.0", "elliptic": "^6.5.4", "hash.js": "^1.0.0", "pako": "^2.1.0", "tslib": "^2.0.3" } }, "sha512-f4O5O8+6Bd5BHpMUHTmlWQmlhX5xYb4AfzT2NJweyqIPqQOstm+aInF42AtUhSALDa8fvoY80YZoqwM0L8TUyw=="],
566+
"@wharfkit/antelope": ["@wharfkit/antelope@1.1.1", "", { "dependencies": { "bn.js": "^4.11.9", "brorand": "^1.1.0", "elliptic": "^6.5.4", "hash.js": "^1.0.0", "pako": "^2.1.0", "tslib": "^2.0.3" } }, "sha512-zOetZJG0T4/WRCIC8Ui2DGv+RxrSkdXOq/q8sUqUcuKei+aJo4/9Xk37VULPt2qe0NpTm93ajYV9cYdD9m5Fgg=="],
566567

567568
"@wharfkit/cli": ["@wharfkit/[email protected]", "", { "dependencies": { "@wharfkit/antelope": "^1.0.0", "@wharfkit/common": "^1.2.4", "@wharfkit/contract": "^1.1.4", "commander": "^11.0.0", "eslint": "^8.48.0", "node-fetch": "^2.6.1", "prettier": "^2.2.1", "typescript": "^4.9.5" }, "bin": { "wharfkit": "lib/cli.js" } }, "sha512-oKxCmjN/Bl30kGz84JM1ouh9NgJIRYGKtaG2Nm6C2I9A8gKFR3dLrgQIJWQeVrLyvj2KgwxgcaZra+FDPSQEwg=="],
568569

@@ -582,7 +583,7 @@
582583

583584
"@wharfkit/sealed-messages": ["@wharfkit/[email protected]", "", { "dependencies": { "@wharfkit/antelope": "^1.1.0" } }, "sha512-UuN5I4+DOH0mM8fVp4aojKqNPt9KptK4J37YJr6i+f4jTELTt4wsrikq2bZSkzIf6RbLe462f/QYtRqygl6CYg=="],
584585

585-
"@wharfkit/session": ["@wharfkit/session@1.6.0", "", { "dependencies": { "@wharfkit/abicache": "^1.2.1", "@wharfkit/antelope": "^1.0.11", "@wharfkit/common": "^1.2.0", "@wharfkit/signing-request": "^3.1.0", "pako": "^2.0.4", "tslib": "^2.1.0" } }, "sha512-yrCDcW42Dqd387usVHa3qjnttc65OzHK3REKovzo6wLpQsPn709xzx4J6B9e9Xjb0WC/GQLghtr9EX+T+rRH6w=="],
586+
"@wharfkit/session": ["@wharfkit/session@1.7.0", "", { "dependencies": { "@wharfkit/abicache": "^1.2.1", "@wharfkit/antelope": "^1.0.11", "@wharfkit/common": "^1.2.0", "@wharfkit/signing-request": "^3.1.0", "pako": "^2.0.4", "tslib": "^2.1.0" } }, "sha512-mLfa62RAqk2o05P7qkp8TScRrN7mlimxHy92E5QEiQHpvIVz/KacZmjMBpWd0SueqrWGdpMbjx4WkjypPcRWgg=="],
586587

587588
"@wharfkit/signing-request": ["@wharfkit/[email protected]", "", { "dependencies": { "@wharfkit/antelope": "^1.0.7", "tslib": "^2.0.3" } }, "sha512-rIMzqwAKA5vb09+1BI+9fUXbj73JIkYcD1XT/Tom+k/+bqi51JcmC0trjCOjTUOK9UYDabpxYFixrf1ZvQymKw=="],
588589

@@ -604,6 +605,8 @@
604605

605606
"@wharfkit/wallet-plugin-tokenpocket": ["@wharfkit/[email protected]", "", { "dependencies": { "tslib": "^2.1.0" }, "peerDependencies": { "@wharfkit/protocol-scatter": "^1.3.1", "@wharfkit/session": "^1.4.0" } }, "sha512-Rm3ARYMW3vkWUFZe0Q1SKQVDSvGzkvb/hmlcuBdQ8xSmR0fBTRDdcIx9QgD7uc5c9hKBKuk2AecvwB+JVF3A3g=="],
606607

608+
"@wharfkit/wallet-plugin-web-authenticator": ["@wharfkit/[email protected]", "", { "dependencies": { "@greymass/buoy": "^1.0.4", "@wharfkit/protocol-esr": "^1.5.0", "@wharfkit/sealed-messages": "^1.0.0", "isomorphic-ws": "^5.0.0", "tslib": "^2.1.0" }, "peerDependencies": { "@wharfkit/session": "next" } }, "sha512-+blpjkNje6fOjZ8GnqSJBo+J/P3R6beeF9xM7SLxih/Hk/TzfAS3CSBuOMbAde2iz5kkczRQwDulG2I5CU/LLA=="],
609+
607610
"@wharfkit/wallet-plugin-wombat": ["@wharfkit/[email protected]", "", { "dependencies": { "tslib": "^2.1.0" }, "peerDependencies": { "@wharfkit/protocol-scatter": "^1.3.1", "@wharfkit/session": "^1.4.0" } }, "sha512-zQFBv9Nc/+N2yWLNg35BByA+4mtuU/XcSbQ8UmDcPR8MUQmhn9cRCSUK8y0anDLgZniqIDcML+lgda3MXK+5/w=="],
608611

609612
"@wharfkit/web-renderer": ["@wharfkit/[email protected]", "", { "peerDependencies": { "@wharfkit/session": "^1.4.0" } }, "sha512-ky/keS0rHxJcdIWLo7d9H6eo+rK0l2mQj/3xOCwVaDKBAd/dTQwuqYIzOYMC9azdyMglgNcTRgYWm5PJrU4lIA=="],
@@ -1816,12 +1819,6 @@
18161819

18171820
"@wharfkit/cli/typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g=="],
18181821

1819-
"@wharfkit/protocol-esr/@wharfkit/antelope": ["@wharfkit/[email protected]", "", { "dependencies": { "bn.js": "^4.11.9", "brorand": "^1.1.0", "elliptic": "^6.5.4", "hash.js": "^1.0.0", "pako": "^2.1.0", "tslib": "^2.0.3" } }, "sha512-/+zwJq/gFSvIpw3fwFPtpafLqoiipg7lkL1FROrKPyJbrQEaqB1BsCos2+hhWccY6qwKqmdE/iEmY2TZ9gfTPQ=="],
1820-
1821-
"@wharfkit/sealed-messages/@wharfkit/antelope": ["@wharfkit/[email protected]", "", { "dependencies": { "bn.js": "^4.11.9", "brorand": "^1.1.0", "elliptic": "^6.5.4", "hash.js": "^1.0.0", "pako": "^2.1.0", "tslib": "^2.0.3" } }, "sha512-/+zwJq/gFSvIpw3fwFPtpafLqoiipg7lkL1FROrKPyJbrQEaqB1BsCos2+hhWccY6qwKqmdE/iEmY2TZ9gfTPQ=="],
1822-
1823-
"@wharfkit/session/@wharfkit/common": ["@wharfkit/[email protected]", "", { "dependencies": { "tslib": "^2.1.0" }, "peerDependencies": { "@wharfkit/antelope": "^1.0.0" } }, "sha512-ku3ErhtYcBsxAg/px00q8OoCwS7Z2BVFfp+eazPdQk3hpdEhuyAkojq5TBXdWUYocthI+cJ1EQH87y+Di1JI3w=="],
1824-
18251822
"accepts/mime-types": ["[email protected]", "", { "dependencies": { "mime-db": "^1.54.0" } }, "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA=="],
18261823

18271824
"acorn-walk/acorn": ["[email protected]", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg=="],

configs/.env.jungle4

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PUBLIC_RAM_TOKEN_LOGO_DARK=https://assets.wharfkit.com/chain/jungle.png
88
PUBLIC_SYSTEM_TOKEN_CONTRACT="core.vaulta"
99
PUBLIC_SYSTEM_TOKEN_SYMBOL="4,A"
1010
PUBLIC_SYSTEM_TOKEN_SYMBOL_ALT=
11-
PUBLIC_SYSTEM_TOKEN_LOCKED_SUPPLY=
11+
PUBLIC_SYSTEM_TOKEN_LOCKED_SUPPLY="eosio,eosio.null,core.vaulta"
1212
PUBLIC_LEGACY_TOKEN_CONTRACT="eosio.token"
1313
PUBLIC_LEGACY_TOKEN_SYMBOL="4,EOS"
1414
PUBLIC_LEGACY_TOKEN_EXCHANGERATE="1.0000 EOS"
@@ -51,10 +51,12 @@ PUBLIC_FEATURE_TIMESERIES=false
5151
PUBLIC_FEATURE_UNICOVE_CONTRACT_API=unicove.gm
5252
PUBLIC_FEATURE_UNICOVE_CONTRACT_API_TOKENS=02044a554e474c4500000100a6823403ea305504454f5300000000000100a6823403ea3055
5353
PUBLIC_FEATURE_VAULTA_CORE_CONTRACT=core.vaulta
54+
PUBLIC_FEATURE_WEB_AUTHENTICATOR_URL=https://aaron-staging.web-authenticator-a83.pages.dev/en
5455
PUBLIC_FEATURE_WRAM=false
5556

5657
PUBLIC_WALLET_ANCHOR=true
5758
PUBLIC_WALLET_METAMASK=true
59+
PUBLIC_WALLET_WEB_AUTHENTICATOR=true
5860

5961
BACKEND_API_CHAIN="https://jungle4.greymass.com"
6062
BACKEND_API_HISTORY="https://jungle4.greymass.com"

configs/.env.jungle4.vaulta

Lines changed: 0 additions & 65 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"@wharfkit/hyperion": "^1.0.4",
6666
"@wharfkit/resources": "^1.3.1",
6767
"@wharfkit/roborovski": "^1.1.0",
68-
"@wharfkit/session": "^1.6.0",
68+
"@wharfkit/session": "^1.7.0",
6969
"@wharfkit/transact-plugin-resource-provider": "^1.1.3",
7070
"@wharfkit/wallet-plugin-anchor": "^1.6.0",
7171
"@wharfkit/wallet-plugin-cleos": "^1.2.0",
@@ -75,6 +75,7 @@
7575
"@wharfkit/wallet-plugin-privatekey": "^1.1.0",
7676
"@wharfkit/wallet-plugin-scatter": "^1.5.1",
7777
"@wharfkit/wallet-plugin-tokenpocket": "^1.5.1",
78+
"@wharfkit/wallet-plugin-web-authenticator": "^0.3.1",
7879
"@wharfkit/wallet-plugin-wombat": "^1.5.1",
7980
"@wharfkit/web-renderer": "^1.4.1",
8081
"chart.js": "^4.4.3",

src/lib/state/client/wharf.svelte.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export class WharfState {
8585
walletPlugins
8686
},
8787
{
88+
acceptUrlSession: true,
8889
accountCreationPlugins,
8990
transactPlugins
9091
}

src/lib/wharf/plugins.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import {
22
PUBLIC_FEATURE_METAMASK_SNAP_ORIGIN,
3+
PUBLIC_FEATURE_WEB_AUTHENTICATOR_URL,
34
PUBLIC_LOCAL_SIGNER,
45
PUBLIC_WALLET_ANCHOR,
56
PUBLIC_WALLET_CLOUDWALLET,
67
PUBLIC_WALLET_IMTOKEN,
78
PUBLIC_WALLET_METAMASK,
89
PUBLIC_WALLET_SCATTER,
910
PUBLIC_WALLET_TOKENPOCKET,
11+
PUBLIC_WALLET_WEB_AUTHENTICATOR,
1012
PUBLIC_WALLET_WOMBAT
1113
} from '$env/static/public';
1214
import type { ChainDefinition } from '@wharfkit/common';
@@ -20,6 +22,7 @@ import { WalletPluginMultiSig } from '$lib/wharf/plugins/multisig';
2022
import { WalletPluginPrivateKey } from '@wharfkit/wallet-plugin-privatekey';
2123
import { WalletPluginScatter } from '@wharfkit/wallet-plugin-scatter';
2224
import { WalletPluginTokenPocket } from '@wharfkit/wallet-plugin-tokenpocket';
25+
import { WalletPluginWebAuthenticator } from '@wharfkit/wallet-plugin-web-authenticator';
2326
import { WalletPluginWombat } from '@wharfkit/wallet-plugin-wombat';
2427

2528
import { TransactPluginResourceProvider } from '@wharfkit/transact-plugin-resource-provider';
@@ -54,6 +57,14 @@ if (isENVTrue(PUBLIC_WALLET_SCATTER)) {
5457
baseWalletPlugins.push(new WalletPluginScatter());
5558
}
5659

60+
if (isENVTrue(PUBLIC_WALLET_WEB_AUTHENTICATOR) && PUBLIC_FEATURE_WEB_AUTHENTICATOR_URL) {
61+
baseWalletPlugins.push(
62+
new WalletPluginWebAuthenticator({
63+
webAuthenticatorUrl: PUBLIC_FEATURE_WEB_AUTHENTICATOR_URL
64+
})
65+
);
66+
}
67+
5768
if (isENVTrue(PUBLIC_WALLET_TOKENPOCKET)) {
5869
baseWalletPlugins.push(new WalletPluginTokenPocket());
5970
}

src/routes/[network]/+layout.svelte

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { Checksum256, type NameType } from '@wharfkit/antelope';
2+
import { type NameType } from '@wharfkit/antelope';
33
import { ChainDefinition } from '@wharfkit/common';
44
import { onMount, setContext, untrack } from 'svelte';
55
import { Head, type SeoConfig } from 'svead';
@@ -132,21 +132,7 @@
132132
wharf.init(data.network);
133133
}
134134
135-
const sessions = await wharf.sessionKit?.getSessions();
136-
if (sessions) {
137-
const lastUsedSession = wharf.chainsSession[String(data.network.chain.id)];
138-
const anyValidSession =
139-
sessions.length > 0
140-
? sessions.find((s) => Checksum256.from(s.chain).equals(data.network.chain.id))
141-
: undefined;
142-
if (lastUsedSession) {
143-
wharf.restore(lastUsedSession);
144-
} else if (anyValidSession) {
145-
wharf.restore(anyValidSession);
146-
} else {
147-
wharf.reset();
148-
}
149-
}
135+
await wharf.restore();
150136
}
151137
152138
$effect(() => {

0 commit comments

Comments
 (0)