passkey-kit 0.9.2 → 0.9.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "passkey-kit",
3
- "version": "0.9.2",
3
+ "version": "0.9.4",
4
4
  "description": "A helper library for creating and using smart wallet accounts on the Stellar blockchain.",
5
5
  "author": "Tyler van der Hoeven",
6
6
  "license": "MIT",
@@ -13,8 +13,8 @@
13
13
  "base64url": "^3.0.1",
14
14
  "buffer": "^6.0.3",
15
15
  "passkey-factory-sdk": "0.4.1",
16
- "sac-sdk": "0.2.1",
17
- "passkey-kit-sdk": "0.4.1"
16
+ "passkey-kit-sdk": "0.4.1",
17
+ "sac-sdk": "0.2.1"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@simplewebauthn/types": "^10.0.0",
package/src/kit.ts CHANGED
@@ -400,7 +400,10 @@ export class PasskeyKit extends PasskeyBase {
400
400
  return txn
401
401
  }
402
402
 
403
- public addSecp256r1(keyId: Uint8Array, publicKey: Uint8Array, limits: SignerLimits, store: SignerStore) {
403
+ public addSecp256r1(keyId: string | Uint8Array, publicKey: string | Uint8Array, limits: SignerLimits, store: SignerStore) {
404
+ keyId = typeof keyId === 'string' ? base64url.toBuffer(keyId) : keyId
405
+ publicKey = typeof publicKey === 'string' ? base64url.toBuffer(publicKey) : publicKey
406
+
404
407
  return this.wallet!.add({
405
408
  signer: {
406
409
  tag: "Secp256r1",
package/src/server.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { SorobanRpc, xdr } from "@stellar/stellar-sdk/minimal"
1
+ import { SorobanRpc, Transaction, xdr } from "@stellar/stellar-sdk/minimal"
2
2
  import { PasskeyBase } from "./base"
3
3
  import base64url from "base64url"
4
4
  import type { Tx } from "@stellar/stellar-sdk/contract"
@@ -145,13 +145,13 @@ export class PasskeyServer extends PasskeyBase {
145
145
  - Add a method for getting a paginated or filtered list of all a wallet's events
146
146
  */
147
147
 
148
- public async send(txn: Tx, fee?: number) {
148
+ public async send(txn: Tx | string, fee?: number) {
149
149
  if (!this.launchtubeUrl || !this.launchtubeJwt)
150
150
  throw new Error('Launchtube service not configured')
151
151
 
152
152
  const data = new FormData();
153
153
 
154
- data.set('xdr', txn.toXDR());
154
+ data.set('xdr', typeof txn === 'string' ? txn : txn.toXDR());
155
155
 
156
156
  if (fee)
157
157
  data.set('fee', fee.toString());
package/types/kit.d.ts CHANGED
@@ -64,7 +64,7 @@ export declare class PasskeyKit extends PasskeyBase {
64
64
  policy?: string;
65
65
  expiration?: number;
66
66
  }): Promise<AssembledTransaction<T>>;
67
- addSecp256r1(keyId: Uint8Array, publicKey: Uint8Array, limits: SignerLimits, store: SignerStore): Promise<AssembledTransaction<import("@stellar/stellar-sdk/contract").Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>>;
67
+ addSecp256r1(keyId: string | Uint8Array, publicKey: string | Uint8Array, limits: SignerLimits, store: SignerStore): Promise<AssembledTransaction<import("@stellar/stellar-sdk/contract").Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>>;
68
68
  addEd25519(publicKey: string, limits: SignerLimits, store: SignerStore): Promise<AssembledTransaction<import("@stellar/stellar-sdk/contract").Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>>;
69
69
  addPolicy(policy: string, limits: SignerLimits, store: SignerStore): Promise<AssembledTransaction<import("@stellar/stellar-sdk/contract").Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>>;
70
70
  remove(signer: SignerKey): Promise<AssembledTransaction<import("@stellar/stellar-sdk/contract").Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>>;
package/types/server.d.ts CHANGED
@@ -26,5 +26,5 @@ export declare class PasskeyServer extends PasskeyBase {
26
26
  publicKey?: string;
27
27
  policy?: string;
28
28
  }, index?: number): Promise<string>;
29
- send(txn: Tx, fee?: number): Promise<any>;
29
+ send(txn: Tx | string, fee?: number): Promise<any>;
30
30
  }