Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@usecapsule/web-sdk

Package Overview
Dependencies
Maintainers
7
Versions
340
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@usecapsule/web-sdk - npm Package Compare versions

Comparing version 1.24.0 to 1.25.0

6

dist/wallet/keygen.d.ts
import { PregenIdentifierType } from '@usecapsule/core-sdk';
import { Ctx } from '@usecapsule/core-sdk';
import { BackupKitEmailProps } from '@usecapsule/user-management-client';
export declare function keygen(ctx: Ctx, userId: string, secretKey: string | null, skipDistribute?: boolean, sessionCookie?: string, emailProps?: BackupKitEmailProps): Promise<{
import { BackupKitEmailProps, WalletType } from '@usecapsule/user-management-client';
export declare function keygen(ctx: Ctx, userId: string, type: Exclude<WalletType, WalletType.SOLANA>, secretKey: string | null, skipDistribute?: boolean, sessionCookie?: string, emailProps?: BackupKitEmailProps): Promise<{
signer: string;

@@ -9,3 +9,3 @@ walletId: string;

}>;
export declare function preKeygen(ctx: Ctx, pregenIdentifier: string, pregenIdentifierType: PregenIdentifierType, secretKey: string | null, _skipDistribute: boolean, partnerId: string, sessionCookie?: string): Promise<{
export declare function preKeygen(ctx: Ctx, pregenIdentifier: string, pregenIdentifierType: PregenIdentifierType, type: Exclude<WalletType, WalletType.SOLANA>, secretKey: string | null, _skipDistribute: boolean, partnerId: string, sessionCookie?: string): Promise<{
signer: string;

@@ -12,0 +12,0 @@ walletId: string;

@@ -27,3 +27,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

}
export function keygen(ctx, userId, secretKey, skipDistribute = false, sessionCookie, emailProps = {}) {
export function keygen(ctx, userId, type, secretKey, skipDistribute = false, sessionCookie, emailProps = {}) {
return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {

@@ -52,3 +52,4 @@ const worker = yield setupWorker(ctx, (res) => __awaiter(this, void 0, void 0, function* () {

apiKey: ctx.apiKey,
params: { userId, secretKey },
cosmosPrefix: ctx.cosmosPrefix,
params: { userId, secretKey, type },
functionType: 'KEYGEN',

@@ -64,3 +65,3 @@ offloadMPCComputationURL: ctx.offloadMPCComputationURL,

}
export function preKeygen(ctx, pregenIdentifier, pregenIdentifierType, secretKey, _skipDistribute = false, partnerId, sessionCookie) {
export function preKeygen(ctx, pregenIdentifier, pregenIdentifierType, type, secretKey, _skipDistribute = false, partnerId, sessionCookie) {
return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {

@@ -77,3 +78,3 @@ const worker = yield setupWorker(ctx, (res) => __awaiter(this, void 0, void 0, function* () {

const email = undefined;
const params = { pregenIdentifier, pregenIdentifierType, secretKey, partnerId, email };
const params = { pregenIdentifier, pregenIdentifierType, type, secretKey, partnerId, email };
if (pregenIdentifierType === PregenIdentifierType.EMAIL) {

@@ -85,2 +86,3 @@ params.email = pregenIdentifier;

apiKey: ctx.apiKey,
cosmosPrefix: ctx.cosmosPrefix,
params: params,

@@ -111,2 +113,3 @@ functionType: 'PREKEYGEN',

apiKey: ctx.apiKey,
cosmosPrefix: ctx.cosmosPrefix,
params: { userId },

@@ -140,2 +143,3 @@ functionType: 'ED25519_KEYGEN',

apiKey: ctx.apiKey,
cosmosPrefix: ctx.cosmosPrefix,
params: params,

@@ -142,0 +146,0 @@ functionType: 'ED25519_PREKEYGEN',

@@ -21,2 +21,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

apiKey: ctx.apiKey,
cosmosPrefix: ctx.cosmosPrefix,
params: { share, walletId, userId },

@@ -23,0 +24,0 @@ functionType: 'GET_PRIVATE_KEY',

@@ -21,2 +21,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

apiKey: ctx.apiKey,
cosmosPrefix: ctx.cosmosPrefix,
params: { share, walletId, userId, tx, chainId },

@@ -44,2 +45,3 @@ functionType: 'SIGN_TRANSACTION',

apiKey: ctx.apiKey,
cosmosPrefix: ctx.cosmosPrefix,
params: { share, walletId, userId, tx, chainId },

@@ -67,2 +69,3 @@ functionType: 'SEND_TRANSACTION',

apiKey: ctx.apiKey,
cosmosPrefix: ctx.cosmosPrefix,
params: { share, walletId, userId, message },

@@ -90,2 +93,3 @@ functionType: 'SIGN_MESSAGE',

apiKey: ctx.apiKey,
cosmosPrefix: ctx.cosmosPrefix,
params: { share, walletId, userId, base64Bytes },

@@ -92,0 +96,0 @@ functionType: 'ED25519_SIGN',

@@ -5,7 +5,7 @@ /// <reference types="node" />

import { SessionStorage } from './SessionStorage.js';
import { BackupKitEmailProps } from '@usecapsule/user-management-client';
import { BackupKitEmailProps, WalletType } from '@usecapsule/user-management-client';
import { PregenIdentifierType } from '@usecapsule/core-sdk';
export declare class WebUtils implements PlatformUtils {
getPrivateKey(ctx: Ctx, userId: string, walletId: string, share: string, sessionCookie: string): Promise<string>;
keygen(ctx: Ctx, userId: string, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
keygen(ctx: Ctx, userId: string, type: Exclude<WalletType, WalletType.SOLANA>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
sessionCookie: string, emailProps?: BackupKitEmailProps): Promise<{

@@ -15,3 +15,3 @@ signer: string;

}>;
preKeygen(ctx: Ctx, partnerId: string | undefined, pregenIdentifier: string, pregenIdentifierType: PregenIdentifierType, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
preKeygen(ctx: Ctx, partnerId: string | undefined, pregenIdentifier: string, pregenIdentifierType: PregenIdentifierType, type: Exclude<WalletType, WalletType.SOLANA>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
sessionCookie: string): Promise<{

@@ -18,0 +18,0 @@ signer: string;

@@ -17,9 +17,9 @@ import { LocalStorage } from './LocalStorage.js';

}
keygen(ctx, userId, secretKey, // should be acceptable as null in RN as we don't pre-gen them
keygen(ctx, userId, type, secretKey, // should be acceptable as null in RN as we don't pre-gen them
sessionCookie, emailProps = {}) {
return keygen(ctx, userId, secretKey, true, sessionCookie, emailProps);
return keygen(ctx, userId, type, secretKey, true, sessionCookie, emailProps);
}
preKeygen(ctx, partnerId, pregenIdentifier, pregenIdentifierType, secretKey, // should be acceptable as null in RN as we don't pre-gen them
preKeygen(ctx, partnerId, pregenIdentifier, pregenIdentifierType, type, secretKey, // should be acceptable as null in RN as we don't pre-gen them
sessionCookie) {
return preKeygen(ctx, pregenIdentifier, pregenIdentifierType, secretKey, false, partnerId, sessionCookie);
return preKeygen(ctx, pregenIdentifier, pregenIdentifierType, type, secretKey, false, partnerId, sessionCookie);
}

@@ -26,0 +26,0 @@ signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS) {

@@ -13,7 +13,7 @@ import { Ctx, PregenIdentifierType, SignatureRes, WalletType } from '@usecapsule/core-sdk';

}>;
export declare function keygen(ctx: Ctx, userId: string, secretKey: string | null, type?: Exclude<WalletType, WalletType.SOLANA>): Promise<{
export declare function keygen(ctx: Ctx, userId: string, type: Exclude<WalletType, WalletType.SOLANA>, secretKey: string | null): Promise<{
signer: string;
walletId: string;
}>;
export declare function preKeygen(ctx: Ctx, _partnerId: string | undefined, pregenIdentifier: string, pregenIdentifierType: PregenIdentifierType, secretKey: string | null, type?: Exclude<WalletType, WalletType.SOLANA>): Promise<{
export declare function preKeygen(ctx: Ctx, _partnerId: string | undefined, pregenIdentifier: string, pregenIdentifierType: PregenIdentifierType, type: Exclude<WalletType, WalletType.SOLANA>, secretKey: string | null): Promise<{
signer: string;

@@ -20,0 +20,0 @@ walletId: string;

@@ -92,3 +92,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

}
export function keygen(ctx, userId, secretKey, type = WalletType.EVM) {
export function keygen(ctx, userId, type, secretKey) {
return __awaiter(this, void 0, void 0, function* () {

@@ -99,2 +99,3 @@ const { walletId, protocolId } = yield ctx.capsuleClient.createWallet(userId, {

type,
cosmosPrefix: type === WalletType.COSMOS ? ctx.cosmosPrefix : undefined,
});

@@ -122,3 +123,3 @@ if (ctx.offloadMPCComputationURL && !ctx.useDKLS) {

}
export function preKeygen(ctx, _partnerId, pregenIdentifier, pregenIdentifierType, secretKey, type = WalletType.EVM) {
export function preKeygen(ctx, _partnerId, pregenIdentifier, pregenIdentifierType, type, secretKey) {
return __awaiter(this, void 0, void 0, function* () {

@@ -129,2 +130,3 @@ const { walletId, protocolId } = yield ctx.capsuleClient.createWalletPreGen({

type,
cosmosPrefix: type === WalletType.COSMOS ? ctx.cosmosPrefix : undefined,
});

@@ -131,0 +133,0 @@ const serverUrl = getBaseMPCNetworkUrl(ctx.env, !ctx.disableWebSockets);

@@ -6,2 +6,3 @@ import '../wasm/wasm_exec.js';

apiKey?: string;
cosmosPrefix?: string;
offloadMPCComputationURL?: string;

@@ -8,0 +9,0 @@ disableWorkers?: boolean;

@@ -15,3 +15,3 @@ // ANY CHANGES TO THIS FILE REQUIRE A REBUILD OF THE WORKER

import * as walletUtils from './walletUtils.js';
import { PregenIdentifierType, getPortalBaseURL, initClient, mpcComputationClient, capsuleVersion, } from '@usecapsule/core-sdk';
import { PregenIdentifierType, getPortalBaseURL, initClient, mpcComputationClient, capsuleVersion, WalletType, } from '@usecapsule/core-sdk';
function loadWasm(ctx, wasmOverride) {

@@ -38,4 +38,4 @@ return __awaiter(this, void 0, void 0, function* () {

case 'KEYGEN': {
const { userId, secretKey } = params;
const keygenRes = yield walletUtils.keygen(ctx, userId, secretKey);
const { userId, secretKey, type = WalletType.EVM } = params;
const keygenRes = yield walletUtils.keygen(ctx, userId, type, secretKey);
return keygenRes;

@@ -60,3 +60,3 @@ }

case 'PREKEYGEN': {
const { email, partnerId, secretKey } = params;
const { email, partnerId, secretKey, type = WalletType.EVM } = params;
let { pregenIdentifier, pregenIdentifierType } = params;

@@ -67,3 +67,3 @@ if (email !== 'null' && email !== 'undefined' && email !== '' && email != null) {

}
const keygenRes = yield walletUtils.preKeygen(ctx, partnerId, pregenIdentifier, pregenIdentifierType, secretKey);
const keygenRes = yield walletUtils.preKeygen(ctx, partnerId, pregenIdentifier, pregenIdentifierType, type, secretKey);
return keygenRes;

@@ -100,3 +100,3 @@ }

return __awaiter(this, void 0, void 0, function* () {
const { env, apiKey, offloadMPCComputationURL, disableWorkers, sessionCookie, useDKLS, disableWebSockets, wasmOverride } = e.data;
const { env, apiKey, cosmosPrefix = 'cosmos', offloadMPCComputationURL, disableWorkers, sessionCookie, useDKLS, disableWebSockets, wasmOverride, } = e.data;
if (!env) {

@@ -109,2 +109,3 @@ // this means a message we didn't send was received and we want to ignore it

apiKey,
cosmosPrefix,
capsuleClient: initClient(env, capsuleVersion, apiKey, useFetchAdapter, () => sessionCookie),

@@ -111,0 +112,0 @@ offloadMPCComputationURL: offloadMPCComputationURL,

{
"name": "@usecapsule/web-sdk",
"version": "1.24.0",
"version": "1.25.0",
"type": "module",

@@ -11,4 +11,4 @@ "main": "dist/index.js",

"dependencies": {
"@usecapsule/core-sdk": "1.22.0",
"@usecapsule/user-management-client": "1.19.0",
"@usecapsule/core-sdk": "1.23.0",
"@usecapsule/user-management-client": "1.20.0",
"assert": "^2.1.0",

@@ -37,3 +37,3 @@ "base64url": "3.0.1",

],
"gitHead": "2f9f59b43c147849f37d50a136970f56dce05be9"
"gitHead": "530e3c81e17c2027ff82abe9b77abb8d6bf0fd7a"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc