@reyaxyz/api-sdk 0.127.4 → 0.127.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.
@@ -87,10 +87,12 @@ var AuthClient = /** @class */ (function (_super) {
87
87
  });
88
88
  });
89
89
  };
90
- AuthClient.prototype.generateRegistrationOptions = function () {
90
+ AuthClient.prototype.generateRegistrationOptions = function (marginAccountId) {
91
91
  return __awaiter(this, void 0, void 0, function () {
92
92
  return __generator(this, function (_a) {
93
- return [2 /*return*/, this.get('/api/auth/generate-registration-options')];
93
+ return [2 /*return*/, this.get('/api/auth/generate-registration-options', {
94
+ accountId: marginAccountId,
95
+ })];
94
96
  });
95
97
  });
96
98
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/auth/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA6C;AAG7C,iEAAiE;AACjE,0CAA6D;AAE7D;IAAwC,8BAAU;IAChD,oBAAY,IAAY;QACtB,OAAA,MAAK,YAAC,IAAI,CAAC,SAAC;IACd,CAAC;IAEK,6BAAQ,GAAd,UAAe,MAAsB;;;;;4BAEjC,qBAAM,IAAA,8CAAsB,EAAC,MAAM,CAAC,mBAAmB,CAAC,EAAA;;wBADpD,KACJ,SAAwD,EADlD,qBAAqB,2BAAA,EAAE,UAAU,gBAAA,EAAE,EAAE,QAAA;wBAGvB,qBAAM,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,EAAA;;wBAAhD,aAAa,GAAG,SAAgC;wBACpC,qBAAM,IAAA,mCAA0B,EAChD,MAAM,CAAC,MAAM,EACb,qBAAqB,CACtB,EAAA;;wBAHK,SAAS,GAAG,SAGjB;wBAED,IAAI,CAAC,IAAI,CAAC,+BAA+B,EAAE;4BACzC,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,mBAAmB,CAAC;4BAChE,SAAS,EAAE,MAAM,CAAC,eAAe;4BACjC,SAAS,EAAE,SAAS;4BACpB,qBAAqB,EAAE,qBAAqB;4BAC5C,kCAAkC,EAAE,UAAU;4BAC9C,0BAA0B,EAAE,EAAE;4BAC9B,iBAAiB,EAAE,aAAa;yBACjC,CAAC,CAAC;;;;;KACJ;IAEK,gDAA2B,GAAjC;;;gBACE,sBAAO,IAAI,CAAC,GAAG,CACb,yCAAyC,CAC1C,EAAC;;;KACH;IACH,iBAAC;AAAD,CAAC,AA/BD,CAAwC,mBAAU,GA+BjD","sourcesContent":["import { RestClient } from '@reyaxyz/common';\nimport { RegisterParams } from './types';\nimport { PublicKeyCredentialCreationOptionsJSON } from '@simplewebauthn/types';\nimport { generateEmbeddedWallet } from './embeddedWalletHelpers';\nimport { signRegisterEmbeddedWallet } from '@reyaxyz/common';\n\nexport default class AuthClient extends RestClient {\n constructor(host: string) {\n super(host);\n }\n\n async register(params: RegisterParams): Promise<void> {\n const { embeddedWalletAddress, ciphertext, iv } =\n await generateEmbeddedWallet(params.attestationResponse);\n\n const signerAddress = await params.signer.getAddress();\n const signature = await signRegisterEmbeddedWallet(\n params.signer,\n embeddedWalletAddress,\n );\n\n this.post('/api/auth/verify-registration', {\n registrationResponse: JSON.stringify(params.attestationResponse),\n accountId: params.marginAccountId,\n signature: signature,\n embeddedWalletAddress: embeddedWalletAddress,\n embeddedWalletPrivateKeyCypherText: ciphertext,\n embeddedWalletPrivateKeyIv: iv,\n mainWalletAddress: signerAddress,\n });\n }\n\n async generateRegistrationOptions(): Promise<PublicKeyCredentialCreationOptionsJSON> {\n return this.get<PublicKeyCredentialCreationOptionsJSON>(\n '/api/auth/generate-registration-options',\n );\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/auth/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA6C;AAG7C,iEAAiE;AACjE,0CAA6D;AAE7D;IAAwC,8BAAU;IAChD,oBAAY,IAAY;QACtB,OAAA,MAAK,YAAC,IAAI,CAAC,SAAC;IACd,CAAC;IAEK,6BAAQ,GAAd,UAAe,MAAsB;;;;;4BAEjC,qBAAM,IAAA,8CAAsB,EAAC,MAAM,CAAC,mBAAmB,CAAC,EAAA;;wBADpD,KACJ,SAAwD,EADlD,qBAAqB,2BAAA,EAAE,UAAU,gBAAA,EAAE,EAAE,QAAA;wBAGvB,qBAAM,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,EAAA;;wBAAhD,aAAa,GAAG,SAAgC;wBACpC,qBAAM,IAAA,mCAA0B,EAChD,MAAM,CAAC,MAAM,EACb,qBAAqB,CACtB,EAAA;;wBAHK,SAAS,GAAG,SAGjB;wBAED,IAAI,CAAC,IAAI,CAAC,+BAA+B,EAAE;4BACzC,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,mBAAmB,CAAC;4BAChE,SAAS,EAAE,MAAM,CAAC,eAAe;4BACjC,SAAS,EAAE,SAAS;4BACpB,qBAAqB,EAAE,qBAAqB;4BAC5C,kCAAkC,EAAE,UAAU;4BAC9C,0BAA0B,EAAE,EAAE;4BAC9B,iBAAiB,EAAE,aAAa;yBACjC,CAAC,CAAC;;;;;KACJ;IAEK,gDAA2B,GAAjC,UACE,eAAuB;;;gBAEvB,sBAAO,IAAI,CAAC,GAAG,CACb,yCAAyC,EACzC;wBACE,SAAS,EAAE,eAAe;qBAC3B,CACF,EAAC;;;KACH;IACH,iBAAC;AAAD,CAAC,AApCD,CAAwC,mBAAU,GAoCjD","sourcesContent":["import { RestClient } from '@reyaxyz/common';\nimport { RegisterParams } from './types';\nimport { PublicKeyCredentialCreationOptionsJSON } from '@simplewebauthn/types';\nimport { generateEmbeddedWallet } from './embeddedWalletHelpers';\nimport { signRegisterEmbeddedWallet } from '@reyaxyz/common';\n\nexport default class AuthClient extends RestClient {\n constructor(host: string) {\n super(host);\n }\n\n async register(params: RegisterParams): Promise<void> {\n const { embeddedWalletAddress, ciphertext, iv } =\n await generateEmbeddedWallet(params.attestationResponse);\n\n const signerAddress = await params.signer.getAddress();\n const signature = await signRegisterEmbeddedWallet(\n params.signer,\n embeddedWalletAddress,\n );\n\n this.post('/api/auth/verify-registration', {\n registrationResponse: JSON.stringify(params.attestationResponse),\n accountId: params.marginAccountId,\n signature: signature,\n embeddedWalletAddress: embeddedWalletAddress,\n embeddedWalletPrivateKeyCypherText: ciphertext,\n embeddedWalletPrivateKeyIv: iv,\n mainWalletAddress: signerAddress,\n });\n }\n\n async generateRegistrationOptions(\n marginAccountId: number,\n ): Promise<PublicKeyCredentialCreationOptionsJSON> {\n return this.get<PublicKeyCredentialCreationOptionsJSON>(\n '/api/auth/generate-registration-options',\n {\n accountId: marginAccountId,\n },\n );\n }\n}\n"]}
@@ -4,6 +4,6 @@ import { PublicKeyCredentialCreationOptionsJSON } from '@simplewebauthn/types';
4
4
  export default class AuthClient extends RestClient {
5
5
  constructor(host: string);
6
6
  register(params: RegisterParams): Promise<void>;
7
- generateRegistrationOptions(): Promise<PublicKeyCredentialCreationOptionsJSON>;
7
+ generateRegistrationOptions(marginAccountId: number): Promise<PublicKeyCredentialCreationOptionsJSON>;
8
8
  }
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,sCAAsC,EAAE,MAAM,uBAAuB,CAAC;AAI/E,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,UAAU;gBACpC,IAAI,EAAE,MAAM;IAIlB,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAqB/C,2BAA2B,IAAI,OAAO,CAAC,sCAAsC,CAAC;CAKrF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,sCAAsC,EAAE,MAAM,uBAAuB,CAAC;AAI/E,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,UAAU;gBACpC,IAAI,EAAE,MAAM;IAIlB,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAqB/C,2BAA2B,CAC/B,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,sCAAsC,CAAC;CAQnD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/api-sdk",
3
- "version": "0.127.4",
3
+ "version": "0.127.6",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -33,7 +33,7 @@
33
33
  "generate:coverage-badges": "npx istanbul-badges-readme --silent"
34
34
  },
35
35
  "dependencies": {
36
- "@reyaxyz/common": "0.197.4",
36
+ "@reyaxyz/common": "0.197.5",
37
37
  "@simplewebauthn/types": "^10.0.0",
38
38
  "axios": "^1.6.2",
39
39
  "bignumber.js": "^9.1.2",
@@ -42,7 +42,7 @@
42
42
  "ws": "^8.16.0"
43
43
  },
44
44
  "packageManager": "pnpm@8.3.1",
45
- "gitHead": "3af17ed80dc9376c7ca2ca95ec811cbb6fa4b010",
45
+ "gitHead": "8bea2a2537fe9d2d5380ea595a92a56af9456cee",
46
46
  "devDependencies": {
47
47
  "@types/ws": "8.5.10"
48
48
  }
@@ -30,9 +30,14 @@ export default class AuthClient extends RestClient {
30
30
  });
31
31
  }
32
32
 
33
- async generateRegistrationOptions(): Promise<PublicKeyCredentialCreationOptionsJSON> {
33
+ async generateRegistrationOptions(
34
+ marginAccountId: number,
35
+ ): Promise<PublicKeyCredentialCreationOptionsJSON> {
34
36
  return this.get<PublicKeyCredentialCreationOptionsJSON>(
35
37
  '/api/auth/generate-registration-options',
38
+ {
39
+ accountId: marginAccountId,
40
+ },
36
41
  );
37
42
  }
38
43
  }