bitcoincash-oauth-client 0.2.2 → 0.2.10

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/dist/index.cjs CHANGED
@@ -265,6 +265,7 @@ function getFetch(userProvidedFetch = null) {
265
265
  * @typedef {Object} OAuthClientOptions
266
266
  * @property {string} [serverUrl="http://localhost:8000"] - OAuth server URL
267
267
  * @property {string} [network="mainnet"] - Network type ("mainnet" or "testnet")
268
+ * @property {string} [authBasePath="/auth"] - Base path for auth endpoints (e.g., "/auth" or "/bch-auth")
268
269
  * @property {SecureStorage} [secureStorage] - Storage interface for tokens
269
270
  * @property {Function} [fetch] - Custom fetch implementation (optional)
270
271
  * @property {string} [tokenKey="oauth_token"] - Key for storing access token
@@ -302,6 +303,7 @@ class BitcoinCashOAuthClient {
302
303
  constructor(options = {}) {
303
304
  this.serverUrl = options.serverUrl || "http://localhost:8000";
304
305
  this.network = options.network || "mainnet";
306
+ this.authBasePath = options.authBasePath || "/auth";
305
307
  this.secureStorage = options.secureStorage || null;
306
308
  this.fetchImpl = options.fetch || getFetch(options.fetch);
307
309
  this.secp256k1 = null;
@@ -453,7 +455,7 @@ class BitcoinCashOAuthClient {
453
455
 
454
456
  this._log('Registering user', { bitcoincash_address, userId, domain: host });
455
457
 
456
- const response = await this.fetchImpl(`${this.serverUrl}/auth/register`, {
458
+ const response = await this.fetchImpl(`${this.serverUrl}${this.authBasePath}/register`, {
457
459
  method: "POST",
458
460
  headers: {
459
461
  "Content-Type": "application/json",
@@ -549,7 +551,7 @@ class BitcoinCashOAuthClient {
549
551
  this._log('Message signed successfully');
550
552
 
551
553
  try {
552
- const response = await this.fetchImpl(`${this.serverUrl}/auth/token`, {
554
+ const response = await this.fetchImpl(`${this.serverUrl}${this.authBasePath}/token`, {
553
555
  method: "POST",
554
556
  headers: {
555
557
  "Content-Type": "application/json",
@@ -770,7 +772,7 @@ class BitcoinCashOAuthClient {
770
772
  if (serverCheck) {
771
773
  try {
772
774
  this._log('Token validation: checking with server');
773
- const response = await this.fetchImpl(`${this.serverUrl}/auth/verify`, {
775
+ const response = await this.fetchImpl(`${this.serverUrl}${this.authBasePath}/verify`, {
774
776
  method: "POST",
775
777
  headers: {
776
778
  "Authorization": `Bearer ${token}`,
@@ -850,7 +852,7 @@ class BitcoinCashOAuthClient {
850
852
  */
851
853
  async refreshToken(refreshToken) {
852
854
  try {
853
- const response = await this.fetchImpl(`${this.serverUrl}/auth/refresh`, {
855
+ const response = await this.fetchImpl(`${this.serverUrl}${this.authBasePath}/refresh`, {
854
856
  method: "POST",
855
857
  headers: {
856
858
  "Content-Type": "application/json",
@@ -919,7 +921,7 @@ class BitcoinCashOAuthClient {
919
921
  this.refreshTimer = null;
920
922
  }
921
923
 
922
- const response = await this.fetchImpl(`${this.serverUrl}/auth/revoke`, {
924
+ const response = await this.fetchImpl(`${this.serverUrl}${this.authBasePath}/revoke`, {
923
925
  method: "POST",
924
926
  headers: {
925
927
  "Content-Type": "application/json",
package/dist/index.mjs CHANGED
@@ -261,6 +261,7 @@ function getFetch(userProvidedFetch = null) {
261
261
  * @typedef {Object} OAuthClientOptions
262
262
  * @property {string} [serverUrl="http://localhost:8000"] - OAuth server URL
263
263
  * @property {string} [network="mainnet"] - Network type ("mainnet" or "testnet")
264
+ * @property {string} [authBasePath="/auth"] - Base path for auth endpoints (e.g., "/auth" or "/bch-auth")
264
265
  * @property {SecureStorage} [secureStorage] - Storage interface for tokens
265
266
  * @property {Function} [fetch] - Custom fetch implementation (optional)
266
267
  * @property {string} [tokenKey="oauth_token"] - Key for storing access token
@@ -298,6 +299,7 @@ class BitcoinCashOAuthClient {
298
299
  constructor(options = {}) {
299
300
  this.serverUrl = options.serverUrl || "http://localhost:8000";
300
301
  this.network = options.network || "mainnet";
302
+ this.authBasePath = options.authBasePath || "/auth";
301
303
  this.secureStorage = options.secureStorage || null;
302
304
  this.fetchImpl = options.fetch || getFetch(options.fetch);
303
305
  this.secp256k1 = null;
@@ -449,7 +451,7 @@ class BitcoinCashOAuthClient {
449
451
 
450
452
  this._log('Registering user', { bitcoincash_address, userId, domain: host });
451
453
 
452
- const response = await this.fetchImpl(`${this.serverUrl}/auth/register`, {
454
+ const response = await this.fetchImpl(`${this.serverUrl}${this.authBasePath}/register`, {
453
455
  method: "POST",
454
456
  headers: {
455
457
  "Content-Type": "application/json",
@@ -545,7 +547,7 @@ class BitcoinCashOAuthClient {
545
547
  this._log('Message signed successfully');
546
548
 
547
549
  try {
548
- const response = await this.fetchImpl(`${this.serverUrl}/auth/token`, {
550
+ const response = await this.fetchImpl(`${this.serverUrl}${this.authBasePath}/token`, {
549
551
  method: "POST",
550
552
  headers: {
551
553
  "Content-Type": "application/json",
@@ -766,7 +768,7 @@ class BitcoinCashOAuthClient {
766
768
  if (serverCheck) {
767
769
  try {
768
770
  this._log('Token validation: checking with server');
769
- const response = await this.fetchImpl(`${this.serverUrl}/auth/verify`, {
771
+ const response = await this.fetchImpl(`${this.serverUrl}${this.authBasePath}/verify`, {
770
772
  method: "POST",
771
773
  headers: {
772
774
  "Authorization": `Bearer ${token}`,
@@ -846,7 +848,7 @@ class BitcoinCashOAuthClient {
846
848
  */
847
849
  async refreshToken(refreshToken) {
848
850
  try {
849
- const response = await this.fetchImpl(`${this.serverUrl}/auth/refresh`, {
851
+ const response = await this.fetchImpl(`${this.serverUrl}${this.authBasePath}/refresh`, {
850
852
  method: "POST",
851
853
  headers: {
852
854
  "Content-Type": "application/json",
@@ -915,7 +917,7 @@ class BitcoinCashOAuthClient {
915
917
  this.refreshTimer = null;
916
918
  }
917
919
 
918
- const response = await this.fetchImpl(`${this.serverUrl}/auth/revoke`, {
920
+ const response = await this.fetchImpl(`${this.serverUrl}${this.authBasePath}/revoke`, {
919
921
  method: "POST",
920
922
  headers: {
921
923
  "Content-Type": "application/json",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bitcoincash-oauth-client",
3
- "version": "0.2.2",
3
+ "version": "0.2.10",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/paytaca/bitcoincash-oauth.git"