Check-in [7336ecd46a]
Overview
Comment:Start of Tcl-based SSH agent that uses JavaScript implementation
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:7336ecd46a2cb657e77314d477a1bde5c1742c2b
User & Date: rkeene on 2019-06-08 22:18:11
Other Links: manifest | tags
Context
2019-06-09
18:35
Minor cleanup check-in: e4e500972a user: rkeene tags: trunk
2019-06-08
22:18
Start of Tcl-based SSH agent that uses JavaScript implementation check-in: 7336ecd46a user: rkeene tags: trunk
22:17
Use indexOf() instead of includes for backwards compatibility support check-in: 8b2206f04e user: rkeene tags: trunk
Changes

Modified .fossil-settings/ignore-glob from [3e95b51b2f] to [4e7947b3ab].

    35     35   build/chrome/cackey.nmf
    36     36   build/chrome/cackey.zip
    37     37   build/chrome/test
    38     38   build/chrome/google-pcsc.js
    39     39   build/chrome/manifest.json
    40     40   build/chrome/jsrsasign.js
    41     41   build/chrome/extra/*.png
           42  +build/tcl/ssh-agent-noasync.js
           43  +build/tcl/tclkit

Added build/tcl/Makefile version [04cbb3e324].

            1  +all: ssh-agent-noasync.js
            2  +
            3  +ssh-agent-noasync.js: ../chrome/ssh-agent.js
            4  +	cc -Dawait='' -Dasync='' -nostdinc -C -E -x c ../chrome/ssh-agent.js -o - | grep -v '^# ' > ssh-agent-noasync.js.new
            5  +	mv ssh-agent-noasync.js.new ssh-agent-noasync.js
            6  +
            7  +clean:
            8  +	rm -f ssh-agent-noasync.js.new ssh-agent-noasync.js
            9  +
           10  +distclean: clean
           11  +
           12  +.PHONY: all clean distclean

Added build/tcl/chrome-emu.js version [cfc05731e7].

            1  +
            2  +console = {
            3  +	log: function() {
            4  +		/* XXX:TODO: Logging */
            5  +	}
            6  +}
            7  +chrome = {
            8  +	runtime: {
            9  +		connectCallbacks: [],
           10  +		onConnectExternal: {
           11  +			addListener: function(callback) {
           12  +				if (!callback) {
           13  +					return;
           14  +				}
           15  +
           16  +				chrome.runtime.connectCallbacks.push(callback)
           17  +			},
           18  +			removeListener: function(callback) {
           19  +				var idx;
           20  +				idx = chrome.runtime.connectCallbacks.indexOf(callback);
           21  +				if (idx == -1) {
           22  +					return;
           23  +				}
           24  +
           25  +				chrome.runtime.connectCallbacks.splice(idx, 1);
           26  +			}
           27  +		}
           28  +	}
           29  +}

Added build/tcl/ssh-agent.tcl version [0cbe74a449].

            1  +#! /home/rkeene/tmp/cackey/build/tcl/tclkit
            2  +
            3  +package require duktape
            4  +package require tuapi
            5  +
            6  +proc initSSHAgent {} {
            7  +	if {[info exists ::jsHandle]} {
            8  +		return
            9  +	}
           10  +
           11  +	set chromeEmuJS [read [open chrome-emu.js]]
           12  +	set sshAgentJS [read [open ssh-agent-noasync.js]]
           13  +
           14  +	set ::jsHandle [::duktape::init]
           15  +
           16  +	::duktape::eval $::jsHandle $chromeEmuJS
           17  +	::duktape::eval $::jsHandle $sshAgentJS
           18  +
           19  +	puts [::duktape::eval $::jsHandle {
           20  +		chrome.runtime.connectCallbacks[0]({
           21  +			sender: {
           22  +				id: "pnhechapfaindjhompbnflcldabbghjo"
           23  +			},
           24  +			onMessage: {
           25  +				addListener: function() {
           26  +					/* XXX:TODO */
           27  +				}
           28  +			}
           29  +		})
           30  +	}]
           31  +}
           32  +
           33  +initSSHAgent