@fairmint/canton-node-sdk 0.0.125 → 0.0.126

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.
Files changed (33) hide show
  1. package/package.json +1 -1
  2. package/build/src/utils/external-signing/create-external-party-privy.d.ts +0 -76
  3. package/build/src/utils/external-signing/create-external-party-privy.d.ts.map +0 -1
  4. package/build/src/utils/external-signing/create-external-party-privy.js +0 -158
  5. package/build/src/utils/external-signing/create-external-party-privy.js.map +0 -1
  6. package/build/src/utils/external-signing/privy-utils.d.ts +0 -25
  7. package/build/src/utils/external-signing/privy-utils.d.ts.map +0 -1
  8. package/build/src/utils/external-signing/privy-utils.js +0 -56
  9. package/build/src/utils/external-signing/privy-utils.js.map +0 -1
  10. package/build/src/utils/privy/client.d.ts +0 -36
  11. package/build/src/utils/privy/client.d.ts.map +0 -1
  12. package/build/src/utils/privy/client.js +0 -56
  13. package/build/src/utils/privy/client.js.map +0 -1
  14. package/build/src/utils/privy/createWallet.d.ts +0 -30
  15. package/build/src/utils/privy/createWallet.d.ts.map +0 -1
  16. package/build/src/utils/privy/createWallet.js +0 -62
  17. package/build/src/utils/privy/createWallet.js.map +0 -1
  18. package/build/src/utils/privy/getWallet.d.ts +0 -25
  19. package/build/src/utils/privy/getWallet.d.ts.map +0 -1
  20. package/build/src/utils/privy/getWallet.js +0 -50
  21. package/build/src/utils/privy/getWallet.js.map +0 -1
  22. package/build/src/utils/privy/index.d.ts +0 -6
  23. package/build/src/utils/privy/index.d.ts.map +0 -1
  24. package/build/src/utils/privy/index.js +0 -22
  25. package/build/src/utils/privy/index.js.map +0 -1
  26. package/build/src/utils/privy/signData.d.ts +0 -34
  27. package/build/src/utils/privy/signData.d.ts.map +0 -1
  28. package/build/src/utils/privy/signData.js +0 -62
  29. package/build/src/utils/privy/signData.js.map +0 -1
  30. package/build/src/utils/privy/types.d.ts +0 -45
  31. package/build/src/utils/privy/types.d.ts.map +0 -1
  32. package/build/src/utils/privy/types.js +0 -4
  33. package/build/src/utils/privy/types.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fairmint/canton-node-sdk",
3
- "version": "0.0.125",
3
+ "version": "0.0.126",
4
4
  "description": "Canton Node SDK",
