@holochain/client
Advanced tools
Comparing version 0.17.0-dev.3 to 0.17.0-dev.4
@@ -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 = { |
@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
"packageName": "@microsoft/api-extractor", | ||
"packageVersion": "7.34.4" | ||
"packageVersion": "7.39.4" | ||
} | ||
] | ||
} |
{ | ||
"name": "@holochain/client", | ||
"version": "0.17.0-dev.3", | ||
"version": "0.17.0-dev.4", | ||
"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
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
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
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
131147
60
3664
3
80