@holochain/client
Advanced tools
Comparing version 0.16.7 to 0.16.8
@@ -5,3 +5,3 @@ import { hashZomeCall } from "@holochain/serialization"; | ||
import Emittery from "emittery"; | ||
import { getLauncherEnvironment, signZomeCallTauri, signZomeCallElectron, } from "../../environments/launcher.js"; | ||
import { getLauncherEnvironment, signZomeCallTauri, signZomeCallElectron, getHostZomeCallSigner, } from "../../environments/launcher.js"; | ||
import { encodeHashToBase64 } from "../../utils/base64.js"; | ||
@@ -102,10 +102,16 @@ import { WsClient } from "../client.js"; | ||
} | ||
const env = getLauncherEnvironment(); | ||
if (!env) { | ||
return signZomeCall(request); | ||
const hostSigner = getHostZomeCallSigner(); | ||
if (hostSigner) { | ||
return hostSigner.signZomeCall(request); | ||
} | ||
else if (env.FRAMEWORK === "electron") { | ||
return signZomeCallElectron(request); | ||
else { | ||
const env = getLauncherEnvironment(); | ||
if (!env) { | ||
return signZomeCall(request); | ||
} | ||
if (env.FRAMEWORK === "electron") { | ||
return signZomeCallElectron(request); | ||
} | ||
return signZomeCallTauri(request); | ||
} | ||
return signZomeCallTauri(request); | ||
}, | ||
@@ -112,0 +118,0 @@ output: (response) => decode(response), |
@@ -10,8 +10,14 @@ import { CallZomeRequest } from "../api/app/types.js"; | ||
} | ||
export interface HostZomeCallSigner { | ||
signZomeCall: (request: CallZomeRequest) => Promise<CallZomeRequestSigned>; | ||
} | ||
declare const __HC_LAUNCHER_ENV__ = "__HC_LAUNCHER_ENV__"; | ||
declare const __HC_ZOME_CALL_SIGNER__ = "__HC_ZOME_CALL_SIGNER__"; | ||
export declare const isLauncher: () => boolean; | ||
export declare const getLauncherEnvironment: () => LauncherEnvironment | undefined; | ||
export declare const getHostZomeCallSigner: () => HostZomeCallSigner | undefined; | ||
declare global { | ||
interface Window { | ||
[__HC_LAUNCHER_ENV__]?: LauncherEnvironment; | ||
[__HC_ZOME_CALL_SIGNER__]?: HostZomeCallSigner; | ||
electronAPI?: { | ||
@@ -18,0 +24,0 @@ signZomeCall: (data: CallZomeRequestUnsignedElectron) => CallZomeRequestSignedElectron; |
@@ -5,4 +5,6 @@ import { encode } from "@msgpack/msgpack"; | ||
const __HC_LAUNCHER_ENV__ = "__HC_LAUNCHER_ENV__"; | ||
const __HC_ZOME_CALL_SIGNER__ = "__HC_ZOME_CALL_SIGNER__"; | ||
export const isLauncher = () => globalThis.window && __HC_LAUNCHER_ENV__ in globalThis.window; | ||
export const getLauncherEnvironment = () => isLauncher() ? globalThis.window[__HC_LAUNCHER_ENV__] : undefined; | ||
export const getHostZomeCallSigner = () => globalThis.window && globalThis.window[__HC_ZOME_CALL_SIGNER__]; | ||
export const signZomeCallTauri = async (request) => { | ||
@@ -9,0 +11,0 @@ const zomeCallUnsigned = { |
{ | ||
"name": "@holochain/client", | ||
"version": "0.16.7", | ||
"version": "0.16.8", | ||
"description": "A JavaScript client for the Holochain Conductor API", | ||
@@ -5,0 +5,0 @@ "author": "Holochain Foundation <info@holochain.org> (http://holochain.org)", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
130984
60
3661