Agent-JS 0.21.2

The latest release for agent-js is here with a few new features to be aware of!

We have a fix for the disableIdle flag, we’ve swapped secp256k1 for @noble/curves/secp256k1, and there’s a new PartialIdentity export in @dfinity/identity that you can use in @dfinity/auth-client to delegate to any public key without needing to have the full key pair available in the Agent.

What’s Changed

P.S. We’re trying out a new publishing process, so apologies for the unnecessary patches while we get the process smoothed out!

9 Likes

i see that @rvanasa added gitpod.io to the known hosts again, but something broke between 0.18.1 and and this release. using the default actor exported from the generated declarations, the request url changed between the versions. the new path doesn’t work for gitpod.

0.18.1 path on gitpod


0.21.2 path on gitpod

1 Like

this should probably be hostname instead of knownHost, at least for the gitpod usecase

1 Like

You’re right; thanks for catching this. Follow-up PR: #830

3 Likes

@cryptoschindler I’ll get a patch out for this soon!

2 Likes

This has been patched

@kpeacock @rvanasa
I was wondering, could there be a similar approach for authClient.login? That is I can omit the identityProvider key and the authClient will figure out the correct provider URL on my behalf. If not, how would you implement an identityProvider that works locally, on mainnet and in environments like github.dev and gitpod.io?

currently i’m just using this

			// start the login process and wait for it to finish
			await new Promise<void>((resolve, reject) => {
				authClient.login({
					identityProvider:
						process.env.DFX_NETWORK === 'ic'
							? 'https://identity.ic0.app'
							: `http://rdmx6-jaaaa-aaaaa-aaadq-cai.localhost:4943`,
					onSuccess: resolve,
					onError: reject,
					windowOpenerFeatures: `toolbar=0,location=0,menubar=0,width=400,height=600,left=${window.screen.width / 2 - 200},top=${window.screen.height / 2 - 300}`
				});
			});
1 Like

My view is that trying to make inferring idpProvider work isn’t worth it. There are a dozen ways someone might want to pass the configuration - global variable, url parameter, environment variable, etc. host is special because you can point at "/", but idpProvider will always be a separate domain.

1 Like