diff --git a/.github/workflows/release.json b/.github/workflows/release.json index ba54fbc..5e523ec 100644 --- a/.github/workflows/release.json +++ b/.github/workflows/release.json @@ -14,7 +14,7 @@ "uses": "actions/checkout@v4" }, { "name": "dispatch release", - "uses": "softprops/action-gh-release@v1", + "uses": "softprops/action-gh-release@v2", "with": { "generate_release_notes": true } diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8960bdb..81a2500 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -10,6 +10,6 @@ jobs: - name: clone repository uses: actions/checkout@v4 - name: dispatch release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: generate_release_notes: true \ No newline at end of file diff --git a/.github/workflows/test.json b/.github/workflows/test.json index 786b8c2..4335689 100644 --- a/.github/workflows/test.json +++ b/.github/workflows/test.json @@ -23,14 +23,14 @@ "jobs": { "test": { "name": "test: ${{matrix.os}}", - "runs-on": "${{matrix.os}}", + "runs-on": "${{matrix.os}}-latest", "strategy": { "fail-fast": true, "matrix": { "os": [ - "ubuntu-latest", - "macos-latest", - "windows-latest" + "ubuntu", + "macos", + "windows" ] } }, diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 91e1a88..7e52d96 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -15,14 +15,14 @@ on: jobs: test: name: 'test: ${{matrix.os}}' - runs-on: ${{matrix.os}} + runs-on: ${{matrix.os}}-latest strategy: fail-fast: true matrix: os: - - ubuntu-latest - - macos-latest - - windows-latest + - ubuntu + - macos + - windows steps: - name: clone repository uses: actions/checkout@v4 diff --git a/deps.deno_ext.ts b/deps.deno_ext.ts index 1cb9812..e41c4a6 100644 --- a/deps.deno_ext.ts +++ b/deps.deno_ext.ts @@ -1,7 +1,7 @@ -export {Logger, ConsoleHandler, FileHandler} from "https://deno.land/std@0.215.0/log/mod.ts"; -export {format} from "https://deno.land/std@0.215.0/datetime/mod.ts"; +export {Logger, ConsoleHandler, FileHandler} from "https://deno.land/std@0.220.1/log/mod.ts"; +export {format} from "https://deno.land/std@0.220.1/datetime/mod.ts"; export {type Element, DOMParser} from "https://deno.land/x/deno_dom@v0.1.45/deno-dom-wasm.ts"; // @deno-types="npm:@types/nodemailer@6.4.14" -export {createTransport} from "npm:nodemailer@6.9.9"; \ No newline at end of file +export {createTransport} from "npm:nodemailer@6.9.13"; \ No newline at end of file diff --git a/deps.pure_ext.ts b/deps.pure_ext.ts index 5ef9d24..2179d0c 100644 --- a/deps.pure_ext.ts +++ b/deps.pure_ext.ts @@ -1,7 +1,7 @@ -// @deno-types="https://deno.land/std@0.215.0/csv/mod.ts" -export {parse, stringify} from "https://esm.sh/gh/denoland/deno_std@0.215.0/csv/mod.ts?bundle&target=esnext"; -// @deno-types="https://deno.land/x/zipjs@v2.7.34/index.d.ts" -export {ZipReader, ZipWriter, Uint8ArrayReader, Uint8ArrayWriter} from "https://esm.sh/gh/gildas-lormeau/zip.js@v2.7.34/index.js?bundle&target=esnext"; +// @deno-types="https://deno.land/std@0.220.1/csv/mod.ts" +export {parse, stringify} from "https://esm.sh/gh/denoland/deno_std@0.220.1/csv/mod.ts?bundle&target=esnext"; +// @deno-types="https://deno.land/x/zipjs@v2.7.40/index.d.ts" +export {ZipReader, ZipWriter, Uint8ArrayReader, Uint8ArrayWriter} from "https://esm.sh/gh/gildas-lormeau/zip.js@v2.7.40/index.js?bundle&target=esnext"; // @deno-types="https://cdn.sheetjs.com/xlsx-0.20.1/package/types/index.d.ts" export {type WorkBook as RawWorkBook, type WorkSheet as RawWorkSheet, type CellObject as RawWorkCell, set_cptable, read as xlsxRead, write as xlsxWrite, utils as xlsxUtil} from "https://cdn.sheetjs.com/xlsx-0.20.1/package/xlsx.mjs"; diff --git a/deps.test.ts b/deps.test.ts index df66f84..4fe6a4d 100644 --- a/deps.test.ts +++ b/deps.test.ts @@ -1,7 +1,7 @@ -export {assertEquals} from "https://deno.land/std@0.215.0/assert/mod.ts"; -export {dirname, fromFileUrl} from "https://deno.land/std@0.215.0/path/mod.ts"; -export {exists} from "https://deno.land/std@0.215.0/fs/mod.ts"; -export {delay} from "https://deno.land/std@0.215.0/async/mod.ts"; +export {assertEquals} from "https://deno.land/std@0.220.1/assert/mod.ts"; +export {dirname, fromFileUrl} from "https://deno.land/std@0.220.1/path/mod.ts"; +export {exists} from "https://deno.land/std@0.220.1/fs/mod.ts"; +export {delay} from "https://deno.land/std@0.220.1/async/mod.ts"; export {DOMParser} from "https://deno.land/x/deno_dom@v0.1.45/deno-dom-wasm.ts"; diff --git a/src/pure/crypto.ts b/src/pure/crypto.ts index 431bf99..15debea 100644 --- a/src/pure/crypto.ts +++ b/src/pure/crypto.ts @@ -1,3 +1,5 @@ +import {byteConcat} from "./byte.ts"; + /** * Serialized `CryptoKeyPair`. */ @@ -116,11 +118,7 @@ export async function pkEncrypt(data:Uint8Array, {publicKey, privateKey}:Portabl iv: generateRandom(12) }; - const output = new Uint8Array(aes.iv.byteLength + data.byteLength + 16); - output.set(aes.iv, 0); - output.set(new Uint8Array(await crypto.subtle.encrypt(aes, await deriveKey({publicKey, privateKey}), data)), aes.iv.byteLength); - - return output; + return byteConcat(aes.iv, await crypto.subtle.encrypt(aes, await deriveKey({publicKey, privateKey}), data)); } /** diff --git a/src/pure/worker.ts b/src/pure/worker.ts index 439e1d4..b19b108 100644 --- a/src/pure/worker.ts +++ b/src/pure/worker.ts @@ -1,3 +1,6 @@ +import {b64DataURL} from "./base64.ts"; +import {u8Encode} from "./text.ts"; + interface TaskMessage{ message: T; transfers?: (Transferable | ArrayBufferView)[]; @@ -31,10 +34,9 @@ export type TaskContext = (message:T, tran * ``` */ export function createTask(task:TaskAction):TaskContext{ - const script = task.toString(); - const regist = /*js*/` + const script = /*js*/` globalThis.onmessage = async({data})=>{ - const {message, transfers} = await(${script})(data); + const {message, transfers} = await(${task.toString()})(data); globalThis.postMessage(message, { transfer: transfers?.map(v => "buffer" in v ? v.buffer : v) }); @@ -43,29 +45,23 @@ export function createTask(task:TaskAction return (message, transfers)=>{ return new Promise((res, rej)=>{ - const url = URL.createObjectURL(new Blob([regist])); - const worker = new Worker(url, { + const worker = new Worker(b64DataURL(u8Encode(script), "text/javascript"), { type: "module" }); - function disposeWorker(){ - worker.terminate(); - URL.revokeObjectURL(url); - } - worker.onmessage = ({data})=>{ res(data); - disposeWorker(); + worker.terminate(); }; worker.onerror = (e)=>{ rej(e); - disposeWorker(); + worker.terminate(); }; worker.onmessageerror = (e)=>{ rej(e); - disposeWorker(); + worker.terminate(); }; worker.postMessage(message, {