diff --git a/cmd/ww/main.go b/cmd/ww/main.go index a1b96f4..e53dcb0 100644 --- a/cmd/ww/main.go +++ b/cmd/ww/main.go @@ -81,7 +81,7 @@ func newConn(code string, length int) *wormhole.Wormhole { if err == wormhole.ErrBadVersion { fatalf( "%s%s%s", - "the signalling server is running an incompatable version.\n", + "the signalling server is running an incompatible version.\n", "try upgrading the client:\n\n", " go install webwormhole.io/cmd/ww@latest\n", ) @@ -114,7 +114,7 @@ func newConn(code string, length int) *wormhole.Wormhole { if err == wormhole.ErrBadVersion { fatalf( "%s%s%s", - "the signalling server is running an incompatable version.\n", + "the signalling server is running an incompatible version.\n", "try upgrading the client:\n\n", " go install webwormhole.io/cmd/ww@latest\n", ) diff --git a/cmd/ww/pipe.go b/cmd/ww/pipe.go index 7e64e33..717e264 100644 --- a/cmd/ww/pipe.go +++ b/cmd/ww/pipe.go @@ -25,7 +25,7 @@ func pipe(args ...string) { c := newConn(set.Arg(0), *length) done := make(chan struct{}) - // The recieve end of the pipe. + // The receive end of the pipe. go func() { _, err := io.CopyBuffer(os.Stdout, c, make([]byte, msgChunkSize)) if err != nil { diff --git a/cmd/ww/server.go b/cmd/ww/server.go index 3b2ce66..3c77028 100644 --- a/cmd/ww/server.go +++ b/cmd/ww/server.go @@ -29,7 +29,7 @@ import ( "webwormhole.io/wormhole" ) -// slotTimeout is the the maximum amount of time a client is allowed to +// slotTimeout is the maximum amount of time a client is allowed to // hold a slot. const slotTimeout = 12 * time.Hour @@ -107,7 +107,7 @@ var stunServers []webrtc.ICEServer // freeslot tries to find an available numeric slot, favouring smaller numbers. // This assume slots is locked. func freeslot() (slot string, ok bool) { - // Assuming varint encoding, we first try for one byte. That's 7 bits in varint. + // Assuming varint encoding, we first try for one byte. That's seven bits in varint. for i := 0; i < 64; i++ { s := strconv.Itoa(rand.Intn(1 << 7)) if _, ok := slots.m[s]; !ok { diff --git a/web/main.js b/web/main.js index 82d8a17..78c41b5 100644 --- a/web/main.js +++ b/web/main.js @@ -422,11 +422,11 @@ async function connect() { }; }; const fingerprint = await w.dial(); - // To make it more likely to spot the 1 in 2^16 chance of a successful + // To make it more likely to spot the one in 2^16 chance of a successful // MITM password guess, we can compare a fingerprint derived from the PAKE - // key. The 7 words visible on the tooltip of the input box should match on + // key. The seven words visible on the tooltip of the input box should match on // both side. - // We also use the first 3 bits of it to choose the background colour, so + // We also use the first three bits of it to choose the background colour, so // that should match on both sides as well. const encodedfp = webwormhole.encode(0, fingerprint.subarray(1)); phraseInput.title = encodedfp.substring(encodedfp.indexOf("-") + 1); @@ -619,7 +619,7 @@ function browserhacks() { if (/^Mozilla\/5.0 \(iPhone; CPU iPhone OS 12_[0-9]_[0-9] like Mac OS X\)/.test(navigator.userAgent)) { hacks.noblob = true; hacks.nosw = true; - console.log("quirks: using ios12 dataurl hack"); + console.log("quirks: using ios12 data-url hack"); } // Work around iOS trying to connect when the link is previewed. // You never saw this. @@ -708,7 +708,7 @@ async function init() { transfersList = document.getElementById("transfers"); infoBox = document.getElementById("info"); autocompleteBox = document.getElementById("autocomplete"); - // Friendly error message and bail out if things are clearely not going to work. + // Friendly error message and bail out if things are clearly not going to work. if (hacks.browserunsupported) { infoBox.innerText = "Browser missing required feature. This application needs support for WebSockets, WebRTC, and WebAssembly."; diff --git a/web/main.ts b/web/main.ts index d8f268e..2f2146c 100644 --- a/web/main.ts +++ b/web/main.ts @@ -543,11 +543,11 @@ async function connect() { const fingerprint = await w.dial(); - // To make it more likely to spot the 1 in 2^16 chance of a successful + // To make it more likely to spot the one in 2^16 chance of a successful // MITM password guess, we can compare a fingerprint derived from the PAKE - // key. The 7 words visible on the tooltip of the input box should match on + // key. The seven words visible on the tooltip of the input box should match on // both side. - // We also use the first 3 bits of it to choose the background colour, so + // We also use the first three bits of it to choose the background colour, so // that should match on both sides as well. const encodedfp = webwormhole.encode(0, fingerprint.subarray(1)); phraseInput.title = encodedfp.substring(encodedfp.indexOf("-") + 1); @@ -771,7 +771,7 @@ function browserhacks() { ) { hacks.noblob = true; hacks.nosw = true; - console.log("quirks: using ios12 dataurl hack"); + console.log("quirks: using ios12 data-url hack"); } // Work around iOS trying to connect when the link is previewed. @@ -883,7 +883,7 @@ async function init() { infoBox = document.getElementById("info") as HTMLElement; autocompleteBox = document.getElementById("autocomplete") as HTMLElement; - // Friendly error message and bail out if things are clearely not going to work. + // Friendly error message and bail out if things are clearly not going to work. if (hacks.browserunsupported) { infoBox.innerText = "Browser missing required feature. This application needs support for WebSockets, WebRTC, and WebAssembly."; diff --git a/web/sw.js b/web/sw.js index 28381d6..0393ece 100644 --- a/web/sw.js +++ b/web/sw.js @@ -5,7 +5,7 @@ // Workaround to tell TypeScript about the correct type of a ServiceWorker. const sw = self; // There can be multiple clients (pages) receiving files, so they generate an id -// and here we store info assosiated with each transfer. +// and here we store info associated with each transfer. const streams = new Map(); class Stream { constructor(name, size, filetype) { @@ -125,7 +125,7 @@ async function streamUpload(e) { return; } // ReadableStream is transferable on Chrome at the time of writing. Since Share - // Target also only works on Chome, we can use this and avoid the complexity of + // Target also only works on Chrome, we can use this and avoid the complexity of // chunking over postMessage (like we do with downloads) or having to read the // whole file into memory. // TypeScript doesn't know that ReadableStream is transferable, hence body as diff --git a/web/sw.ts b/web/sw.ts index 3270658..9ada678 100644 --- a/web/sw.ts +++ b/web/sw.ts @@ -6,7 +6,7 @@ const sw = self as ServiceWorkerGlobalScope & typeof globalThis; // There can be multiple clients (pages) receiving files, so they generate an id -// and here we store info assosiated with each transfer. +// and here we store info associated with each transfer. const streams = new Map(); class Stream { @@ -158,7 +158,7 @@ async function streamUpload(e: FetchEvent) { } // ReadableStream is transferable on Chrome at the time of writing. Since Share - // Target also only works on Chome, we can use this and avoid the complexity of + // Target also only works on Chrome, we can use this and avoid the complexity of // chunking over postMessage (like we do with downloads) or having to read the // whole file into memory. // TypeScript doesn't know that ReadableStream is transferable, hence body as diff --git a/web/ww.js b/web/ww.js index 9b4be54..7b367f1 100644 --- a/web/ww.js +++ b/web/ww.js @@ -32,7 +32,7 @@ class Wormhole { console.log("requesting slot"); this.state = this.statePlayer1; } - // There are 3 events that we need to synchronise with the caller on: + // There are three events that we need to synchronise with the caller on: // 1. we got the first message from the signalling server. // We now have the slot number and the ICE server details, so we can // create the wormhole code and PeerConnection object, and pass them back @@ -67,7 +67,7 @@ class Wormhole { this.callback(this.pc); const msgA = webwormhole.start(this.pass); if (!msgA) { - return this.fail("could nnt generate A's PAKE message"); + return this.fail("could not generate A's PAKE message"); } console.log("message a:", msgA); this.ws.send(msgA); @@ -241,7 +241,7 @@ class Wormhole { const stats = await this.pc.getStats(); let id; stats.forEach((s) => { - // s.selected gives more confidenece than s.state == "succeeded", but Chrome does + // s.selected gives more confidence than s.state == "succeeded", but Chrome does // not implement it. if (s.type === "candidate-pair" && s.state === "succeeded") { diff --git a/web/ww.ts b/web/ww.ts index b8827d0..ebca385 100644 --- a/web/ww.ts +++ b/web/ww.ts @@ -71,7 +71,7 @@ class Wormhole { this.state = this.statePlayer1; } - // There are 3 events that we need to synchronise with the caller on: + // There are three events that we need to synchronise with the caller on: // 1. we got the first message from the signalling server. // We now have the slot number and the ICE server details, so we can // create the wormhole code and PeerConnection object, and pass them back @@ -112,7 +112,7 @@ class Wormhole { this.callback(this.pc); const msgA = webwormhole.start(this.pass); if (!msgA) { - return this.fail("could nnt generate A's PAKE message"); + return this.fail("could not generate A's PAKE message"); } console.log("message a:", msgA); this.ws.send(msgA); @@ -314,7 +314,7 @@ class Wormhole { let id: string | undefined; stats.forEach((s) => { - // s.selected gives more confidenece than s.state == "succeeded", but Chrome does + // s.selected gives more confidence than s.state == "succeeded", but Chrome does // not implement it. if ( s.type === "candidate-pair" && diff --git a/wordlist/wordlist.go b/wordlist/wordlist.go index 21784d6..6e7849a 100644 --- a/wordlist/wordlist.go +++ b/wordlist/wordlist.go @@ -1,4 +1,4 @@ -// Package wordlist provides a encoders and a decoder for WebWormhole codes. +// Package wordlist provides encoders and a decoder for WebWormhole codes. package wordlist import ( @@ -71,7 +71,7 @@ func (octalEncoding) Encode(slot int, pass []byte) string { } func (octalEncoding) Decode(code string) (slot int, pass []byte) { - // White space and - are interchangable. + // White space and - are interchangeable. code = strings.ReplaceAll(code, "-", " ") // Space can turn into + in URLs. code = strings.ReplaceAll(code, "+", " ") @@ -124,7 +124,7 @@ func (list varintEncoding) Encode(slot int, pass []byte) string { } func (list varintEncoding) Decode(code string) (slot int, pass []byte) { - // White space and - are interchangable. + // White space and - are interchangeable. code = strings.ReplaceAll(code, "-", " ") // Space can turn into + in URLs. code = strings.ReplaceAll(code, "+", " ") @@ -169,7 +169,7 @@ func (list magicWormholeEncoding) Encode(slot int, pass []byte) string { } func (list magicWormholeEncoding) Decode(code string) (slot int, pass []byte) { - // White space and - are interchangable. + // White space and - are interchangeable. code = strings.ReplaceAll(code, "-", " ") // Space can turn into + in URLs. code = strings.ReplaceAll(code, "+", " ") diff --git a/wordlist/wordlist_test.go b/wordlist/wordlist_test.go index 36fec65..f6393fd 100644 --- a/wordlist/wordlist_test.go +++ b/wordlist/wordlist_test.go @@ -47,7 +47,7 @@ func TestMatch(t *testing.T) { {"zo", "zone"}, {"acre-b", ""}, {"zz", ""}, - {"snaps", "snapshot"}, // fallback to gpg words + {"snaps", "snapshot"}, // fall back to gpg words } for i, c := range cases { if hint := Match(c.prefix); hint != c.word { diff --git a/wormhole/dial.go b/wormhole/dial.go index 418d308..03ccbe7 100644 --- a/wormhole/dial.go +++ b/wormhole/dial.go @@ -8,7 +8,7 @@ // (https://tools.ietf.org/html/rfc5763). // // This package removes the signalling server from the trust model by using a -// PAKE to estabish the authenticity of the WebRTC metadata. In other words, +// PAKE to establish the authenticity of the WebRTC metadata. In other words, // it's a clone of Magic Wormhole made to use WebRTC as the transport. // // The protocol requires a signalling server that facilitates exchanging @@ -99,7 +99,7 @@ var ( // version of the signalling protocol. ErrBadVersion = errors.New("bad version") - // ErrBadVersion is returned when the the peer on the same slot uses a different + // ErrBadVersion is returned when the peer on the same slot uses a different // password. ErrBadKey = errors.New("bad key") @@ -255,7 +255,7 @@ func writeBase64(ws *websocket.Conn, p []byte) error { } // readInitMsg reads the first message the signalling server sends over -// the WebSocket connection, which has metadata includign assigned slot +// the WebSocket connection, which has metadata including assigned slot // and ICE servers to use. func readInitMsg(ws *websocket.Conn) (slot string, iceServers []webrtc.ICEServer, err error) { msg := struct { @@ -327,7 +327,7 @@ func (c *Wormhole) newPeerConnection(ice []webrtc.ICEServer) error { return nil } -// IsRelay returns whether this connection is over a TURN relay or not. +// IsRelay returns whether or not this connection is over a TURN relay. func (c *Wormhole) IsRelay() bool { stats := c.pc.GetStats() for _, s := range stats {