@usecapsule/user-management-client
Advanced tools
Comparing version 1.9.0-dev.0 to 1.9.0
@@ -26,3 +26,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.KeyType = exports.EncryptorType = exports.Chain = exports.SignatureScheme = exports.PublicKeyType = exports.PublicKeyStatus = exports.EmailTheme = exports.USER_NOT_MATCHING_ERROR = exports.USER_NOT_AUTHENTICATED_ERROR = exports.USER_NOT_VERIFIED = void 0; | ||
exports.OnRampPurchaseStatus = exports.OnRampAsset = exports.OnRampProvider = exports.KeyType = exports.EncryptorType = exports.Chain = exports.SignatureScheme = exports.PublicKeyType = exports.PublicKeyStatus = exports.EmailTheme = exports.USER_NOT_MATCHING_ERROR = exports.USER_NOT_AUTHENTICATED_ERROR = exports.USER_NOT_VERIFIED = void 0; | ||
const axios_1 = __importDefault(require("axios")); | ||
@@ -69,2 +69,18 @@ const qs_1 = __importDefault(require("qs")); | ||
}; | ||
var OnRampProvider; | ||
(function (OnRampProvider) { | ||
OnRampProvider["RAMP"] = "RAMP"; | ||
OnRampProvider["STRIPE"] = "STRIPE"; | ||
})(OnRampProvider || (exports.OnRampProvider = OnRampProvider = {})); | ||
var OnRampAsset; | ||
(function (OnRampAsset) { | ||
OnRampAsset["ETHEREUM"] = "ETHEREUM"; | ||
OnRampAsset["USDC"] = "USDC"; | ||
})(OnRampAsset || (exports.OnRampAsset = OnRampAsset = {})); | ||
var OnRampPurchaseStatus; | ||
(function (OnRampPurchaseStatus) { | ||
OnRampPurchaseStatus["INITIATED"] = "INITIATED"; | ||
OnRampPurchaseStatus["FINISHED"] = "FINISHED"; | ||
OnRampPurchaseStatus["CANCELLED"] = "CANCELLED"; | ||
})(OnRampPurchaseStatus || (exports.OnRampPurchaseStatus = OnRampPurchaseStatus = {})); | ||
const SESSION_COOKIE_HEADER_NAME = 'x-capsule-sid'; | ||
@@ -358,4 +374,4 @@ class Client { | ||
resendVerificationCode(_a) { | ||
var { userId } = _a, rest = __rest(_a, ["userId"]); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
var { userId } = _a, rest = __rest(_a, ["userId"]); | ||
const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code`, rest); | ||
@@ -367,4 +383,4 @@ return res; | ||
resendVerificationCodeByPhone(_a) { | ||
var { userId } = _a, rest = __rest(_a, ["userId"]); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
var { userId } = _a, rest = __rest(_a, ["userId"]); | ||
const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code-by-phone`, rest); | ||
@@ -505,26 +521,35 @@ return res; | ||
} | ||
distributeCapsuleShare(_a) { | ||
var { userId, walletId } = _a, rest = __rest(_a, ["userId", "walletId"]); | ||
createOnRampPurchase(userId_1, walletId_1, provider_1, asset_1) { | ||
return __awaiter(this, arguments, void 0, function* (userId, walletId, provider, asset, testMode = false) { | ||
const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/purchases`, { | ||
provider, | ||
asset, | ||
testMode, | ||
}); | ||
return res; | ||
}); | ||
} | ||
updateOnRampPurchase(userId, walletId, purchaseId, updates) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const body = rest; | ||
const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/capsule-share/distribute`, body); | ||
const res = yield this.baseRequest.patch(`/users/${userId}/wallets/${walletId}/purchases/${purchaseId}`, updates); | ||
return res; | ||
}); | ||
} | ||
keepSessionAlive(userId) { | ||
getOnRampPurchase(userId, walletId, purchaseId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const res = yield this.baseRequest.post(`/users/${userId}/session/keep-alive`); | ||
return res.data; | ||
const res = yield this.baseRequest.get(`/users/${userId}/wallets/${walletId}/purchases/${purchaseId}`); | ||
return res; | ||
}); | ||
} | ||
uploadEncryptedWalletPrivateKey(userId, encryptedWalletPrivateKey, encryptionKeyHash, biometricPublicKey) { | ||
distributeCapsuleShare(_a) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const body = { encryptedWalletPrivateKey, encryptionKeyHash, biometricPublicKey }; | ||
const res = yield this.baseRequest.post(`/users/${userId}/encrypted-wallet-private-keys`, body); | ||
return res.data; | ||
var { userId, walletId } = _a, rest = __rest(_a, ["userId", "walletId"]); | ||
const body = rest; | ||
const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/capsule-share/distribute`, body); | ||
return res; | ||
}); | ||
} | ||
getEncryptedWalletPrivateKeys(userId, encryptionKeyHash) { | ||
keepSessionAlive(userId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const res = yield this.baseRequest.get(`/users/${userId}/encrypted-wallet-private-keys/${encryptionKeyHash}`); | ||
const res = yield this.baseRequest.post(`/users/${userId}/session/keep-alive`); | ||
return res.data; | ||
@@ -531,0 +556,0 @@ }); |
@@ -62,2 +62,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
export var OnRampProvider; | ||
(function (OnRampProvider) { | ||
OnRampProvider["RAMP"] = "RAMP"; | ||
OnRampProvider["STRIPE"] = "STRIPE"; | ||
})(OnRampProvider || (OnRampProvider = {})); | ||
export var OnRampAsset; | ||
(function (OnRampAsset) { | ||
OnRampAsset["ETHEREUM"] = "ETHEREUM"; | ||
OnRampAsset["USDC"] = "USDC"; | ||
})(OnRampAsset || (OnRampAsset = {})); | ||
export var OnRampPurchaseStatus; | ||
(function (OnRampPurchaseStatus) { | ||
OnRampPurchaseStatus["INITIATED"] = "INITIATED"; | ||
OnRampPurchaseStatus["FINISHED"] = "FINISHED"; | ||
OnRampPurchaseStatus["CANCELLED"] = "CANCELLED"; | ||
})(OnRampPurchaseStatus || (OnRampPurchaseStatus = {})); | ||
const SESSION_COOKIE_HEADER_NAME = 'x-capsule-sid'; | ||
@@ -351,4 +367,4 @@ class Client { | ||
resendVerificationCode(_a) { | ||
var { userId } = _a, rest = __rest(_a, ["userId"]); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
var { userId } = _a, rest = __rest(_a, ["userId"]); | ||
const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code`, rest); | ||
@@ -360,4 +376,4 @@ return res; | ||
resendVerificationCodeByPhone(_a) { | ||
var { userId } = _a, rest = __rest(_a, ["userId"]); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
var { userId } = _a, rest = __rest(_a, ["userId"]); | ||
const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code-by-phone`, rest); | ||
@@ -498,26 +514,35 @@ return res; | ||
} | ||
distributeCapsuleShare(_a) { | ||
var { userId, walletId } = _a, rest = __rest(_a, ["userId", "walletId"]); | ||
createOnRampPurchase(userId_1, walletId_1, provider_1, asset_1) { | ||
return __awaiter(this, arguments, void 0, function* (userId, walletId, provider, asset, testMode = false) { | ||
const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/purchases`, { | ||
provider, | ||
asset, | ||
testMode, | ||
}); | ||
return res; | ||
}); | ||
} | ||
updateOnRampPurchase(userId, walletId, purchaseId, updates) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const body = rest; | ||
const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/capsule-share/distribute`, body); | ||
const res = yield this.baseRequest.patch(`/users/${userId}/wallets/${walletId}/purchases/${purchaseId}`, updates); | ||
return res; | ||
}); | ||
} | ||
keepSessionAlive(userId) { | ||
getOnRampPurchase(userId, walletId, purchaseId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const res = yield this.baseRequest.post(`/users/${userId}/session/keep-alive`); | ||
return res.data; | ||
const res = yield this.baseRequest.get(`/users/${userId}/wallets/${walletId}/purchases/${purchaseId}`); | ||
return res; | ||
}); | ||
} | ||
uploadEncryptedWalletPrivateKey(userId, encryptedWalletPrivateKey, encryptionKeyHash, biometricPublicKey) { | ||
distributeCapsuleShare(_a) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const body = { encryptedWalletPrivateKey, encryptionKeyHash, biometricPublicKey }; | ||
const res = yield this.baseRequest.post(`/users/${userId}/encrypted-wallet-private-keys`, body); | ||
return res.data; | ||
var { userId, walletId } = _a, rest = __rest(_a, ["userId", "walletId"]); | ||
const body = rest; | ||
const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/capsule-share/distribute`, body); | ||
return res; | ||
}); | ||
} | ||
getEncryptedWalletPrivateKeys(userId, encryptionKeyHash) { | ||
keepSessionAlive(userId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const res = yield this.baseRequest.get(`/users/${userId}/encrypted-wallet-private-keys/${encryptionKeyHash}`); | ||
const res = yield this.baseRequest.post(`/users/${userId}/session/keep-alive`); | ||
return res.data; | ||
@@ -524,0 +549,0 @@ }); |
@@ -169,2 +169,27 @@ export declare const USER_NOT_VERIFIED = "user must verify biometrics"; | ||
}; | ||
export declare enum OnRampProvider { | ||
RAMP = "RAMP", | ||
STRIPE = "STRIPE" | ||
} | ||
export declare enum OnRampAsset { | ||
ETHEREUM = "ETHEREUM", | ||
USDC = "USDC" | ||
} | ||
export declare enum OnRampPurchaseStatus { | ||
INITIATED = "INITIATED", | ||
FINISHED = "FINISHED", | ||
CANCELLED = "CANCELLED" | ||
} | ||
export interface OnRampPurchase { | ||
id: string; | ||
userId: string; | ||
walletId: string; | ||
status: OnRampPurchaseStatus; | ||
provider: OnRampProvider; | ||
providerKey?: string | null; | ||
fiatCurrency?: string | null; | ||
fiatQuantity?: string | null; | ||
asset: OnRampAsset; | ||
assetQuantity?: string | null; | ||
} | ||
declare class Client { | ||
@@ -244,2 +269,5 @@ private baseRequest; | ||
getPolicyPermissions(userId: string, policyId: string): Promise<import("axios").AxiosResponse<any, any>>; | ||
createOnRampPurchase(userId: string, walletId: string, provider: OnRampProvider, asset: OnRampAsset, testMode?: boolean): Promise<import("axios").AxiosResponse<OnRampPurchase, any>>; | ||
updateOnRampPurchase(userId: string, walletId: string, purchaseId: string, updates: Partial<Pick<OnRampPurchase, 'status' | 'fiatCurrency' | 'fiatQuantity' | 'providerKey'>>): Promise<import("axios").AxiosResponse<OnRampPurchase, any>>; | ||
getOnRampPurchase(userId: string, walletId: string, purchaseId: string): Promise<import("axios").AxiosResponse<OnRampPurchase, any>>; | ||
distributeCapsuleShare({ userId, walletId, ...rest }: { | ||
@@ -251,5 +279,3 @@ userId: string; | ||
keepSessionAlive(userId: string): Promise<any>; | ||
uploadEncryptedWalletPrivateKey(userId: string, encryptedWalletPrivateKey: string, encryptionKeyHash: string, biometricPublicKey: string): Promise<any>; | ||
getEncryptedWalletPrivateKeys(userId: string, encryptionKeyHash: string): Promise<any>; | ||
} | ||
export default Client; |
{ | ||
"name": "@usecapsule/user-management-client", | ||
"version": "1.9.0-dev.0", | ||
"version": "1.9.0", | ||
"main": "dist/cjs/index.js", | ||
@@ -33,3 +33,3 @@ "module": "dist/esm/index.js", | ||
}, | ||
"gitHead": "e3e1fb2f6a18c92ead73b0f2dec9cc7a3648d8ed" | ||
"gitHead": "fe46ddf22f36a74178e6c0926ea9107c3c2a9b2a" | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
65528
1431
1