forked from trent_larson/crowd-funder-for-time-pwa
fix: buffer typescript error in util.ts when parsing ArrayBuffer
This commit is contained in:
2
package-lock.json
generated
2
package-lock.json
generated
@@ -28,7 +28,6 @@
|
|||||||
"@vueuse/core": "^10.9.0",
|
"@vueuse/core": "^10.9.0",
|
||||||
"@zxing/text-encoding": "^0.9.0",
|
"@zxing/text-encoding": "^0.9.0",
|
||||||
"axios": "^1.6.8",
|
"axios": "^1.6.8",
|
||||||
"buffer": "^6.0.3",
|
|
||||||
"class-transformer": "^0.5.1",
|
"class-transformer": "^0.5.1",
|
||||||
"dexie": "^3.2.7",
|
"dexie": "^3.2.7",
|
||||||
"dexie-export-import": "^4.1.1",
|
"dexie-export-import": "^4.1.1",
|
||||||
@@ -66,7 +65,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/leaflet": "^1.9.8",
|
"@types/leaflet": "^1.9.8",
|
||||||
"@types/node": "^20.11.30",
|
|
||||||
"@types/ramda": "^0.29.11",
|
"@types/ramda": "^0.29.11",
|
||||||
"@types/three": "^0.155.1",
|
"@types/three": "^0.155.1",
|
||||||
"@types/ua-parser-js": "^0.7.39",
|
"@types/ua-parser-js": "^0.7.39",
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
"@vueuse/core": "^10.9.0",
|
"@vueuse/core": "^10.9.0",
|
||||||
"@zxing/text-encoding": "^0.9.0",
|
"@zxing/text-encoding": "^0.9.0",
|
||||||
"axios": "^1.6.8",
|
"axios": "^1.6.8",
|
||||||
"buffer": "^6.0.3",
|
|
||||||
"class-transformer": "^0.5.1",
|
"class-transformer": "^0.5.1",
|
||||||
"dexie": "^3.2.7",
|
"dexie": "^3.2.7",
|
||||||
"dexie-export-import": "^4.1.1",
|
"dexie-export-import": "^4.1.1",
|
||||||
@@ -67,7 +66,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/leaflet": "^1.9.8",
|
"@types/leaflet": "^1.9.8",
|
||||||
"@types/node": "^20.11.30",
|
|
||||||
"@types/ramda": "^0.29.11",
|
"@types/ramda": "^0.29.11",
|
||||||
"@types/three": "^0.155.1",
|
"@types/three": "^0.155.1",
|
||||||
"@types/ua-parser-js": "^0.7.39",
|
"@types/ua-parser-js": "^0.7.39",
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import { deriveAddress, generateSeed, newIdentifier } from "@/libs/crypto";
|
|||||||
import { GenericServerRecord, containsHiddenDid } from "@/libs/endorserServer";
|
import { GenericServerRecord, containsHiddenDid } from "@/libs/endorserServer";
|
||||||
import * as serverUtil from "@/libs/endorserServer";
|
import * as serverUtil from "@/libs/endorserServer";
|
||||||
|
|
||||||
import { Buffer } from "buffer/";
|
|
||||||
|
|
||||||
// If you edit this, check that the numbers still line up on the side in the alert (on mobile, too),
|
// If you edit this, check that the numbers still line up on the side in the alert (on mobile, too),
|
||||||
// and make sure they can take all actions while the notification shows.
|
// and make sure they can take all actions while the notification shows.
|
||||||
export const ONBOARD_MESSAGE =
|
export const ONBOARD_MESSAGE =
|
||||||
@@ -237,6 +235,19 @@ export const generateSaveAndActivateIdentity = async (): Promise<string> => {
|
|||||||
return newId.did;
|
return newId.did;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function getBase64(subscription: PushSubscription, key: PushEncryptionKeyName) {
|
||||||
|
const buffer = subscription.getKey(key);
|
||||||
|
if (!buffer) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const value = Buffer.from(buffer);
|
||||||
|
return value
|
||||||
|
.toString("base64")
|
||||||
|
.replace(/\+/g, "-")
|
||||||
|
.replace(/\//g, "_")
|
||||||
|
.replace(/=+$/, "");
|
||||||
|
}
|
||||||
|
|
||||||
export const sendTestThroughPushServer = async (
|
export const sendTestThroughPushServer = async (
|
||||||
subscription: PushSubscription,
|
subscription: PushSubscription,
|
||||||
skipFilter: boolean,
|
skipFilter: boolean,
|
||||||
@@ -253,18 +264,8 @@ export const sendTestThroughPushServer = async (
|
|||||||
// Use something other than "Daily Update" https://gitea.anomalistdesign.com/trent_larson/py-push-server/src/commit/3c0e196c11bc98060ec5934e99e7dbd591b5da4d/app.py#L213
|
// Use something other than "Daily Update" https://gitea.anomalistdesign.com/trent_larson/py-push-server/src/commit/3c0e196c11bc98060ec5934e99e7dbd591b5da4d/app.py#L213
|
||||||
const DIRECT_PUSH_TITLE = "DIRECT_NOTIFICATION";
|
const DIRECT_PUSH_TITLE = "DIRECT_NOTIFICATION";
|
||||||
|
|
||||||
const auth = Buffer.from(subscription.getKey("auth"));
|
const authB64 = getBase64(subscription, "auth");
|
||||||
const authB64 = auth
|
const p256dhB64 = getBase64(subscription, "p256dh");
|
||||||
.toString("base64")
|
|
||||||
.replace(/\+/g, "-")
|
|
||||||
.replace(/\//g, "_")
|
|
||||||
.replace(/=+$/, "");
|
|
||||||
const p256dh = Buffer.from(subscription.getKey("p256dh"));
|
|
||||||
const p256dhB64 = p256dh
|
|
||||||
.toString("base64")
|
|
||||||
.replace(/\+/g, "-")
|
|
||||||
.replace(/\//g, "_")
|
|
||||||
.replace(/=+$/, "");
|
|
||||||
const newPayload = {
|
const newPayload = {
|
||||||
endpoint: subscription.endpoint,
|
endpoint: subscription.endpoint,
|
||||||
keys: {
|
keys: {
|
||||||
|
|||||||
@@ -1,48 +1,35 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"allowJs": true,
|
"target": "ES2020", // Latest ECMAScript features that are widely supported by modern browsers
|
||||||
"resolveJsonModule": true,
|
"module": "ESNext", // Use ES modules
|
||||||
"target": "ES2020",
|
"strict": true, // Enable all strict type checking options
|
||||||
"module": "ESNext",
|
"jsx": "preserve", // Preserves JSX to be transformed by Babel or another transpiler
|
||||||
"strict": true,
|
"moduleResolution": "node", // Use Node.js style module resolution
|
||||||
"strictPropertyInitialization": false,
|
|
||||||
"jsx": "preserve",
|
|
||||||
"moduleResolution": "bundler",
|
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"skipLibCheck": true,
|
"esModuleInterop": true, // Enables compatibility with CommonJS modules for default imports
|
||||||
"esModuleInterop": true,
|
"allowSyntheticDefaultImports": true, // Allow default imports from modules with no default export
|
||||||
"allowSyntheticDefaultImports": true,
|
"forceConsistentCasingInFileNames": true, // Disallow inconsistently-cased references to the same file
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"useDefineForClassFields": true,
|
"useDefineForClassFields": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"baseUrl": "./src",
|
"baseUrl": "./src", // Base directory to resolve non-relative module names
|
||||||
"types": [
|
|
||||||
"node"
|
|
||||||
],
|
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/components/*": ["components/*"],
|
"@/components/*": ["components/*"],
|
||||||
"@/views/*": ["views/*"],
|
"@/views/*": ["views/*"],
|
||||||
"@/db/*": ["db/*"],
|
"@/db/*": ["db/*"],
|
||||||
"@/libs/*": ["libs/*"],
|
"@/libs/*": ["libs/*"],
|
||||||
"@/constants/*": ["constants/*"],
|
"@/constants/*": ["constants/*"],
|
||||||
"@/store/*": ["store/*"],
|
"@/store/*": ["store/*"]
|
||||||
},
|
},
|
||||||
"lib": [
|
"lib": ["ES2020", "dom", "dom.iterable"], // Include typings for ES2020 and DOM APIs
|
||||||
"esnext",
|
},
|
||||||
"es2020",
|
"include": [
|
||||||
"dom",
|
|
||||||
"dom.iterable",
|
|
||||||
"scripthost"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"src/**/*.ts",
|
"src/**/*.ts",
|
||||||
"src/**/*.tsx",
|
"src/**/*.tsx",
|
||||||
"src/**/*.vue",
|
"src/**/*.vue",
|
||||||
"tests/**/*.ts",
|
"tests/**/*.ts",
|
||||||
"tests/**/*.tsx"
|
"tests/**/*.tsx"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules"
|
"node_modules"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user