Skip to content

Commit

Permalink
refactor!: rename to brij
Browse files Browse the repository at this point in the history
  • Loading branch information
ookami-kb committed Nov 22, 2024
1 parent 4c11a60 commit f8ad3fa
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 34 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ npm install https://github.com/espresso-cash/brij-partner-sdk-js

## Register your Partner's Public Key

Create your key pair using the `XFlowPartnerClient.generateKeyPair()` method. Store the seed returned by this method in a safe place.
Create your key pair using the `BrijPartnerClient.generateKeyPair()` method. Store the seed returned by this method in a safe place.

Provide us with the following information to register you in the system:

Expand All @@ -21,7 +21,7 @@ Provide us with the following information to register you in the system:
Using the generated `seed`, initialize the client:

```Javascript
const client = await XFlowPartnerClient.fromSeed(seed);
const client = await BrijPartnerClient.fromSeed(seed);
```

## React to an Order
Expand Down
4 changes: 2 additions & 2 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export type Order = {
userSignature?: string;
partnerSignature?: string;
};
export declare class XFlowPartnerClient {
export declare class BrijPartnerClient {
private authKeyPair;
private readonly kycBaseUrl;
private readonly orderBaseUrl;
Expand All @@ -102,7 +102,7 @@ export declare class XFlowPartnerClient {
getPublicKeyBytes: () => Promise<Uint8Array>;
getPrivateKeyBytes: () => Promise<Uint8Array>;
}>;
static fromSeed(seed: string): Promise<XFlowPartnerClient>;
static fromSeed(seed: string): Promise<BrijPartnerClient>;
private init;
private generateAuthToken;
private createToken;
Expand Down
4 changes: 2 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

31 changes: 15 additions & 16 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import { XFlowPartnerClient } from './dist'
import { BrijPartnerClient } from "./dist/index.js";

async function main() {
try {
const seed = '8ui6TQMfAudigNuKycopDyZ6irMeS7DTSe73d2gzv1Hz';
const xflowClient = await XFlowPartnerClient.fromSeed(seed);
const userPK = 'AthJeHkrQeBahrjNVUZiigveQNchihJbrZtwP7qxVEPa';
const userSecretKey = await xflowClient.getUserSecretKey(userPK);
const userData = await xflowClient.getUserData({
userPK: userPK,
secretKey: userSecretKey,
});
console.log(JSON.stringify(userData, null, 2));
} catch (error) {
console.error('An error occurred:', error);
}
try {
const seed = "8ui6TQMfAudigNuKycopDyZ6irMeS7DTSe73d2gzv1Hz";
const brijClient = await BrijPartnerClient.fromSeed(seed);
const userPK = "AthJeHkrQeBahrjNVUZiigveQNchihJbrZtwP7qxVEPa";
const userSecretKey = await brijClient.getUserSecretKey(userPK);
const userData = await brijClient.getUserData({
userPK: userPK,
secretKey: userSecretKey,
});
console.log(JSON.stringify(userData, null, 2));
} catch (error) {
console.error("An error occurred:", error);
}
}
main();


// npx tsx main.ts
// npx tsx main.ts
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xflow-partner-client",
"version": "0.2.0",
"name": "brij-partner-sdk",
"version": "0.3.0",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface AuthKeyPair {
getPublicKeyBytes(): Promise<Uint8Array>;
}

interface XFlowPartnerClientOptions {
interface BrijPartnerClientOptions {
authKeyPair: AuthKeyPair;
kycBaseUrl?: string;
orderBaseUrl?: string;
Expand Down Expand Up @@ -114,15 +114,15 @@ function toValidationStatus(protoStatus: ProtoValidationStatus): ValidationStatu
}
}

export class XFlowPartnerClient {
export class BrijPartnerClient {
private authKeyPair: AuthKeyPair;
private readonly kycBaseUrl: string;
private readonly orderBaseUrl: string;
private _authPublicKey: string;
private _kycClient: AxiosInstance | null;
private _orderClient: AxiosInstance | null;

private constructor({ authKeyPair, kycBaseUrl, orderBaseUrl }: XFlowPartnerClientOptions) {
private constructor({ authKeyPair, kycBaseUrl, orderBaseUrl }: BrijPartnerClientOptions) {
this.authKeyPair = authKeyPair;
this.kycBaseUrl = kycBaseUrl || _kycBaseURL;
this.orderBaseUrl = orderBaseUrl || _orderBaseURL;
Expand All @@ -143,11 +143,11 @@ export class XFlowPartnerClient {
};
}

static async fromSeed(seed: string): Promise<XFlowPartnerClient> {
static async fromSeed(seed: string): Promise<BrijPartnerClient> {
const decoded = base58.decode(seed);
const authKeyPair = nacl.sign.keyPair.fromSeed(decoded);

const client = new XFlowPartnerClient({
const client = new BrijPartnerClient({
authKeyPair: {
async getPrivateKeyBytes() {
return authKeyPair.secretKey;
Expand Down

0 comments on commit f8ad3fa

Please sign in to comment.