5
5
  "keywords": [
6
6
  "canton",
@@ -1,76 +0,0 @@
1
- import type { PrivyClient } from '@privy-io/node';
2
- import type { LedgerJsonApiClient } from '../../clients/ledger-json-api';
3
- import type { StellarWallet } from '../privy/types';
4
- /** Parameters for creating an external party with Privy */
5
- export interface CreateExternalPartyPrivyParams {
6
- /** Privy client instance */
7
- privyClient: PrivyClient;
8
- /** Ledger JSON API client instance */
9
- ledgerClient: LedgerJsonApiClient;
10
- /** Party name hint (will be used as prefix in party ID) */
11
- partyName: string;
12
- /** Synchronizer ID to onboard the party on */
13
- synchronizerId: string;
14
- /** Identity provider ID (default: 'default') */
15
- identityProviderId?: string;
16
- /** Optional: existing Privy wallet to use. If not provided, creates a new one */
17
- wallet?: StellarWallet;
18
- /** Optional: user ID to link the wallet to (format: did:privy:...) */
19
- userId?: string;
20
- /** If true, the local participant will only observe, not confirm (default: false) */
21
- localParticipantObservationOnly?: boolean;
22
- /** Other participant UIDs that should confirm for this party */
23
- otherConfirmingParticipantUids?: string[];
24
- /** Confirmation threshold for multi-hosted party (default: all confirmers) */
25
- confirmationThreshold?: number;
26
- /** Other participant UIDs that should only observe */
27
- observingParticipantUids?: string[];
28
- }
29
- /** Result of creating an external party with Privy */
30
- export interface CreateExternalPartyPrivyResult {
31
- /** Generated party ID (e.g., "alice::12abc...") */
32
- partyId: string;
33
- /** User ID for preparing transactions */
34
- userId: string;
35
- /** Base64-encoded public key */
36
- publicKey: string;
37
- /** Fingerprint of the public key */
38
- publicKeyFingerprint: string;
39
- /** Privy wallet information */
40
- wallet: StellarWallet;
41
- }
42
- /**
43
- * Creates an external party in Canton using Privy for key management
44
- *
45
- * This function combines wallet creation (if needed) and party onboarding:
46
- *
47
- * 1. Creates a new Privy Stellar wallet (or uses provided wallet)
48
- * 2. Generates topology transactions with the wallet's public key
49
- * 3. Signs the topology transactions via Privy
50
- * 4. Submits the signed transactions to allocate the party
51
- *
52
- * @example
53
- * ```typescript
54
- * import { createPrivyClient, createExternalPartyPrivy } from '@fairmint/canton-node-sdk';
55
- *
56
- * const privy = createPrivyClient({
57
- * appId: process.env.PRIVY_APP_ID!,
58
- * appSecret: process.env.PRIVY_APP_SECRET!
59
- * });
60
- *
61
- * const party = await createExternalPartyPrivy({
62
- * privyClient: privy,
63
- * ledgerClient,
64
- * partyName: 'alice',
65
- * synchronizerId: 'global-synchronizer',
66
- * });
67
- *
68
- * console.log('Party ID:', party.partyId);
69
- * console.log('Wallet ID:', party.wallet.id);
70
- * ```;
71
- *
72
- * @param params - Configuration for external party creation
73
- * @returns Party details including party ID, wallet info, and key fingerprint
74
- */
75
- export declare function createExternalPartyPrivy(params: CreateExternalPartyPrivyParams): Promise<CreateExternalPartyPrivyResult>;
76
- //# sourceMappingURL=create-external-party-privy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-external-party-privy.d.ts","sourceRoot":"","sources":["../../../../src/utils/external-signing/create-external-party-privy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,2DAA2D;AAC3D,MAAM,WAAW,8BAA8B;IAC7C,4BAA4B;IAC5B,WAAW,EAAE,WAAW,CAAC;IACzB,sCAAsC;IACtC,YAAY,EAAE,mBAAmB,CAAC;IAClC,2DAA2D;IAC3D,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,cAAc,EAAE,MAAM,CAAC;IACvB,gDAAgD;IAChD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iFAAiF;IACjF,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qFAAqF;IACrF,+BAA+B,CAAC,EAAE,OAAO,CAAC;IAC1C,gEAAgE;IAChE,8BAA8B,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1C,8EAA8E;IAC9E,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,sDAAsD;IACtD,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;CACrC;AAED,sDAAsD;AACtD,MAAM,WAAW,8BAA8B;IAC7C,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,+BAA+B;IAC/B,MAAM,EAAE,aAAa,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,8BAA8B,GACrC,OAAO,CAAC,8BAA8B,CAAC,CAmHzC"}
@@ -1,158 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.createExternalPartyPrivy = createExternalPartyPrivy;
37
- /**
38
- * Creates an external party in Canton using Privy for key management
39
- *
40
- * This function combines wallet creation (if needed) and party onboarding:
41
- *
42
- * 1. Creates a new Privy Stellar wallet (or uses provided wallet)
43
- * 2. Generates topology transactions with the wallet's public key
44
- * 3. Signs the topology transactions via Privy
45
- * 4. Submits the signed transactions to allocate the party
46
- *
47
- * @example
48
- * ```typescript
49
- * import { createPrivyClient, createExternalPartyPrivy } from '@fairmint/canton-node-sdk';
50
- *
51
- * const privy = createPrivyClient({
52
- * appId: process.env.PRIVY_APP_ID!,
53
- * appSecret: process.env.PRIVY_APP_SECRET!
54
- * });
55
- *
56
- * const party = await createExternalPartyPrivy({
57
- * privyClient: privy,
58
- * ledgerClient,
59
- * partyName: 'alice',
60
- * synchronizerId: 'global-synchronizer',
61
- * });
62
- *
63
- * console.log('Party ID:', party.partyId);
64
- * console.log('Wallet ID:', party.wallet.id);
65
- * ```;
66
- *
67
- * @param params - Configuration for external party creation
68
- * @returns Party details including party ID, wallet info, and key fingerprint
69
- */
70
- async function createExternalPartyPrivy(params) {
71
- const { privyClient, ledgerClient, partyName, synchronizerId, identityProviderId = '', wallet: existingWallet, userId, localParticipantObservationOnly, otherConfirmingParticipantUids, confirmationThreshold, observingParticipantUids, } = params;
72
- // Step 1: Get or create Privy wallet
73
- let wallet;
74
- if (existingWallet) {
75
- wallet = existingWallet;
76
- }
77
- else {
78
- // Import createStellarWallet dynamically to avoid circular dependencies
79
- const { createStellarWallet } = await Promise.resolve().then(() => __importStar(require('../privy/createWallet')));
80
- wallet = await createStellarWallet(privyClient, userId ? { userId } : undefined);
81
- }
82
- // Step 2: Wrap the raw public key in DER X.509 SubjectPublicKeyInfo format
83
- // wallet.publicKeyBase64 is the raw 32-byte Ed25519 public key
84
- // Canton's Ledger API requires it to be wrapped in DER format
85
- const { wrapEd25519PublicKeyInDER } = await Promise.resolve().then(() => __importStar(require('./stellar-utils')));
86
- const rawPublicKey = Buffer.from(wallet.publicKeyBase64, 'base64');
87
- const derWrappedPublicKey = wrapEd25519PublicKeyInDER(rawPublicKey);
88
- const derPublicKeyBase64 = derWrappedPublicKey.toString('base64');
89
- // Also keep hex version for return value (from raw key, not DER-wrapped)
90
- const publicKeyHex = rawPublicKey.toString('hex');
91
- // Step 3: Generate external party topology using Ledger JSON API
92
- const topology = await ledgerClient.generateExternalPartyTopology({
93
- synchronizer: synchronizerId,
94
- partyHint: partyName,
95
- publicKey: {
96
- format: 'CRYPTO_KEY_FORMAT_DER_X509_SUBJECT_PUBLIC_KEY_INFO',
97
- keyData: derPublicKeyBase64,
98
- keySpec: 'SIGNING_KEY_SPEC_EC_CURVE25519',
99
- },
100
- localParticipantObservationOnly,
101
- otherConfirmingParticipantUids,
102
- confirmationThreshold,
103
- observingParticipantUids,
104
- });
105
- const { partyId, multiHash, topologyTransactions } = topology;
106
- if (!partyId) {
107
- throw new Error('No party ID returned from topology generation');
108
- }
109
- if (!multiHash) {
110
- throw new Error('No multi-hash returned from topology generation');
111
- }
112
- if (!topologyTransactions || topologyTransactions.length === 0) {
113
- throw new Error('No topology transactions returned from topology generation');
114
- }
115
- // Step 4: Sign the multi-hash using Privy
116
- // The multiHash from Canton is in base64 format, but signWithWallet expects hex
117
- const multiHashBuffer = Buffer.from(multiHash, 'base64');
118
- const multiHashHex = multiHashBuffer.toString('hex');
119
- const { signWithWallet } = await Promise.resolve().then(() => __importStar(require('../privy/signData')));
120
- const signResult = await signWithWallet(privyClient, {
121
- walletId: wallet.id,
122
- data: multiHashHex,
123
- });
124
- // Convert signature from hex (with 0x prefix) to base64 for Canton
125
- const signatureHex = signResult.signature.startsWith('0x') ? signResult.signature.slice(2) : signResult.signature;
126
- const signatureBase64 = Buffer.from(signatureHex, 'hex').toString('base64');
127
- // Step 5: Allocate the party using Ledger JSON API
128
- // We need to pass both the topology transactions and the multi-hash signature
129
- // Transform the topology transactions (array of strings) into the expected format
130
- const onboardingTransactions = topologyTransactions.map((transaction) => ({ transaction }));
131
- const allocateResult = await ledgerClient.allocateExternalParty({
132
- synchronizer: synchronizerId,
133
- identityProviderId,
134
- onboardingTransactions,
135
- multiHashSignatures: [
136
- {
137
- format: 'SIGNATURE_FORMAT_RAW',
138
- signature: signatureBase64,
139
- signedBy: partyId.split('::')[1] ?? '', // fingerprint
140
- signingAlgorithmSpec: 'SIGNING_ALGORITHM_SPEC_ED25519',
141
- },
142
- ],
143
- });
144
- if (!allocateResult.partyId) {
145
- throw new Error('Failed to allocate external party - no party ID returned');
146
- }
147
- // Note: For external parties, we don't need to create a separate user or grant rights.
148
- // When preparing transactions, we'll use the validator operator's user ID (fetched automatically
149
- // by prepareExternalTransaction). The external signature itself provides the authorization.
150
- return {
151
- partyId: allocateResult.partyId,
152
- userId: '', // Will be resolved automatically when preparing transactions
153
- publicKey: publicKeyHex,
154
- publicKeyFingerprint: partyId.split('::')[1] ?? '', // Extract fingerprint from party ID
155
- wallet,
156
- };
157
- }
158
- //# sourceMappingURL=create-external-party-privy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-external-party-privy.js","sourceRoot":"","sources":["../../../../src/utils/external-signing/create-external-party-privy.ts"],"names":[],"mappings":"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"}
@@ -1,25 +0,0 @@
1
- import type { PrivyClient } from '@privy-io/node';
2
- /**
3
- * Signs data with a Privy-managed Stellar wallet
4
- *
5
- * @param privyClient - Privy client instance
6
- * @param walletId - Wallet ID to sign with
7
- * @param data - Data to sign (as Buffer or base64 string)
8
- * @returns Base64-encoded signature
9
- */
10
- export declare function signWithPrivyWallet(privyClient: PrivyClient, walletId: string, data: Buffer | string): Promise<string>;
11
- /** Wallet info stored in key files for Privy-based external parties */
12
- export interface PrivyWalletKeyData {
13
- partyName: string;
14
- partyId: string;
15
- userId: string;
16
- walletId: string;
17
- stellarAddress: string;
18
- publicKey: string;
19
- publicKeyFingerprint: string;
20
- synchronizerId: string;
21
- network: string;
22
- provider: string;
23
- createdAt: string;
24
- }
25
- //# sourceMappingURL=privy-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"privy-utils.d.ts","sourceRoot":"","sources":["../../../../src/utils/external-signing/privy-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GAAG,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC,CAajB;AAED,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -1,56 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.signWithPrivyWallet = signWithPrivyWallet;
37
- /**
38
- * Signs data with a Privy-managed Stellar wallet
39
- *
40
- * @param privyClient - Privy client instance
41
- * @param walletId - Wallet ID to sign with
42
- * @param data - Data to sign (as Buffer or base64 string)
43
- * @returns Base64-encoded signature
44
- */
45
- async function signWithPrivyWallet(privyClient, walletId, data) {
46
- const { signWithWallet } = await Promise.resolve().then(() => __importStar(require('../privy/signData')));
47
- // Convert data to hex
48
- const hexData = typeof data === 'string' ? Buffer.from(data, 'base64').toString('hex') : data.toString('hex');
49
- const signResult = await signWithWallet(privyClient, {
50
- walletId,
51
- data: hexData,
52
- });
53
- // Return base64-encoded signature
54
- return signResult.signatureBase64;
55
- }
56
- //# sourceMappingURL=privy-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"privy-utils.js","sourceRoot":"","sources":["../../../../src/utils/external-signing/privy-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,kDAiBC;AAzBD;;;;;;;GAOG;AACI,KAAK,UAAU,mBAAmB,CACvC,WAAwB,EACxB,QAAgB,EAChB,IAAqB;IAErB,MAAM,EAAE,cAAc,EAAE,GAAG,wDAAa,mBAAmB,GAAC,CAAC;IAE7D,sBAAsB;IACtB,MAAM,OAAO,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9G,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC,WAAW,EAAE;QACnD,QAAQ;QACR,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IAEH,kCAAkC;IAClC,OAAO,UAAU,CAAC,eAAe,CAAC;AACpC,CAAC"}
@@ -1,36 +0,0 @@
1
- import { PrivyClient } from '@privy-io/node';
2
- import type { PrivyClientOptions } from './types';
3
- /**
4
- * Creates a Privy client instance for wallet operations
5
- *
6
- * @example
7
- * ```typescript
8
- * import { createPrivyClient } from '@fairmint/canton-node-sdk';
9
- *
10
- * const privy = createPrivyClient({
11
- * appId: process.env.PRIVY_APP_ID!,
12
- * appSecret: process.env.PRIVY_APP_SECRET!
13
- * });
14
- * ```;
15
- *
16
- * @param options - Configuration options for the Privy client
17
- * @returns Configured PrivyClient instance
18
- * @throws Error if appId or appSecret are missing
19
- */
20
- export declare function createPrivyClient(options: PrivyClientOptions): PrivyClient;
21
- /**
22
- * Creates a Privy client from environment variables
23
- *
24
- * @example
25
- * ```typescript
26
- * import { createPrivyClientFromEnv } from '@fairmint/canton-node-sdk';
27
- *
28
- * // Requires PRIVY_APP_ID and PRIVY_APP_SECRET in environment
29
- * const privy = createPrivyClientFromEnv();
30
- * ```;
31
- *
32
- * @returns Configured PrivyClient instance
33
- * @throws Error if PRIVY_APP_ID or PRIVY_APP_SECRET are not set
34
- */
35
- export declare function createPrivyClientFromEnv(): PrivyClient;
36
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/utils/privy/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,CAiB1E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,IAAI,WAAW,CAKtD"}
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createPrivyClient = createPrivyClient;
4
- exports.createPrivyClientFromEnv = createPrivyClientFromEnv;
5
- const node_1 = require("@privy-io/node");
6
- /**
7
- * Creates a Privy client instance for wallet operations
8
- *
9
- * @example
10
- * ```typescript
11
- * import { createPrivyClient } from '@fairmint/canton-node-sdk';
12
- *
13
- * const privy = createPrivyClient({
14
- * appId: process.env.PRIVY_APP_ID!,
15
- * appSecret: process.env.PRIVY_APP_SECRET!
16
- * });
17
- * ```;
18
- *
19
- * @param options - Configuration options for the Privy client
20
- * @returns Configured PrivyClient instance
21
- * @throws Error if appId or appSecret are missing
22
- */
23
- function createPrivyClient(options) {
24
- const { appId, appSecret } = options;
25
- if (!appId) {
26
- throw new Error('Privy App ID is required. Set PRIVY_APP_ID environment variable or provide appId option.');
27
- }
28
- if (!appSecret) {
29
- throw new Error('Privy App Secret is required. Set PRIVY_APP_SECRET environment variable or provide appSecret option.');
30
- }
31
- return new node_1.PrivyClient({
32
- appId,
33
- appSecret,
34
- });
35
- }
36
- /**
37
- * Creates a Privy client from environment variables
38
- *
39
- * @example
40
- * ```typescript
41
- * import { createPrivyClientFromEnv } from '@fairmint/canton-node-sdk';
42
- *
43
- * // Requires PRIVY_APP_ID and PRIVY_APP_SECRET in environment
44
- * const privy = createPrivyClientFromEnv();
45
- * ```;
46
- *
47
- * @returns Configured PrivyClient instance
48
- * @throws Error if PRIVY_APP_ID or PRIVY_APP_SECRET are not set
49
- */
50
- function createPrivyClientFromEnv() {
51
- return createPrivyClient({
52
- appId: process.env['PRIVY_APP_ID'] ?? '',
53
- appSecret: process.env['PRIVY_APP_SECRET'] ?? '',
54
- });
55
- }
56
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/utils/privy/client.ts"],"names":[],"mappings":";;AAoBA,8CAiBC;AAgBD,4DAKC;AA1DD,yCAA6C;AAG7C;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,iBAAiB,CAAC,OAA2B;IAC3D,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAErC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,0FAA0F,CAAC,CAAC;IAC9G,CAAC;IAED,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,sGAAsG,CACvG,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,kBAAW,CAAC;QACrB,KAAK;QACL,SAAS;KACV,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAgB,wBAAwB;IACtC,OAAO,iBAAiB,CAAC;QACvB,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE;QACxC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,IAAI,EAAE;KACjD,CAAC,CAAC;AACL,CAAC"}
@@ -1,30 +0,0 @@
1
- import type { PrivyClient } from '@privy-io/node';
2
- import type { CreateStellarWalletOptions, StellarWallet } from './types';
3
- /**
4
- * Creates a new Stellar wallet using Privy
5
- *
6
- * @example
7
- * ```typescript
8
- * import { createPrivyClient, createStellarWallet } from '@fairmint/canton-node-sdk';
9
- *
10
- * const privy = createPrivyClient({
11
- * appId: process.env.PRIVY_APP_ID!,
12
- * appSecret: process.env.PRIVY_APP_SECRET!
13
- * });
14
- *
15
- * // Create unlinked wallet
16
- * const wallet = await createStellarWallet(privy);
17
- *
18
- * // Create wallet linked to a user
19
- * const userWallet = await createStellarWallet(privy, {
20
- * userId: 'did:privy:...'
21
- * });
22
- * ```;
23
- *
24
- * @param privyClient - Configured Privy client instance
25
- * @param options - Optional configuration for wallet creation
26
- * @returns Promise resolving to the created Stellar wallet information
27
- * @throws Error if wallet creation fails or userId format is invalid
28
- */
29
- export declare function createStellarWallet(privyClient: PrivyClient, options?: CreateStellarWalletOptions): Promise<StellarWallet>;
30
- //# sourceMappingURL=createWallet.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createWallet.d.ts","sourceRoot":"","sources":["../../../../src/utils/privy/createWallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,0BAA0B,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,WAAW,EACxB,OAAO,CAAC,EAAE,0BAA0B,GACnC,OAAO,CAAC,aAAa,CAAC,CAsCxB"}
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createStellarWallet = createStellarWallet;
4
- const stellar_base_1 = require("@stellar/stellar-base");
5
- /**
6
- * Creates a new Stellar wallet using Privy
7
- *
8
- * @example
9
- * ```typescript
10
- * import { createPrivyClient, createStellarWallet } from '@fairmint/canton-node-sdk';
11
- *
12
- * const privy = createPrivyClient({
13
- * appId: process.env.PRIVY_APP_ID!,
14
- * appSecret: process.env.PRIVY_APP_SECRET!
15
- * });
16
- *
17
- * // Create unlinked wallet
18
- * const wallet = await createStellarWallet(privy);
19
- *
20
- * // Create wallet linked to a user
21
- * const userWallet = await createStellarWallet(privy, {
22
- * userId: 'did:privy:...'
23
- * });
24
- * ```;
25
- *
26
- * @param privyClient - Configured Privy client instance
27
- * @param options - Optional configuration for wallet creation
28
- * @returns Promise resolving to the created Stellar wallet information
29
- * @throws Error if wallet creation fails or userId format is invalid
30
- */
31
- async function createStellarWallet(privyClient, options) {
32
- // Validate userId format if provided
33
- if (options?.userId && !options.userId.startsWith('did:privy:')) {
34
- throw new Error(`Invalid user ID format. User ID must start with "did:privy:", got: ${options.userId}`);
35
- }
36
- // Create wallet request
37
- const createRequest = {
38
- chain_type: 'stellar',
39
- };
40
- if (options?.userId) {
41
- createRequest.owner = { user_id: options.userId };
42
- }
43
- // Create the wallet
44
- const privyWallet = await privyClient.wallets().create(createRequest);
45
- // Decode Stellar address to get base64 public key
46
- const rawPublicKey = stellar_base_1.StrKey.decodeEd25519PublicKey(privyWallet.address);
47
- const publicKeyBase64 = Buffer.from(rawPublicKey).toString('base64');
48
- // Safely access owner property that may not be in type definitions
49
- const { owner } = privyWallet;
50
- const result = {
51
- id: privyWallet.id,
52
- address: privyWallet.address,
53
- chain_type: 'stellar',
54
- publicKeyBase64,
55
- };
56
- // Only include owner if it exists (for exactOptionalPropertyTypes compliance)
57
- if (owner) {
58
- result.owner = owner;
59
- }
60
- return result;
61
- }
62
- //# sourceMappingURL=createWallet.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createWallet.js","sourceRoot":"","sources":["../../../../src/utils/privy/createWallet.ts"],"names":[],"mappings":";;AA8BA,kDAyCC;AAtED,wDAA+C;AAG/C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACI,KAAK,UAAU,mBAAmB,CACvC,WAAwB,EACxB,OAAoC;IAEpC,qCAAqC;IACrC,IAAI,OAAO,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAChE,MAAM,IAAI,KAAK,CAAC,sEAAsE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1G,CAAC;IAED,wBAAwB;IACxB,MAAM,aAAa,GAA2D;QAC5E,UAAU,EAAE,SAAS;KACtB,CAAC;IAEF,IAAI,OAAO,EAAE,MAAM,EAAE,CAAC;QACpB,aAAa,CAAC,KAAK,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;IACpD,CAAC;IAED,oBAAoB;IACpB,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAEtE,kDAAkD;IAClD,MAAM,YAAY,GAAG,qBAAM,CAAC,sBAAsB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACxE,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAErE,mEAAmE;IACnE,MAAM,EAAE,KAAK,EAAE,GAAG,WAA8C,CAAC;IAEjE,MAAM,MAAM,GAAkB;QAC5B,EAAE,EAAE,WAAW,CAAC,EAAE;QAClB,OAAO,EAAE,WAAW,CAAC,OAAO;QAC5B,UAAU,EAAE,SAAS;QACrB,eAAe;KAChB,CAAC;IAEF,8EAA8E;IAC9E,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,25 +0,0 @@
1
- import type { PrivyClient } from '@privy-io/node';
2
- import type { StellarWallet } from './types';
3
- /**
4
- * Retrieves an existing Stellar wallet from Privy by wallet ID
5
- *
6
- * @example
7
- * ```typescript
8
- * import { createPrivyClient, getStellarWallet } from '@fairmint/canton-node-sdk';
9
- *
10
- * const privy = createPrivyClient({
11
- * appId: process.env.PRIVY_APP_ID!,
12
- * appSecret: process.env.PRIVY_APP_SECRET!
13
- * });
14
- *
15
- * const wallet = await getStellarWallet(privy, 'wallet-id-here');
16
- * console.log('Wallet address:', wallet.address);
17
- * ```;
18
- *
19
- * @param privyClient - Configured Privy client instance
20
- * @param walletId - The wallet ID to retrieve
21
- * @returns Promise resolving to the Stellar wallet information
22
- * @throws Error if wallet is not found or is not a Stellar wallet
23
- */
24
- export declare function getStellarWallet(privyClient: PrivyClient, walletId: string): Promise<StellarWallet>;
25
- //# sourceMappingURL=getWallet.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getWallet.d.ts","sourceRoot":"","sources":["../../../../src/utils/privy/getWallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,gBAAgB,CAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CA6BzG"}
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getStellarWallet = getStellarWallet;
4
- const stellar_base_1 = require("@stellar/stellar-base");
5
- /**
6
- * Retrieves an existing Stellar wallet from Privy by wallet ID
7
- *
8
- * @example
9
- * ```typescript
10
- * import { createPrivyClient, getStellarWallet } from '@fairmint/canton-node-sdk';
11
- *
12
- * const privy = createPrivyClient({
13
- * appId: process.env.PRIVY_APP_ID!,
14
- * appSecret: process.env.PRIVY_APP_SECRET!
15
- * });
16
- *
17
- * const wallet = await getStellarWallet(privy, 'wallet-id-here');
18
- * console.log('Wallet address:', wallet.address);
19
- * ```;
20
- *
21
- * @param privyClient - Configured Privy client instance
22
- * @param walletId - The wallet ID to retrieve
23
- * @returns Promise resolving to the Stellar wallet information
24
- * @throws Error if wallet is not found or is not a Stellar wallet
25
- */
26
- async function getStellarWallet(privyClient, walletId) {
27
- // Get the wallet from Privy
28
- const privyWallet = await privyClient.wallets().get(walletId);
29
- // Verify it's a Stellar wallet
30
- if (privyWallet.chain_type !== 'stellar') {
31
- throw new Error(`Wallet ${walletId} is not a Stellar wallet. Found chain_type: ${privyWallet.chain_type}`);
32
- }
33
- // Decode Stellar address to get base64 public key
34
- const rawPublicKey = stellar_base_1.StrKey.decodeEd25519PublicKey(privyWallet.address);
35
- const publicKeyBase64 = Buffer.from(rawPublicKey).toString('base64');
36
- // Safely access owner property that may not be in type definitions
37
- const { owner } = privyWallet;
38
- const result = {
39
- id: privyWallet.id,
40
- address: privyWallet.address,
41
- chain_type: 'stellar',
42
- publicKeyBase64,
43
- };
44
- // Only include owner if it exists (for exactOptionalPropertyTypes compliance)
45
- if (owner) {
46
- result.owner = owner;
47
- }
48
- return result;
49
- }
50
- //# sourceMappingURL=getWallet.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getWallet.js","sourceRoot":"","sources":["../../../../src/utils/privy/getWallet.ts"],"names":[],"mappings":";;AAyBA,4CA6BC;AArDD,wDAA+C;AAG/C;;;;;;;;;;;;;;;;;;;;GAoBG;AACI,KAAK,UAAU,gBAAgB,CAAC,WAAwB,EAAE,QAAgB;IAC/E,4BAA4B;IAC5B,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAE9D,+BAA+B;IAC/B,IAAI,WAAW,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,UAAU,QAAQ,+CAA+C,WAAW,CAAC,UAAU,EAAE,CAAC,CAAC;IAC7G,CAAC;IAED,kDAAkD;IAClD,MAAM,YAAY,GAAG,qBAAM,CAAC,sBAAsB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACxE,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAErE,mEAAmE;IACnE,MAAM,EAAE,KAAK,EAAE,GAAG,WAA8C,CAAC;IAEjE,MAAM,MAAM,GAAkB;QAC5B,EAAE,EAAE,WAAW,CAAC,EAAE;QAClB,OAAO,EAAE,WAAW,CAAC,OAAO;QAC5B,UAAU,EAAE,SAAS;QACrB,eAAe;KAChB,CAAC;IAEF,8EAA8E;IAC9E,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,6 +0,0 @@
1
- export * from './client';
2
- export * from './createWallet';
3
- export * from './getWallet';
4
- export * from './signData';
5
- export * from './types';
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/privy/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
@@ -1,22 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./client"), exports);
18
- __exportStar(require("./createWallet"), exports);
19
- __exportStar(require("./getWallet"), exports);
20
- __exportStar(require("./signData"), exports);
21
- __exportStar(require("./types"), exports);
22
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/privy/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,iDAA+B;AAC/B,8CAA4B;AAC5B,6CAA2B;AAC3B,0CAAwB"}
@@ -1,34 +0,0 @@
1
- import type { PrivyClient } from '@privy-io/node';
2
- import type { SignOptions, SignResult } from './types';
3
- /**
4
- * Signs data using a Stellar wallet managed by Privy
5
- *
6
- * @example
7
- * ```typescript
8
- * import { createPrivyClient, signWithWallet } from '@fairmint/canton-node-sdk';
9
- *
10
- * const privy = createPrivyClient({
11
- * appId: process.env.PRIVY_APP_ID!,
12
- * appSecret: process.env.PRIVY_APP_SECRET!
13
- * });
14
- *
15
- * // Sign a hex string
16
- * const result = await signWithWallet(privy, {
17
- * walletId: 'wallet-id-here',
18
- * data: 'deadbeef'
19
- * });
20
- *
21
- * // Sign a Buffer
22
- * const bufferResult = await signWithWallet(privy, {
23
- * walletId: 'wallet-id-here',
24
- * data: Buffer.from('test message')
25
- * });
26
- * ```;
27
- *
28
- * @param privyClient - Configured Privy client instance
29
- * @param options - Signing options including wallet ID and data
30
- * @returns Promise resolving to the signature result
31
- * @throws Error if signing fails
32
- */
33
- export declare function signWithWallet(privyClient: PrivyClient, options: SignOptions): Promise<SignResult>;
34
- //# sourceMappingURL=signData.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"signData.d.ts","sourceRoot":"","sources":["../../../../src/utils/privy/signData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,cAAc,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CA8BxG"}
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.signWithWallet = signWithWallet;
4
- /**
5
- * Signs data using a Stellar wallet managed by Privy
6
- *
7
- * @example
8
- * ```typescript
9
- * import { createPrivyClient, signWithWallet } from '@fairmint/canton-node-sdk';
10
- *
11
- * const privy = createPrivyClient({
12
- * appId: process.env.PRIVY_APP_ID!,
13
- * appSecret: process.env.PRIVY_APP_SECRET!
14
- * });
15
- *
16
- * // Sign a hex string
17
- * const result = await signWithWallet(privy, {
18
- * walletId: 'wallet-id-here',
19
- * data: 'deadbeef'
20
- * });
21
- *
22
- * // Sign a Buffer
23
- * const bufferResult = await signWithWallet(privy, {
24
- * walletId: 'wallet-id-here',
25
- * data: Buffer.from('test message')
26
- * });
27
- * ```;
28
- *
29
- * @param privyClient - Configured Privy client instance
30
- * @param options - Signing options including wallet ID and data
31
- * @returns Promise resolving to the signature result
32
- * @throws Error if signing fails
33
- */
34
- async function signWithWallet(privyClient, options) {
35
- const { walletId, data } = options;
36
- // Convert data to hex if it's a Buffer
37
- let hexData;
38
- if (Buffer.isBuffer(data)) {
39
- hexData = data.toString('hex');
40
- }
41
- else {
42
- // Remove 0x prefix if present
43
- hexData = data.startsWith('0x') ? data.slice(2) : data;
44
- }
45
- // Validate hex string
46
- if (!/^[0-9a-fA-F]*$/.test(hexData)) {
47
- throw new Error(`Invalid hex data: ${hexData}`);
48
- }
49
- // Sign using Privy's rawSign API
50
- const { signature, encoding } = await privyClient.wallets().rawSign(walletId, {
51
- params: { hash: `0x${hexData}` },
52
- });
53
- // Remove 0x prefix and convert to base64
54
- const signatureHex = signature.startsWith('0x') ? signature.slice(2) : signature;
55
- const signatureBase64 = Buffer.from(signatureHex, 'hex').toString('base64');
56
- return {
57
- signature,
58
- encoding,
59
- signatureBase64,
60
- };
61
- }
62
- //# sourceMappingURL=signData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"signData.js","sourceRoot":"","sources":["../../../../src/utils/privy/signData.ts"],"names":[],"mappings":";;AAiCA,wCA8BC;AA5DD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACI,KAAK,UAAU,cAAc,CAAC,WAAwB,EAAE,OAAoB;IACjF,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IAEnC,uCAAuC;IACvC,IAAI,OAAe,CAAC;IACpB,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;SAAM,CAAC;QACN,8BAA8B;QAC9B,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACzD,CAAC;IAED,sBAAsB;IACtB,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,qBAAqB,OAAO,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,iCAAiC;IACjC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE;QAC5E,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,OAAO,EAAE,EAAE;KACjC,CAAC,CAAC;IACH,yCAAyC;IACzC,MAAM,YAAY,GAAG,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACjF,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAE5E,OAAO;QACL,SAAS;QACT,QAAQ;QACR,eAAe;KAChB,CAAC;AACJ,CAAC"}
@@ -1,45 +0,0 @@
1
- /** Privy wallet types and interfaces */
2
- /** Options for creating a Privy client */
3
- export interface PrivyClientOptions {
4
- /** Privy App ID from environment variables or provided directly */
5
- appId: string;
6
- /** Privy App Secret from environment variables or provided directly */
7
- appSecret: string;
8
- }
9
- /** Options for creating a Stellar wallet */
10
- export interface CreateStellarWalletOptions {
11
- /** Optional user ID to link the wallet to (format: did:privy:...) */
12
- userId?: string;
13
- }
14
- /** Stellar wallet information returned from Privy */
15
- export interface StellarWallet {
16
- /** Wallet ID (used for signing operations) */
17
- id: string;
18
- /** Stellar public address */
19
- address: string;
20
- /** Chain type (always 'stellar' for Stellar wallets) */
21
- chain_type: 'stellar';
22
- /** Owner information if wallet is linked to a user */
23
- owner?: {
24
- user_id: string;
25
- };
26
- /** Base64 encoded public key (derived from address) */
27
- publicKeyBase64: string;
28
- }
29
- /** Options for signing data with a Stellar wallet */
30
- export interface SignOptions {
31
- /** Wallet ID to use for signing */
32
- walletId: string;
33
- /** Data to sign (will be hex encoded if not already) */
34
- data: string | Buffer;
35
- }
36
- /** Result of a signing operation */
37
- export interface SignResult {
38
- /** Signature in hex format (with 0x prefix) */
39
- signature: string;
40
- /** Signature encoding format */
41
- encoding: string;
42
- /** Signature in base64 format */
43
- signatureBase64: string;
44
- }
45
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/utils/privy/types.ts"],"names":[],"mappings":"AAAA,wCAAwC;AAExC,0CAA0C;AAC1C,MAAM,WAAW,kBAAkB;IACjC,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,4CAA4C;AAC5C,MAAM,WAAW,0BAA0B;IACzC,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qDAAqD;AACrD,MAAM,WAAW,aAAa;IAC5B,8CAA8C;IAC9C,EAAE,EAAE,MAAM,CAAC;IACX,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,UAAU,EAAE,SAAS,CAAC;IACtB,sDAAsD;IACtD,KAAK,CAAC,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,uDAAuD;IACvD,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,qDAAqD;AACrD,MAAM,WAAW,WAAW;IAC1B,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED,oCAAoC;AACpC,MAAM,WAAW,UAAU;IACzB,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,eAAe,EAAE,MAAM,CAAC;CACzB"}
@@ -1,4 +0,0 @@
1
- "use strict";
2
- /** Privy wallet types and interfaces */
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/utils/privy/types.ts"],"names":[],"mappings":";AAAA,wCAAwC"}