From 8643e8be20723d7090d42d02fc0e6c732769e5c3 Mon Sep 17 00:00:00 2001 From: Tyr Chen Date: Thu, 14 Nov 2019 08:08:32 -0800 Subject: [PATCH] update the repo --- Makefile | 3 - resources/async.md | 2 - resources/ideas/password.md | 11 ++++ src/2019/w46/1-noise-protocol.md | 2 + templates/pagebreak.lua | 100 ------------------------------- 5 files changed, 13 insertions(+), 105 deletions(-) create mode 100644 resources/ideas/password.md delete mode 100644 templates/pagebreak.lua diff --git a/Makefile b/Makefile index 78440df..86f7c78 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,4 @@ -PANDOC=pandoc --lua-filter templates/pagebreak.lua -t html5 --mathjax --template=templates/github.wechat --tab-stop 2 --highlight-style pygments --standalone --section-divs - MDOC=mdoc - TRANSFORM=tools/transform.js GEN_SUMMARY=tools/gen_summary.js diff --git a/resources/async.md b/resources/async.md index 1f30b2e..8a3c705 100644 --- a/resources/async.md +++ b/resources/async.md @@ -9,5 +9,3 @@ * Callback hell * Promises and future (future: perfectly sized allocation per task) - - diff --git a/resources/ideas/password.md b/resources/ideas/password.md new file mode 100644 index 0000000..789aaa9 --- /dev/null +++ b/resources/ideas/password.md @@ -0,0 +1,11 @@ +# 无密码的世界 + +用户拥有一个主私钥,存储在手机端。在「注册」时,服务端将该私钥的公钥添加到数据库中。「注册」信息的私密部分会以 hash 的形式发送给服务端,该 hash 和「注册」信息的公开部分会一同存入数据库。 + +当这个过程完成后,用户注册成功。 + +之后,其它 app 或者任何终端上的 app 需要用这个身份时,需要获得授权。 + + + + diff --git a/src/2019/w46/1-noise-protocol.md b/src/2019/w46/1-noise-protocol.md index 7eec48b..c65d42f 100644 --- a/src/2019/w46/1-noise-protocol.md +++ b/src/2019/w46/1-noise-protocol.md @@ -11,6 +11,8 @@ Noise Protocol Framework(以下简称 Noise)是一个用于构建安全协 诸君也许会问:既然有了 TLS,我们为何还需要创建自己的安全协议? + + ``` START <----+ Send ClientHello | | Recv HelloRetryRequest diff --git a/templates/pagebreak.lua b/templates/pagebreak.lua deleted file mode 100644 index 1e71d98..0000000 --- a/templates/pagebreak.lua +++ /dev/null @@ -1,100 +0,0 @@ ---[[ -pagebreak – convert raw LaTeX page breaks to other formats - -Copyright © 2017-2019 Benct Philip Jonsson, Albert Krewinkel - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -]] -local stringify_orig = (require 'pandoc.utils').stringify - -local function stringify(x) - return type(x) == 'string' and x or stringify_orig(x) -end - ---- configs – these are populated in the Meta filter. -local pagebreak = { - epub = '

', - html = '
', - latex = '\\newpage{}', - ooxml = '', - odt = '' -} - -local function pagebreaks_from_config (meta) - local html_class = - (meta.newpage_html_class and stringify(meta.newpage_html_class)) - or os.getenv 'PANDOC_NEWPAGE_HTML_CLASS' - if html_class and html_class ~= '' then - pagebreak.html = string.format('
', html_class) - end - - local odt_style = - (meta.newpage_odt_style and stringify(meta.newpage_odt_style)) - or os.getenv 'PANDOC_NEWPAGE_ODT_STYLE' - if odt_style and odt_style ~= '' then - pagebreak.odt = string.format('', odt_style) - end -end - ---- Return a block element causing a page break in the given format. -local function newpage(format) - if format == 'docx' then - return pandoc.RawBlock('openxml', pagebreak.ooxml) - elseif format:match 'latex' then - return pandoc.RawBlock('tex', pagebreak.latex) - elseif format:match 'odt' then - return pandoc.RawBlock('opendocument', pagebreak.odt) - elseif format:match 'html.*' then - return pandoc.RawBlock('html', pagebreak.html) - elseif format:match 'epub' then - return pandoc.RawBlock('html', pagebreak.epub) - else - -- fall back to insert a form feed character - return pandoc.Para{pandoc.Str '\f'} - end -end - -local function is_newpage_command(command) - return command:match '^\\newpage%{?%}?$' - or command:match '^\\pagebreak%{?%}?$' -end - --- Filter function called on each RawBlock element. -function RawBlock (el) - -- Don't do anything if the output is TeX - if FORMAT:match 'tex$' then - return nil - end - -- check that the block is TeX or LaTeX and contains only - -- \newpage or \pagebreak. - if el.format:match 'tex' and is_newpage_command(el.text) then - -- use format-specific pagebreak marker. FORMAT is set by pandoc to - -- the targeted output format. - return newpage(FORMAT) - end - -- otherwise, leave the block unchanged - return nil -end - --- Turning paragraphs which contain nothing but a form feed --- characters into line breaks. -function Para (el) - if #el.content == 1 and el.content[1].text == '\f' then - return newpage(FORMAT) - end -end - -return { - {Meta = pagebreaks_from_config}, - {RawBlock = RawBlock, Para = Para} -}