Socket
Socket
Sign inDemoInstall

@usecapsule/web-sdk

Package Overview
Dependencies
Maintainers
7
Versions
315
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-dev.0 to 1.24.0

2

dist/cryptography/webAuth.js

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

challenge: Buffer.from(challenge, 'base64'),
allowCredentials: allowedPublicKeys.map((key) => ({
allowCredentials: allowedPublicKeys.map(key => ({
id: base64url.toBuffer(key),

@@ -157,0 +157,0 @@ type: 'public-key',

export * from '@usecapsule/core-sdk';
import { Capsule as CapsuleWeb } from './CapsuleWeb.js';
import CoreCapsule from '@usecapsule/core-sdk';
export type { StorageUtils } from '@usecapsule/core-sdk';
export { type StorageUtils, type ConstructorOpts, Environment } from '@usecapsule/core-sdk';
export { createCredential, generateSignature, parseCredentialCreationRes } from './cryptography/webAuth.js';

@@ -6,0 +6,0 @@ export { truncateEthAddress } from './utils/truncateEthAddress.js';

export * from '@usecapsule/core-sdk';
import { Capsule as CapsuleWeb } from './CapsuleWeb.js';
import CoreCapsule from '@usecapsule/core-sdk';
export { Environment } from '@usecapsule/core-sdk';
export { createCredential, generateSignature, parseCredentialCreationRes } from './cryptography/webAuth.js';

@@ -5,0 +6,0 @@ export { truncateEthAddress } from './utils/truncateEthAddress.js';

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

const wallets = yield ctx.capsuleClient.getWallets(userId);
const wallet = wallets.data.wallets.find((w) => w.id === walletId);
const wallet = wallets.data.wallets.find(w => w.id === walletId);
return !!wallet.address;

@@ -24,3 +24,3 @@ });

const wallets = yield ctx.capsuleClient.getPregenWallets(pregenIdentifier, pregenIdentifierType);
const wallet = wallets.wallets.find((w) => w.id === walletId);
const wallet = wallets.wallets.find(w => w.id === walletId);
return !!wallet.address;

@@ -27,0 +27,0 @@ });

@@ -1,3 +0,2 @@

import { Ctx, SignatureRes } from '@usecapsule/core-sdk';
import { PregenIdentifierType } from '@usecapsule/core-sdk';
import { Ctx, PregenIdentifierType, SignatureRes, WalletType } from '@usecapsule/core-sdk';
export declare function ed25519Keygen(ctx: Ctx, userId: string): Promise<{

@@ -14,7 +13,7 @@ signer: string;

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

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

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

};
import { SignatureScheme } from '@usecapsule/user-management-client';
import { getBaseMPCNetworkUrl } from '@usecapsule/core-sdk';
import { getBaseMPCNetworkUrl, WalletScheme, WalletType, } from '@usecapsule/core-sdk';
const configCGGMPBase = (serverUrl, walletId, id) => `{"ServerUrl":"${serverUrl}", "WalletId": "${walletId}", "Id":"${id}", "Ids":["USER","CAPSULE"], "Threshold":1}`;

@@ -51,3 +50,4 @@ const configDKLSBase = (walletId, id, disableWebSockets) => `{"walletId": "${walletId}", "id":"${id}", "otherId":"CAPSULE", "isReceiver": false, "disableWebSockets": ${disableWebSockets}}`;

const { walletId, protocolId } = yield ctx.capsuleClient.createWallet(userId, {
scheme: SignatureScheme.ED25519,
scheme: WalletScheme.ED25519,
type: WalletType.SOLANA,
});

@@ -66,6 +66,7 @@ const serverUrl = getBaseMPCNetworkUrl(ctx.env, !ctx.disableWebSockets);

return __awaiter(this, void 0, void 0, function* () {
const { walletId, protocolId } = yield ctx.capsuleClient.createPregenWallet({
const { walletId, protocolId } = yield ctx.capsuleClient.createWalletPreGen({
pregenIdentifier,
pregenIdentifierType,
scheme: SignatureScheme.ED25519,
scheme: WalletScheme.ED25519,
type: WalletType.SOLANA,
});

@@ -84,3 +85,3 @@ const serverUrl = getBaseMPCNetworkUrl(ctx.env, !ctx.disableWebSockets);

return __awaiter(this, void 0, void 0, function* () {
const { protocolId } = yield ctx.capsuleClient.preSignMessage(userId, walletId, base64Bytes, SignatureScheme.ED25519);
const { protocolId } = yield ctx.capsuleClient.preSignMessage(userId, walletId, base64Bytes, WalletScheme.ED25519);
const base64Sig = (yield new Promise((resolve, reject) => global.ed25519Sign(share, protocolId, base64Bytes, (err, result) => {

@@ -95,7 +96,8 @@ if (err) {

}
export function keygen(ctx, userId, secretKey) {
export function keygen(ctx, userId, secretKey, type = WalletType.EVM) {
return __awaiter(this, void 0, void 0, function* () {
const { walletId, protocolId } = yield ctx.capsuleClient.createWallet(userId, {
useTwoSigners: true,
scheme: ctx.useDKLS ? SignatureScheme.DKLS : SignatureScheme.CGGMP,
scheme: ctx.useDKLS ? WalletScheme.DKLS : WalletScheme.CGGMP,
type,
});

@@ -123,5 +125,9 @@ if (ctx.offloadMPCComputationURL && !ctx.useDKLS) {

}
export function preKeygen(ctx, _partnerId, pregenIdentifier, pregenIdentifierType, secretKey) {
export function preKeygen(ctx, _partnerId, pregenIdentifier, pregenIdentifierType, secretKey, type = WalletType.EVM) {
return __awaiter(this, void 0, void 0, function* () {
const { walletId, protocolId } = yield ctx.capsuleClient.createPregenWallet({ pregenIdentifier, pregenIdentifierType });
const { walletId, protocolId } = yield ctx.capsuleClient.createWalletPreGen({
pregenIdentifier,
pregenIdentifierType,
type,
});
const serverUrl = getBaseMPCNetworkUrl(ctx.env, !ctx.disableWebSockets);

@@ -128,0 +134,0 @@ const signerConfigUser = configDKLSBase(walletId, 'USER', ctx.disableWebSockets);

@@ -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, } from '@usecapsule/core-sdk';
import { PregenIdentifierType, getPortalBaseURL, initClient, mpcComputationClient, capsuleVersion, } from '@usecapsule/core-sdk';
function loadWasm(ctx, wasmOverride) {

@@ -105,3 +105,3 @@ return __awaiter(this, void 0, void 0, function* () {

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

@@ -108,0 +108,0 @@ mpcComputationClient: offloadMPCComputationURL

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

return __awaiter(this, void 0, void 0, function* () {
const onmessage = (event) => {
const onmessage = event => {
if (event.data.functionType === 'CUSTOM') {

@@ -27,3 +27,3 @@ // safe to remove this block once this code is live in prod!

return __awaiter(this, void 0, void 0, function* () {
yield handleMessage({ data: message }, (data) => onmessage({ data }), ctx.disableWorkers);
yield handleMessage({ data: message }, data => onmessage({ data }), ctx.disableWorkers);
});

@@ -30,0 +30,0 @@ })();

{
"name": "@usecapsule/web-sdk",
"version": "1.24.0-dev.0",
"version": "1.24.0",
"type": "module",

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

"dependencies": {
"@usecapsule/core-sdk": "1.22.0-dev.0",
"@usecapsule/user-management-client": "1.18.0-dev.0",
"@usecapsule/core-sdk": "1.22.0",
"@usecapsule/user-management-client": "1.19.0",
"assert": "^2.1.0",

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

],
"gitHead": "7dc99880b088d4193ed31bd64074394d2d03bbb7"
"gitHead": "2f9f59b43c147849f37d50a136970f56dce05be9"
}
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