@blazetrails/web-push 0.0.0-stage → 0.1.0-alpha0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Dean Marano and Trails contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=constants.generated.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { defineConstants } from "@blazetrails/ruby-compat/classpath";
2
+ import * as m0 from "./encryption.js";
3
+ import * as m1 from "./errors.js";
4
+ import * as m2 from "./request.js";
5
+ import * as m3 from "./vapid-key.js";
6
+ defineConstants([
7
+ [() => m1, "ConfigurationError", "WebPush::ConfigurationError"],
8
+ [() => m0, "Encryption", "WebPush::Encryption"],
9
+ [() => m1, "Error", "WebPush::Error"],
10
+ [() => m1, "ExpiredSubscription", "WebPush::ExpiredSubscription"],
11
+ [() => m1, "InvalidSubscription", "WebPush::InvalidSubscription"],
12
+ [() => m1, "PayloadTooLarge", "WebPush::PayloadTooLarge"],
13
+ [() => m1, "PushServiceError", "WebPush::PushServiceError"],
14
+ [() => m2, "Request", "WebPush::Request"],
15
+ [() => m1, "ResponseError", "WebPush::ResponseError"],
16
+ [() => m1, "TooManyRequests", "WebPush::TooManyRequests"],
17
+ [() => m1, "Unauthorized", "WebPush::Unauthorized"],
18
+ [() => m3, "VapidKey", "WebPush::VapidKey"],
19
+ ]);
20
+ //# sourceMappingURL=constants.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.generated.js","sourceRoot":"","sources":["../lib/constants.generated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,eAAe,CAAC;IACd,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,oBAAoB,EAAE,6BAA6B,CAAC;IAC/D,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,YAAY,EAAE,qBAAqB,CAAC;IAC/C,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,gBAAgB,CAAC;IACrC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,qBAAqB,EAAE,8BAA8B,CAAC;IACjE,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,qBAAqB,EAAE,8BAA8B,CAAC;IACjE,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,iBAAiB,EAAE,0BAA0B,CAAC;IACzD,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,kBAAkB,EAAE,2BAA2B,CAAC;IAC3D,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,kBAAkB,CAAC;IACzC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,eAAe,EAAE,wBAAwB,CAAC;IACrD,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,iBAAiB,EAAE,0BAA0B,CAAC;IACzD,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,cAAc,EAAE,uBAAuB,CAAC;IACnD,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,mBAAmB,CAAC;CAC5C,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { OpenSSL } from "@blazetrails/ruby-compat/openssl";
2
+ export declare const Encryption: {
3
+ encrypt(message: string | Uint8Array | null | undefined, p256dh: string | null | undefined, auth: string | null | undefined): Uint8Array;
4
+ /** @internal */
5
+ encryptPayload(plaintext: string | Uint8Array, contentEncryptionKey: Uint8Array, nonce: Uint8Array): Uint8Array;
6
+ /** @internal */
7
+ convert16bit(key: InstanceType<typeof OpenSSL.BN>): Uint8Array;
8
+ /** @internal */
9
+ assertArguments(message: unknown, p256dh: unknown, auth: unknown): void;
10
+ /** @internal */
11
+ isBlank(value: unknown): boolean;
12
+ };
13
+ //# sourceMappingURL=encryption.d.ts.map
@@ -0,0 +1,71 @@
1
+ import { WebPush as WebPushSeat } from "./namespaces.js";
2
+ import { ArgumentError } from "@blazetrails/ruby-compat";
3
+ import { OpenSSL } from "@blazetrails/ruby-compat/openssl";
4
+ import { pack } from "@blazetrails/ruby-compat/array";
5
+ import { rbStrPlus } from "@blazetrails/ruby-compat/string/method-table";
6
+ import { SecureRandom } from "@blazetrails/ruby-compat/secure-random";
7
+ import { WebPush } from "./web-push.js";
8
+ export const Encryption = {
9
+ encrypt(message, p256dh, auth) {
10
+ Encryption.assertArguments(message, p256dh, auth);
11
+ const groupName = "prime256v1";
12
+ const hash = "SHA256";
13
+ const salt = SecureRandom.bytes(16);
14
+ const server = OpenSSL.PKey.EC.generate(groupName);
15
+ const serverPublicKeyBn = server.publicKey.toBn();
16
+ const group = new OpenSSL.PKey.EC.Group(groupName);
17
+ const clientPublicKeyBn = new OpenSSL.BN(WebPush.decode64(p256dh), 2);
18
+ const clientPublicKey = new OpenSSL.PKey.EC.Point(group, clientPublicKeyBn);
19
+ const sharedSecret = server.dhComputeKey(clientPublicKey);
20
+ const clientAuthToken = WebPush.decode64(auth);
21
+ const info = rbStrPlus(rbStrPlus(new TextEncoder().encode("WebPush: info\0"), clientPublicKeyBn.toS(2)), serverPublicKeyBn.toS(2));
22
+ const contentEncryptionKeyInfo = "Content-Encoding: aes128gcm\0";
23
+ const nonceInfo = "Content-Encoding: nonce\0";
24
+ const prk = OpenSSL.KDF.hkdf(sharedSecret, { salt: clientAuthToken, info, hash, length: 32 });
25
+ const contentEncryptionKey = OpenSSL.KDF.hkdf(prk, {
26
+ salt,
27
+ info: contentEncryptionKeyInfo,
28
+ hash,
29
+ length: 16,
30
+ });
31
+ const nonce = OpenSSL.KDF.hkdf(prk, { salt, info: nonceInfo, hash, length: 12 });
32
+ const ciphertext = Encryption.encryptPayload(message, contentEncryptionKey, nonce);
33
+ const serverkey16bn = Encryption.convert16bit(serverPublicKeyBn);
34
+ const rs = ciphertext.length;
35
+ if (rs > 4096)
36
+ throw new ArgumentError("encrypted payload is too big");
37
+ const aes128gcmheader = rbStrPlus(rbStrPlus(rbStrPlus(salt, pack([rs], "N*")), pack([serverkey16bn.length], "C*")), serverkey16bn);
38
+ return rbStrPlus(aes128gcmheader, ciphertext);
39
+ },
40
+ /** @internal */
41
+ encryptPayload(plaintext, contentEncryptionKey, nonce) {
42
+ const cipher = new OpenSSL.Cipher("aes-128-gcm");
43
+ cipher.encrypt();
44
+ cipher.key = contentEncryptionKey;
45
+ cipher.iv = nonce;
46
+ const text = cipher.update(plaintext);
47
+ const padding = cipher.update("\x02\0");
48
+ const eText = rbStrPlus(rbStrPlus(text, padding), cipher.final());
49
+ const eTag = cipher.authTag;
50
+ return rbStrPlus(eText, eTag);
51
+ },
52
+ /** @internal */
53
+ convert16bit(key) {
54
+ return pack([key.toS(16)], "H*");
55
+ },
56
+ /** @internal */
57
+ assertArguments(message, p256dh, auth) {
58
+ if (Encryption.isBlank(message))
59
+ throw new ArgumentError("message cannot be blank");
60
+ if (Encryption.isBlank(p256dh))
61
+ throw new ArgumentError("p256dh cannot be blank");
62
+ if (Encryption.isBlank(auth))
63
+ throw new ArgumentError("auth cannot be blank");
64
+ },
65
+ /** @internal */
66
+ isBlank(value) {
67
+ return value == null || value.length === 0;
68
+ },
69
+ };
70
+ WebPushSeat.Encryption = Encryption;
71
+ //# sourceMappingURL=encryption.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encryption.js","sourceRoot":"","sources":["../lib/encryption.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,OAAO,CACL,OAA+C,EAC/C,MAAiC,EACjC,IAA+B;QAE/B,UAAU,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAElD,MAAM,SAAS,GAAG,YAAY,CAAC;QAC/B,MAAM,IAAI,GAAG,QAAQ,CAAC;QACtB,MAAM,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAEpC,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,CAA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AE5B,OAAO,SAAS,CAAC,KAAK,EAAE,IAAI,CAAe,CAAC;IAC9C,CAAC;IAED,gBAAgB;IAChB,YAAY,CAAC,GAAoC;QAC/C,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,gBAAgB;IAChB,eAAe,CAAC,OAAgB,EAAE,MAAe,EAAE,IAAa;QAC9D,IAAI,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC;YAAE,MAAM,IAAI,aAAa,CAAC,yBAAyB,CAAC,CAAC;QACpF,IAAI,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,MAAM,IAAI,aAAa,CAAC,wBAAwB,CAAC,CAAC;QAClF,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC;YAAE,MAAM,IAAI,aAAa,CAAC,sBAAsB,CAAC,CAAC;IAChF,CAAC;IAED,gBAAgB;IAChB,OAAO,CAAC,KAAc;QACpB,OAAO,KAAK,IAAI,IAAI,IAAK,KAA4B,CAAC,MAAM,KAAK,CAAC,CAAC;IACrE,CAAC;CACF,CAAC;AAEF,WAAW,CAAC,UAAU,GAAG,UAAU,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { RuntimeError } from "@blazetrails/ruby-compat";
2
+ import type { Net } from "@blazetrails/ruby-compat/net/protocol";
3
+ export declare class Error extends RuntimeError {
4
+ }
5
+ export declare class ConfigurationError extends Error {
6
+ }
7
+ type Response = InstanceType<typeof Net.HTTPResponse>;
8
+ export declare class ResponseError extends Error {
9
+ readonly response: Response;
10
+ readonly host: string | null;
11
+ constructor(response: Response, host: string | null);
12
+ }
13
+ export declare class InvalidSubscription extends ResponseError {
14
+ }
15
+ export declare class ExpiredSubscription extends ResponseError {
16
+ }
17
+ export declare class Unauthorized extends ResponseError {
18
+ }
19
+ export declare class PayloadTooLarge extends ResponseError {
20
+ }
21
+ export declare class TooManyRequests extends ResponseError {
22
+ }
23
+ export declare class PushServiceError extends ResponseError {
24
+ }
25
+ export {};
26
+ //# sourceMappingURL=errors.d.ts.map
package/dist/errors.js ADDED
@@ -0,0 +1,38 @@
1
+ import { WebPush as WebPushSeat } from "./namespaces.js";
2
+ import { RuntimeError } from "@blazetrails/ruby-compat";
3
+ import { rbInspect, rbObjAsString } from "@blazetrails/ruby-compat/object";
4
+ export class Error extends RuntimeError {
5
+ }
6
+ export class ConfigurationError extends Error {
7
+ }
8
+ export class ResponseError extends Error {
9
+ response;
10
+ host;
11
+ constructor(response, host) {
12
+ super(`host: ${rbObjAsString(host)}, ${rbInspect(response)}\nbody:\n${response.body instanceof Uint8Array ? new TextDecoder().decode(response.body) : rbObjAsString(response.body)}`);
13
+ this.response = response;
14
+ this.host = host;
15
+ }
16
+ }
17
+ export class InvalidSubscription extends ResponseError {
18
+ }
19
+ export class ExpiredSubscription extends ResponseError {
20
+ }
21
+ export class Unauthorized extends ResponseError {
22
+ }
23
+ export class PayloadTooLarge extends ResponseError {
24
+ }
25
+ export class TooManyRequests extends ResponseError {
26
+ }
27
+ export class PushServiceError extends ResponseError {
28
+ }
29
+ WebPushSeat.Error = Error;
30
+ WebPushSeat.ConfigurationError = ConfigurationError;
31
+ WebPushSeat.ResponseError = ResponseError;
32
+ WebPushSeat.InvalidSubscription = InvalidSubscription;
33
+ WebPushSeat.ExpiredSubscription = ExpiredSubscription;
34
+ WebPushSeat.Unauthorized = Unauthorized;
35
+ WebPushSeat.PayloadTooLarge = PayloadTooLarge;
36
+ WebPushSeat.TooManyRequests = TooManyRequests;
37
+ WebPushSeat.PushServiceError = PushServiceError;
38
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../lib/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAA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AAe,GAAG,eAAe,CAAC;AAC9C,WAAW,CAAC,gBAAgB,GAAG,gBAAgB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const WebPush: {
2
+ name: string;
3
+ } & Record<string, unknown>;
4
+ //# sourceMappingURL=namespaces.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { TopLevel, constSet } from "@blazetrails/ruby-compat";
2
+ export const WebPush = { name: "WebPush" };
3
+ constSet(TopLevel, "WebPush", WebPush);
4
+ //# sourceMappingURL=namespaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namespaces.js","sourceRoot":"","sources":["../lib/namespaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAE9D,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,SAAS,EAAgD,CAAC;AACzF,QAAQ,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC"}
@@ -0,0 +1,85 @@
1
+ import { Net } from "@blazetrails/ruby-compat/net/protocol";
2
+ export type Subscription = {
3
+ endpoint: string;
4
+ keys: {
5
+ p256dh: string;
6
+ auth: string;
7
+ };
8
+ };
9
+ export interface VapidOptions {
10
+ subject?: string;
11
+ publicKey?: string | null;
12
+ privateKey?: string | null;
13
+ pem?: string | null;
14
+ expiration?: number;
15
+ }
16
+ export interface RequestOptions {
17
+ ttl?: number | string | null;
18
+ urgency?: string;
19
+ sslTimeout?: number | null;
20
+ openTimeout?: number | null;
21
+ readTimeout?: number | null;
22
+ proxy?: string | null;
23
+ [option: string]: unknown;
24
+ }
25
+ type Response = InstanceType<typeof Net.HTTPResponse>;
26
+ export declare class Request {
27
+ /** @internal */
28
+ _endpoint: string;
29
+ /** @internal */
30
+ _payload: Uint8Array | null;
31
+ /** @internal */
32
+ _vapidOptions: VapidOptions;
33
+ /** @internal */
34
+ _options: RequestOptions & {
35
+ ttl: number | string | null;
36
+ urgency: string;
37
+ };
38
+ private _uri?;
39
+ constructor({ message, subscription, vapid, ...options }: {
40
+ message?: string | null;
41
+ subscription: Subscription;
42
+ vapid: VapidOptions;
43
+ } & RequestOptions);
44
+ perform(): Promise<Response>;
45
+ proxyOptions(): [] | [string | null, number | null, string | null, string | null];
46
+ headers(): Record<string, string>;
47
+ buildVapidHeader(): string;
48
+ body(): Uint8Array | string;
49
+ /** @internal */
50
+ private uri;
51
+ /** @internal */
52
+ private ttl;
53
+ /** @internal */
54
+ private urgency;
55
+ /** @internal */
56
+ private jwtPayload;
57
+ /** @internal */
58
+ private jwtHeaderFields;
59
+ /** @internal */
60
+ private audience;
61
+ /** @internal */
62
+ private expiration;
63
+ /** @internal */
64
+ private subject;
65
+ /** @internal */
66
+ private vapidPublicKey;
67
+ /** @internal */
68
+ private vapidPrivateKey;
69
+ /** @internal */
70
+ private vapidPem;
71
+ /** @internal */
72
+ private defaultOptions;
73
+ /** @internal */
74
+ private buildPayload;
75
+ /** @internal */
76
+ private encryptPayload;
77
+ /** @internal */
78
+ private isVapid;
79
+ /** @internal */
80
+ private trimEncode64;
81
+ /** @internal */
82
+ private verifyResponse;
83
+ }
84
+ export {};
85
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1,180 @@
1
+ import { WebPush as WebPushSeat } from "./namespaces.js";
2
+ import { HTTP } from "@blazetrails/ruby-compat/net/http";
3
+ import { Net } from "@blazetrails/ruby-compat/net/protocol";
4
+ import { fetch } from "@blazetrails/ruby-compat/hash";
5
+ import { rbObjAsString } from "@blazetrails/ruby-compat/object";
6
+ import { URI } from "@blazetrails/ruby-compat/uri";
7
+ import { JWT } from "@blazetrails/jwt";
8
+ import { Encryption } from "./encryption.js";
9
+ import { ExpiredSubscription, InvalidSubscription, PayloadTooLarge, PushServiceError, ResponseError, TooManyRequests, Unauthorized, } from "./errors.js";
10
+ import { VapidKey } from "./vapid-key.js";
11
+ import { WebPush } from "./web-push.js";
12
+ export class Request {
13
+ /** @internal */
14
+ _endpoint;
15
+ /** @internal */
16
+ _payload;
17
+ /** @internal */
18
+ _vapidOptions;
19
+ /** @internal */
20
+ _options;
21
+ _uri;
22
+ constructor({ message = "", subscription, vapid, ...options }) {
23
+ const endpoint = fetch(subscription, "endpoint");
24
+ this._endpoint = endpoint;
25
+ this._payload = this.buildPayload(message, subscription);
26
+ this._vapidOptions = vapid;
27
+ this._options = { ...this.defaultOptions(), ...options };
28
+ }
29
+ async perform() {
30
+ const http = new HTTP(this.uri().host, this.uri().port, ...this.proxyOptions());
31
+ http.useSsl = true;
32
+ if (this._options.sslTimeout != null)
33
+ http.sslTimeout = this._options.sslTimeout;
34
+ if (this._options.openTimeout != null)
35
+ http.openTimeout = this._options.openTimeout;
36
+ if (this._options.readTimeout != null)
37
+ http.readTimeout = this._options.readTimeout;
38
+ const req = new HTTP.Post(this.uri().requestUri(), this.headers());
39
+ req.body = this.body();
40
+ const resp = await http.request(req);
41
+ this.verifyResponse(resp);
42
+ return resp;
43
+ }
44
+ proxyOptions() {
45
+ if (this._options.proxy == null)
46
+ return [];
47
+ const proxyUri = URI.parse(this._options.proxy);
48
+ return [proxyUri.host, proxyUri.port, proxyUri.user, proxyUri.password];
49
+ }
50
+ headers() {
51
+ const headers = {};
52
+ headers["Content-Type"] = "application/octet-stream";
53
+ headers["Ttl"] = this.ttl();
54
+ headers["Urgency"] = this.urgency();
55
+ if (this._payload != null) {
56
+ headers["Content-Encoding"] = "aes128gcm";
57
+ headers["Content-Length"] = String(this._payload.length);
58
+ }
59
+ if (this.isVapid()) {
60
+ headers["Authorization"] = this.buildVapidHeader();
61
+ }
62
+ return headers;
63
+ }
64
+ buildVapidHeader() {
65
+ const vapidKey = this.vapidPem() != null
66
+ ? VapidKey.fromPem(this.vapidPem())
67
+ : VapidKey.fromKeys(this.vapidPublicKey(), this.vapidPrivateKey());
68
+ const jwt = JWT.encode(this.jwtPayload(), vapidKey.curve, "ES256", this.jwtHeaderFields());
69
+ const p256ecdsa = vapidKey.publicKeyForPushHeader();
70
+ return `vapid t=${jwt},k=${p256ecdsa}`;
71
+ }
72
+ body() {
73
+ return this._payload ?? "";
74
+ }
75
+ /** @internal */
76
+ uri() {
77
+ return (this._uri ??= URI.parse(this._endpoint));
78
+ }
79
+ /** @internal */
80
+ ttl() {
81
+ return rbObjAsString(fetch(this._options, "ttl"));
82
+ }
83
+ /** @internal */
84
+ urgency() {
85
+ return rbObjAsString(fetch(this._options, "urgency"));
86
+ }
87
+ /** @internal */
88
+ jwtPayload() {
89
+ return {
90
+ aud: this.audience(),
91
+ exp: Math.trunc(Date.now() / 1000) + this.expiration(),
92
+ sub: this.subject(),
93
+ };
94
+ }
95
+ /** @internal */
96
+ jwtHeaderFields() {
97
+ return { typ: "JWT", alg: "ES256" };
98
+ }
99
+ /** @internal */
100
+ audience() {
101
+ return this.uri().scheme + "://" + this.uri().host;
102
+ }
103
+ /** @internal */
104
+ expiration() {
105
+ return Object.hasOwn(this._vapidOptions, "expiration")
106
+ ? this._vapidOptions.expiration
107
+ : 12 * 60 * 60;
108
+ }
109
+ /** @internal */
110
+ subject() {
111
+ return Object.hasOwn(this._vapidOptions, "subject")
112
+ ? this._vapidOptions.subject
113
+ : "mailto:sender@example.com";
114
+ }
115
+ /** @internal */
116
+ vapidPublicKey() {
117
+ return Object.hasOwn(this._vapidOptions, "publicKey") ? this._vapidOptions.publicKey : null;
118
+ }
119
+ /** @internal */
120
+ vapidPrivateKey() {
121
+ return Object.hasOwn(this._vapidOptions, "privateKey") ? this._vapidOptions.privateKey : null;
122
+ }
123
+ /** @internal */
124
+ vapidPem() {
125
+ return Object.hasOwn(this._vapidOptions, "pem") ? this._vapidOptions.pem : null;
126
+ }
127
+ /** @internal */
128
+ defaultOptions() {
129
+ return {
130
+ ttl: 60 * 60 * 24 * 7 * 4,
131
+ urgency: "normal",
132
+ };
133
+ }
134
+ /** @internal */
135
+ buildPayload(message, subscription) {
136
+ if (message == null || message === "")
137
+ return null;
138
+ return this.encryptPayload(message, fetch(subscription, "keys"));
139
+ }
140
+ /** @internal */
141
+ encryptPayload(message, { p256dh, auth }) {
142
+ return Encryption.encrypt(message, p256dh, auth);
143
+ }
144
+ /** @internal */
145
+ isVapid() {
146
+ return Object.keys(this._vapidOptions).length > 0;
147
+ }
148
+ /** @internal */
149
+ trimEncode64(bin) {
150
+ return WebPush.encode64(bin).replaceAll("=", "");
151
+ }
152
+ /** @internal */
153
+ verifyResponse(resp) {
154
+ if (resp instanceof Net.HTTPGone) {
155
+ throw new ExpiredSubscription(resp, this.uri().host);
156
+ }
157
+ else if (resp instanceof Net.HTTPNotFound) {
158
+ throw new InvalidSubscription(resp, this.uri().host);
159
+ }
160
+ else if (resp instanceof Net.HTTPUnauthorized ||
161
+ resp instanceof Net.HTTPForbidden ||
162
+ (resp instanceof Net.HTTPBadRequest && resp.message === "UnauthorizedRegistration")) {
163
+ throw new Unauthorized(resp, this.uri().host);
164
+ }
165
+ else if (resp instanceof Net.HTTPRequestEntityTooLarge) {
166
+ throw new PayloadTooLarge(resp, this.uri().host);
167
+ }
168
+ else if (resp instanceof Net.HTTPTooManyRequests) {
169
+ throw new TooManyRequests(resp, this.uri().host);
170
+ }
171
+ else if (resp instanceof Net.HTTPServerError) {
172
+ throw new PushServiceError(resp, this.uri().host);
173
+ }
174
+ else if (!(resp instanceof Net.HTTPSuccess)) {
175
+ throw new ResponseError(resp, this.uri().host);
176
+ }
177
+ }
178
+ }
179
+ WebPushSeat.Request = Request;
180
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../lib/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,mCAAmC,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,uCAAuC,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE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AAI,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;CACF;AAED,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { OpenSSL } from "@blazetrails/ruby-compat/openssl";
2
+ type EC = InstanceType<typeof OpenSSL.PKey.EC>;
3
+ type Point = InstanceType<typeof OpenSSL.PKey.EC.Point>;
4
+ type BN = InstanceType<typeof OpenSSL.BN>;
5
+ export declare class VapidKey {
6
+ static fromKeys(publicKey: string, privateKey: string): VapidKey;
7
+ static fromPem(pem: string): VapidKey;
8
+ curve: EC;
9
+ constructor(pkey?: EC | null);
10
+ get publicKey(): string;
11
+ publicKeyForPushHeader(): string;
12
+ get privateKey(): string;
13
+ set publicKey(key: string);
14
+ set privateKey(key: string);
15
+ setKeysBang(publicKey?: string | Point | null, privateKey?: string | BN | null): void;
16
+ curveName(): string;
17
+ group(): InstanceType<typeof OpenSSL.PKey.EC.Group>;
18
+ toH(): {
19
+ publicKey: string;
20
+ privateKey: string;
21
+ };
22
+ toHash(): {
23
+ publicKey: string;
24
+ privateKey: string;
25
+ };
26
+ toPem(): string;
27
+ privateKeyToPem(): string;
28
+ publicKeyToPem(): string;
29
+ inspect(): string;
30
+ /** @internal */
31
+ private toBigNum;
32
+ /** @internal */
33
+ private encode64;
34
+ /** @internal */
35
+ private trimEncode64;
36
+ }
37
+ export {};
38
+ //# sourceMappingURL=vapid-key.d.ts.map
@@ -0,0 +1,97 @@
1
+ import { WebPush as WebPushSeat } from "./namespaces.js";
2
+ import { OpenSSL } from "@blazetrails/ruby-compat/openssl";
3
+ import { rbModName, rbObjId } from "@blazetrails/ruby-compat/object";
4
+ import { WebPush } from "./web-push.js";
5
+ export class VapidKey {
6
+ static fromKeys(publicKey, privateKey) {
7
+ const key = new this();
8
+ key.setKeysBang(publicKey, privateKey);
9
+ return key;
10
+ }
11
+ static fromPem(pem) {
12
+ return new this(OpenSSL.PKey.read(pem));
13
+ }
14
+ curve;
15
+ constructor(pkey = null) {
16
+ this.curve = pkey;
17
+ if (this.curve == null)
18
+ this.curve = OpenSSL.PKey.EC.generate("prime256v1");
19
+ }
20
+ get publicKey() {
21
+ return this.encode64(this.curve.publicKey.toBn().toS(2));
22
+ }
23
+ publicKeyForPushHeader() {
24
+ return this.trimEncode64(this.curve.publicKey.toBn().toS(2));
25
+ }
26
+ get privateKey() {
27
+ return this.encode64(this.curve.privateKey.toS(2));
28
+ }
29
+ set publicKey(key) {
30
+ this.setKeysBang(key, null);
31
+ }
32
+ set privateKey(key) {
33
+ this.setKeysBang(null, key);
34
+ }
35
+ setKeysBang(publicKey = null, privateKey = null) {
36
+ if (publicKey == null) {
37
+ publicKey = this.curve.publicKey;
38
+ }
39
+ else {
40
+ publicKey = new OpenSSL.PKey.EC.Point(this.group(), this.toBigNum(publicKey));
41
+ }
42
+ if (privateKey == null) {
43
+ privateKey = this.curve.privateKey;
44
+ }
45
+ else {
46
+ privateKey = this.toBigNum(privateKey);
47
+ }
48
+ const asn1 = new OpenSSL.ASN1.Sequence([
49
+ new OpenSSL.ASN1.Integer(1),
50
+ new OpenSSL.ASN1.OctetString(privateKey.toS(2)),
51
+ new OpenSSL.ASN1.ObjectId("prime256v1", 0, "EXPLICIT"),
52
+ new OpenSSL.ASN1.BitString(publicKey.toOctetString("uncompressed"), 1, "EXPLICIT"),
53
+ ]);
54
+ const der = asn1.toDer();
55
+ this.curve = new OpenSSL.PKey.EC(der);
56
+ }
57
+ curveName() {
58
+ return this.group().curveName;
59
+ }
60
+ group() {
61
+ return this.curve.group;
62
+ }
63
+ toH() {
64
+ return { publicKey: this.publicKey, privateKey: this.privateKey };
65
+ }
66
+ toHash() {
67
+ return this.toH();
68
+ }
69
+ toPem() {
70
+ return this.privateKeyToPem() + this.publicKeyToPem();
71
+ }
72
+ privateKeyToPem() {
73
+ return this.curve.toPem();
74
+ }
75
+ publicKeyToPem() {
76
+ return this.curve.publicToPem();
77
+ }
78
+ inspect() {
79
+ return `#<${rbModName(this.constructor)}:${rbObjId(this).toString(16)} ${Object.entries(this.toH())
80
+ .map(([k, v]) => `:${k.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`)}=${v}`)
81
+ .join(" ")}>`;
82
+ }
83
+ /** @internal */
84
+ toBigNum(key) {
85
+ return new OpenSSL.BN(WebPush.decode64(key), 2);
86
+ }
87
+ /** @internal */
88
+ encode64(bin) {
89
+ return WebPush.encode64(bin);
90
+ }
91
+ /** @internal */
92
+ trimEncode64(bin) {
93
+ return this.encode64(bin).replaceAll("=", "");
94
+ }
95
+ }
96
+ WebPushSeat.VapidKey = VapidKey;
97
+ //# sourceMappingURL=vapid-key.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vapid-key.js","sourceRoot":"","sources":["../lib/vapid-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAMxC,MAAM,OAAO,QAAQ;IACnB,MAAM,CAAC,QAAQ,CAAC,SAAiB,EAAE,UAAkB;QACnD,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,GAAG,CAAC,WAAW,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACvC,OAAO,GAAG,CAAC;IACb,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,GAAW;QACxB,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,KAAK,CAAK;IAEV,YAAY,IAAI,GAAc,IAAI;QAChC,IAAI,CAAC,KAAK,GAAG,IAAK,CAAC;QACnB,IAAI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K,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;IAED,OAAO;QACL,OAAO,KAAK,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,OAAO,CACrF,IAAI,CAAC,GAAG,EAAE,CACX;aACE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;aAC7E,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAClB,CAAC;IAED,gBAAgB;IACR,QAAQ,CAAC,GAAW;QAC1B,OAAO,IAAI,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAClD,CAAC;IAED,gBAAgB;IACR,QAAQ,CAAC,GAAe;QAC9B,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED,gBAAgB;IACR,YAAY,CAAC,GAAe;QAClC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAChD,CAAC;CACF;AAED,WAAW,CAAC,QAAQ,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const VERSION = "3.1.0";
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1,2 @@
1
+ export const VERSION = "3.1.0";
2
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../lib/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { Request, type RequestOptions, type VapidOptions } from "./request.js";
2
+ import { VapidKey } from "./vapid-key.js";
3
+ import "./constants.generated.js";
4
+ export interface PayloadSendOptions extends RequestOptions {
5
+ message?: string | null;
6
+ endpoint: string;
7
+ p256dh?: string;
8
+ auth?: string;
9
+ vapid?: VapidOptions;
10
+ }
11
+ export declare function payloadSend({ message, endpoint, p256dh, auth, vapid, ...options }: PayloadSendOptions): ReturnType<Request["perform"]>;
12
+ export declare function generateKey(): VapidKey;
13
+ export declare function encode64(bytes: string | Uint8Array): string;
14
+ export declare function decode64(str: string): string;
15
+ /** @internal */
16
+ export declare function subscription(endpoint: string, p256dh: string, auth: string): {
17
+ endpoint: string;
18
+ keys: {
19
+ p256dh: string;
20
+ auth: string;
21
+ };
22
+ };
23
+ export declare const WebPush: {
24
+ name: string;
25
+ } & Record<string, unknown> & {
26
+ VERSION: string;
27
+ payloadSend: typeof payloadSend;
28
+ generateKey: typeof generateKey;
29
+ encode64: typeof encode64;
30
+ decode64: typeof decode64;
31
+ subscription: typeof subscription;
32
+ };
33
+ export { Encryption } from "./encryption.js";
34
+ export * from "./errors.js";
35
+ export { Request } from "./request.js";
36
+ export { VapidKey } from "./vapid-key.js";
37
+ //# sourceMappingURL=web-push.d.ts.map
@@ -0,0 +1,40 @@
1
+ import { Base64 } from "@blazetrails/ruby-compat/base64";
2
+ import { Request } from "./request.js";
3
+ import { VapidKey } from "./vapid-key.js";
4
+ import { VERSION } from "./version.js";
5
+ import { WebPush as WebPushSeat } from "./namespaces.js";
6
+ import "./constants.generated.js";
7
+ export async function payloadSend({ message = "", endpoint, p256dh = "", auth = "", vapid = {}, ...options }) {
8
+ return new Request({
9
+ message,
10
+ subscription: subscription(endpoint, p256dh, auth),
11
+ vapid,
12
+ ...options,
13
+ }).perform();
14
+ }
15
+ export function generateKey() {
16
+ return new VapidKey();
17
+ }
18
+ export function encode64(bytes) {
19
+ return Base64.urlsafeEncode64(bytes);
20
+ }
21
+ export function decode64(str) {
22
+ return Base64.urlsafeDecode64(str);
23
+ }
24
+ /** @internal */
25
+ export function subscription(endpoint, p256dh, auth) {
26
+ return {
27
+ endpoint,
28
+ keys: {
29
+ p256dh,
30
+ auth,
31
+ },
32
+ };
33
+ }
34
+ const members = { VERSION, payloadSend, generateKey, encode64, decode64, subscription };
35
+ export const WebPush = Object.assign(WebPushSeat, members);
36
+ export { Encryption } from "./encryption.js";
37
+ export * from "./errors.js";
38
+ export { Request } from "./request.js";
39
+ export { VapidKey } from "./vapid-key.js";
40
+ //# sourceMappingURL=web-push.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-push.js","sourceRoot":"","sources":["../lib/web-push.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACzD,OAAO,EAAE,OAAO,EAA0C,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,0BAA0B,CAAC;AAUlC,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,EAChC,OAAO,GAAG,EAAE,EACZ,QAAQ,EACR,MAAM,GAAG,EAAE,EACX,IAAI,GAAG,EAAE,EACT,KAAK,GAAG,EAAE,EACV,GAAG,OAAO,EACS;IACnB,OAAO,IAAI,OAAO,CAAC;QACjB,OAAO;QACP,YAAY,EAAE,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC;QAClD,KAAK;QACL,GAAG,OAAO;KACX,CAAC,CAAC,OAAO,EAAE,CAAC;AACf,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,OAAO,IAAI,QAAQ,EAAE,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAA0B;IACjD,OAAO,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,GAAW;IAClC,OAAO,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,YAAY,CAC1B,QAAgB,EAChB,MAAc,EACd,IAAY;IAEZ,OAAO;QACL,QAAQ;QACR,IAAI,EAAE;YACJ,MAAM;YACN,IAAI;SACL;KACF,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AAExF,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAqC,WAAW,EAAE,OAAO,CAAC,CAAC;AAE/F,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,55 @@
1
1
  {
2
2
  "name": "@blazetrails/web-push",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0-alpha0.6",
4
+ "description": "Web push delivery for Trails, mirroring the web-push gem",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "url": "git+https://github.com/blazetrailsdev/trails.git",
8
+ "directory": "packages/web-push"
9
+ },
10
+ "homepage": "https://github.com/blazetrailsdev/trails/tree/main/packages/web-push#readme",
11
+ "type": "module",
12
+ "main": "dist/web-push.js",
13
+ "types": "dist/web-push.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/web-push.d.ts",
17
+ "default": "./dist/web-push.js"
18
+ },
19
+ "./*.js": {
20
+ "types": "./dist/*.d.ts",
21
+ "default": "./dist/*.js"
22
+ },
23
+ "./*": {
24
+ "types": "./dist/*.d.ts",
25
+ "default": "./dist/*.js"
26
+ }
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "!dist/**/*.d.ts.map"
31
+ ],
32
+ "dependencies": {
33
+ "@blazetrails/jwt": "0.1.0-alpha0.6",
34
+ "@blazetrails/ruby-compat": "0.1.0-alpha0.6"
35
+ },
36
+ "devDependencies": {
37
+ "@blazetrails/vitest-matchers": "0.1.0-alpha0.6"
38
+ },
39
+ "engines": {
40
+ "node": ">=26"
41
+ },
42
+ "mirrors": [
43
+ {
44
+ "source": "web-push",
45
+ "ref": "v3.1.0",
46
+ "sha": "36cac0ebda049b4179a198aa0e97a1d4615ba2f1"
47
+ }
48
+ ],
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "scripts": {
53
+ "build": "tsc"
54
+ }
6
55
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.