diff --git a/README.md b/README.md index 2e13e88f..68be820e 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ The SDK is available in both CommonJS and ESM formats and is compatible with bun ```javascript import { TurboFactory } from '@ardrive/turbo-sdk/web'; -const turbo = TurboFactory.public({}); +const turbo = TurboFactory.unauthenticated({}); const rates = await turbo.getFiatRates(); ``` @@ -50,7 +50,7 @@ const rates = await turbo.getFiatRates(); ```html ``` @@ -62,7 +62,7 @@ const rates = await turbo.getFiatRates(); ```javascript const { TurboFactory } = require('@ardrive/turbo-sdk/node'); -const turbo = TurboFactory.public({}); +const turbo = TurboFactory.unauthenticated({}); const rates = await turbo.getFiatRates(); ``` @@ -71,7 +71,7 @@ const rates = await turbo.getFiatRates(); ```javascript import { TurboFactory } from '@ardrive/turbo-sdk/node'; -const turbo = TurboFactory.public({}); +const turbo = TurboFactory.unauthenticated({}); const rates = await turbo.getFiatRates(); ``` diff --git a/examples/node/index.cjs b/examples/node/index.cjs index 4fa2af58..a2277a59 100644 --- a/examples/node/index.cjs +++ b/examples/node/index.cjs @@ -8,7 +8,7 @@ /** * Fetching rates using an unauthenticated Turbo client. */ - const turbo = TurboFactory.public(); + const turbo = TurboFactory.unauthenticated(); const rates = await turbo.getFiatRates(); console.log('Fetched rates:', JSON.stringify(rates, null, 2)); @@ -34,7 +34,7 @@ /** * Use the arweave key to create an authenticated turbo client */ - const turboAuthClient = TurboFactory.private({ privateKey: jwk }); + const turboAuthClient = TurboFactory.authenticated({ privateKey: jwk }); /** * Fetch the balance for the private key. diff --git a/examples/node/index.mjs b/examples/node/index.mjs index 3cbc951a..1dc5987b 100644 --- a/examples/node/index.mjs +++ b/examples/node/index.mjs @@ -10,7 +10,7 @@ import { /** * Fetching rates using an unauthenticated Turbo client. */ - const turbo = TurboFactory.public(); + const turbo = TurboFactory.unauthenticated(); const rates = await turbo.getFiatRates(); console.log('Fetched rates:', JSON.stringify(rates, null, 2)); @@ -32,7 +32,7 @@ import { const arweave = new Arweave.init(); const jwk = await Arweave.crypto.generateJWK(); const address = await arweave.wallets.jwkToAddress(jwk); - const turboAuthClient = TurboFactory.private({ privateKey: jwk }); + const turboAuthClient = TurboFactory.authenticated({ privateKey: jwk }); const balance = await turboAuthClient.getBalance(); console.log( 'Balance:', diff --git a/examples/web/index.html b/examples/web/index.html index ccdbda4d..6f365fe0 100644 --- a/examples/web/index.html +++ b/examples/web/index.html @@ -48,7 +48,7 @@

Upload File

}); const jwk = await arweave.crypto.generateJWK(); const address = await arweave.wallets.jwkToAddress(jwk); - const turbo = TurboFactory.private({ + const turbo = TurboFactory.authenticated({ privateKey: jwk, }); diff --git a/src/common/factory.ts b/src/common/factory.ts index e0011b1f..7bbf2cfb 100644 --- a/src/common/factory.ts +++ b/src/common/factory.ts @@ -20,7 +20,7 @@ import { TurboUnauthenticatedClient } from './turbo.js'; import { TurboUnauthenticatedUploadService } from './upload.js'; export class TurboBaseFactory { - static public({ + static unauthenticated({ paymentServiceConfig = {}, uploadServiceConfig = {}, }: TurboPublicConfiguration = {}) { diff --git a/src/node/factory.ts b/src/node/factory.ts index 47669899..a6d1f289 100644 --- a/src/node/factory.ts +++ b/src/node/factory.ts @@ -24,7 +24,7 @@ import { TurboPrivateConfiguration } from '../types/index.js'; import { TurboNodeArweaveSigner } from './signer.js'; export class TurboFactory extends TurboBaseFactory { - static private({ + static authenticated({ privateKey, paymentServiceConfig = {}, uploadServiceConfig = {}, diff --git a/src/web/factory.ts b/src/web/factory.ts index 4c5c04ca..672e5c48 100644 --- a/src/web/factory.ts +++ b/src/web/factory.ts @@ -24,7 +24,7 @@ import { TurboPrivateConfiguration } from '../types/index.js'; import { TurboWebArweaveSigner } from './signer.js'; export class TurboFactory extends TurboBaseFactory { - static private({ + static authenticated({ privateKey, paymentServiceConfig = {}, uploadServiceConfig = {}, diff --git a/tests/turbo.node.test.ts b/tests/turbo.node.test.ts index a24835f3..88cdb5eb 100644 --- a/tests/turbo.node.test.ts +++ b/tests/turbo.node.test.ts @@ -9,19 +9,19 @@ import { TurboAuthenticatedClient, TurboUnauthenticatedClient, } from '../src/common/turbo.js'; -import { TurboFactory } from '../src/node/index.js'; +import { TurboFactory } from '../src/node/factory.js'; import { JWKInterface } from '../src/types/index.js'; import { jwkToPublicArweaveAddress } from '../src/utils/base64.js'; describe('Node environment', () => { describe('TurboFactory', () => { it('should return a TurboUnauthenticatedClient when running in Node environment and not provided a privateKey', () => { - const turbo = TurboFactory.public({}); + const turbo = TurboFactory.unauthenticated({}); expect(turbo).to.be.instanceOf(TurboUnauthenticatedClient); }); it('should return a TurboAuthenticatedClient when running in Node environment and provided a privateKey', async () => { const jwk = await Arweave.crypto.generateJWK(); - const turbo = TurboFactory.private({ privateKey: jwk }); + const turbo = TurboFactory.authenticated({ privateKey: jwk }); expect(turbo).to.be.instanceOf(TurboAuthenticatedClient); }); }); @@ -30,7 +30,7 @@ describe('Node environment', () => { let turbo: TurboUnauthenticatedClient; before(() => { - turbo = TurboFactory.public({}); + turbo = TurboFactory.unauthenticated({}); }); it('getFiatRates()', async () => { @@ -143,7 +143,7 @@ describe('Node environment', () => { before(async () => { jwk = await Arweave.crypto.generateJWK(); - turbo = TurboFactory.private({ + turbo = TurboFactory.authenticated({ privateKey: jwk, }); }); diff --git a/tests/turbo.web.test.ts b/tests/turbo.web.test.ts index 248307b2..affe6f2c 100644 --- a/tests/turbo.web.test.ts +++ b/tests/turbo.web.test.ts @@ -23,13 +23,13 @@ describe('Browser environment', () => { describe('TurboFactory', () => { it('should be a TurboUnauthenticatedClient running in the browser and not provided a privateKey', () => { - const turbo = TurboFactory.public({}); + const turbo = TurboFactory.unauthenticated({}); expect(turbo).to.be.instanceOf(TurboUnauthenticatedClient); }); it('should be a TurboAuthenticatedClient running in the browser and provided a privateKey', async () => { const jwk = await Arweave.crypto.generateJWK(); - const turbo = TurboFactory.private({ privateKey: jwk }); + const turbo = TurboFactory.authenticated({ privateKey: jwk }); expect(turbo).to.be.instanceOf(TurboUnauthenticatedClient); }); }); @@ -38,7 +38,7 @@ describe('Browser environment', () => { let turbo: TurboUnauthenticatedClient; before(() => { - turbo = TurboFactory.public({}); + turbo = TurboFactory.unauthenticated({}); }); describe('unauthenticated requests', () => { @@ -135,7 +135,7 @@ describe('Browser environment', () => { let jwk: JWKInterface; before(async () => { jwk = await Arweave.crypto.generateJWK(); - turbo = TurboFactory.private({ privateKey: jwk }); + turbo = TurboFactory.authenticated({ privateKey: jwk }); }); it('getBalance()', async () => {