index : worker-pastebin

A toy pastebin on Cloudflare Workers with E2EE, React frontend and S3-compatible storage backend

diff options
context:
space:
mode:
authorPeter Cai <[email protected]>2020-12-31 14:27:57 +0800
committerPeter Cai <[email protected]>2020-12-31 14:27:57 +0800
commit324903108b1a50a553f51d45d252ba30ec3f13b6 (patch)
tree8663da865fe7e189d20fd58c69d9d2d51e1a22d3
parentcb41215ec973c280810801d65524aee1472a2c3c (diff)
downloadworker-pastebin-324903108b1a50a553f51d45d252ba30ec3f13b6.tar.gz
crypto: use application/vnd namespace instead of binary/
-rw-r--r--src/crypto.coffee6
-rw-r--r--src/index.coffee2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/crypto.coffee b/src/crypto.coffee
index 4ba1b7a..a544b68 100644
--- a/src/crypto.coffee
+++ b/src/crypto.coffee
@@ -44,7 +44,7 @@ encryptFile = (file) ->
# Encrypt
encrypted = await crypto.subtle.encrypt algoParams, key, await file.arrayBuffer()
name = hex await crypto.subtle.encrypt algoParams, key, utf8Bytes file.name
- mime = 'binary/' + hex await crypto.subtle.encrypt algoParams, key, utf8Bytes file.type
+ mime = 'application/vnd.angry.paste+' + hex await crypto.subtle.encrypt algoParams, key, utf8Bytes file.type
exportedKey = hex await crypto.subtle.exportKey 'raw', key
[exportedKey, hex(iv), name, mime, encrypted]
@@ -63,7 +63,7 @@ importKeyAndIv = (key, iv) ->
decryptMetadata = (key, iv, name, mime) ->
[key, algoParams] = await importKeyAndIv key, iv
name = fromUtf8Bytes await crypto.subtle.decrypt algoParams, key, fromHex name
- mime = fromHex mime.replace /^binary\//, ""
+ mime = fromHex mime.replace /^application\/vnd\.angry\.paste\+/, ""
mime = fromUtf8Bytes await crypto.subtle.decrypt algoParams, key, mime
[name, mime]
@@ -80,4 +80,4 @@ export {
encryptFile,
decryptMetadata,
decryptFile
-} \ No newline at end of file
+}
diff --git a/src/index.coffee b/src/index.coffee
index 0402732..3c5773e 100644
--- a/src/index.coffee
+++ b/src/index.coffee
@@ -231,4 +231,4 @@ handleRemoteFetch = (req) ->
new Response "/paste/" + id,
status: 200
-export default main \ No newline at end of file
+export default main