@canton-network/core-signing-lib 1.15.0 → 1.16.0
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/dist/index.cjs +4 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -6
- package/dist/index.js.map +1 -1
- package/package.json +3 -5
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -20,13 +20,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
|
-
//#endregion
|
|
24
23
|
let tweetnacl = require("tweetnacl");
|
|
25
24
|
tweetnacl = __toESM(tweetnacl, 1);
|
|
26
25
|
let tweetnacl_util = require("tweetnacl-util");
|
|
27
26
|
tweetnacl_util = __toESM(tweetnacl_util, 1);
|
|
28
27
|
let zod = require("zod");
|
|
29
|
-
|
|
28
|
+
// src/config/schema.ts
|
|
30
29
|
let SigningProvider = /* @__PURE__ */ function(SigningProvider) {
|
|
31
30
|
SigningProvider["WALLET_KERNEL"] = "wallet-kernel";
|
|
32
31
|
SigningProvider["PARTICIPANT"] = "participant";
|
|
@@ -48,8 +47,7 @@ const signingDriverConfigSchema = zod.z.object({
|
|
|
48
47
|
properties: zod.z.record(zod.z.string(), zod.z.any()).optional()
|
|
49
48
|
});
|
|
50
49
|
const signingConfigSchema = zod.z.object({ drivers: zod.z.array(signingDriverConfigSchema).optional() });
|
|
51
|
-
|
|
52
|
-
//#region src/rpc-gen/index.ts
|
|
50
|
+
// src/rpc-gen/index.ts
|
|
53
51
|
function buildController(methods) {
|
|
54
52
|
return {
|
|
55
53
|
signTransaction: methods.signTransaction,
|
|
@@ -63,8 +61,7 @@ function buildController(methods) {
|
|
|
63
61
|
subscribeTransactions: methods.subscribeTransactions
|
|
64
62
|
};
|
|
65
63
|
}
|
|
66
|
-
|
|
67
|
-
//#region src/index.ts
|
|
64
|
+
// src/index.ts
|
|
68
65
|
const CC_COIN_TYPE = 6767;
|
|
69
66
|
function isRpcError(value) {
|
|
70
67
|
return value.error_description !== void 0;
|
|
@@ -98,7 +95,6 @@ const createKeyPair = () => {
|
|
|
98
95
|
privateKey: tweetnacl_util.default.encodeBase64(key.secretKey)
|
|
99
96
|
};
|
|
100
97
|
};
|
|
101
|
-
//#endregion
|
|
102
98
|
exports.CC_COIN_TYPE = CC_COIN_TYPE;
|
|
103
99
|
exports.PartyMode = PartyMode;
|
|
104
100
|
exports.SIGN_MESSAGE_CAPABLE_SIGNING_PROVIDERS = SIGN_MESSAGE_CAPABLE_SIGNING_PROVIDERS;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["z","nacl","naclUtil"],"sources":["../src/config/schema.ts","../src/rpc-gen/index.ts","../src/index.ts"],"sourcesContent":["// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { z } from 'zod'\n\nexport enum SigningProvider {\n WALLET_KERNEL = 'wallet-kernel',\n PARTICIPANT = 'participant',\n FIREBLOCKS = 'fireblocks',\n BLOCKDAEMON = 'blockdaemon',\n DFNS = 'dfns',\n SECUROSYS = 'securosys',\n BITGO = 'bitgo',\n}\n\nexport const SIGN_MESSAGE_CAPABLE_SIGNING_PROVIDERS: readonly SigningProvider[] =\n [\n SigningProvider.WALLET_KERNEL,\n SigningProvider.DFNS,\n SigningProvider.FIREBLOCKS,\n SigningProvider.SECUROSYS,\n ]\n\n// Generic signing driver configuration schema\nexport const signingDriverConfigSchema = z.object({\n provider: z.nativeEnum(SigningProvider),\n properties: z.record(z.string(), z.any()).optional(),\n})\n\n// Top-level Signing Configuration Schema - array of driver configs\nexport const signingConfigSchema = z.object({\n drivers: z.array(signingDriverConfigSchema).optional(),\n})\n\n// Type exports\nexport type SigningDriverAppConfig = z.infer<typeof signingDriverConfigSchema>\nexport type SigningConfig = z.infer<typeof signingConfigSchema>\n","// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n// Code generated by rpc-generator DO NOT EDIT!!\n\nimport type { SignTransaction } from './typings.js'\nimport type { SignMessage } from './typings.js'\nimport type { GetTransaction } from './typings.js'\nimport type { GetTransactions } from './typings.js'\nimport type { GetKeys } from './typings.js'\nimport type { CreateKey } from './typings.js'\nimport type { GetConfiguration } from './typings.js'\nimport type { SetConfiguration } from './typings.js'\nimport type { SubscribeTransactions } from './typings.js'\n\nexport type Methods = {\n signTransaction: SignTransaction\n signMessage: SignMessage\n getTransaction: GetTransaction\n getTransactions: GetTransactions\n getKeys: GetKeys\n createKey: CreateKey\n getConfiguration: GetConfiguration\n setConfiguration: SetConfiguration\n subscribeTransactions: SubscribeTransactions\n}\n\nfunction buildController(methods: Methods) {\n return {\n signTransaction: methods.signTransaction,\n signMessage: methods.signMessage,\n getTransaction: methods.getTransaction,\n getTransactions: methods.getTransactions,\n getKeys: methods.getKeys,\n createKey: methods.createKey,\n getConfiguration: methods.getConfiguration,\n setConfiguration: methods.setConfiguration,\n subscribeTransactions: methods.subscribeTransactions,\n }\n}\n\nexport default buildController\n","// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { AuthContext } from '@canton-network/core-wallet-auth'\nimport type { Methods } from './rpc-gen/index.js'\nimport type { Error as RpcError } from './rpc-gen/typings.js'\nimport nacl from 'tweetnacl'\nimport naclUtil from 'tweetnacl-util'\nimport { SigningProvider } from './config/schema.js'\n\n// Re-export SigningProvider from config schema\nexport { SigningProvider }\n\nexport { default as buildController, type Methods } from './rpc-gen/index.js'\nexport * from './rpc-gen/typings.js'\nexport * from './SigningDriverStore.js'\nexport * from './config/schema.js'\n\nexport const CC_COIN_TYPE = 6767\n\nexport function isRpcError<T>(value: T | RpcError): value is RpcError {\n return (value as RpcError).error_description !== undefined\n}\n\nexport enum PartyMode {\n INTERNAL = 'internal',\n EXTERNAL = 'external',\n}\n\nexport type PublicKey = string\nexport type PrivateKey = string\n\nexport interface KeyPair {\n publicKey: PublicKey\n privateKey: PrivateKey\n}\n\nexport interface SigningDriverInterface {\n partyMode: PartyMode\n signingProvider: SigningProvider\n controller: (userId: AuthContext['userId'] | undefined) => Methods\n}\n\nexport const verifySignedTxHash = (\n txHash: string,\n publicKey: string,\n signature: string\n): boolean => {\n return nacl.sign.detached.verify(\n naclUtil.decodeBase64(txHash),\n naclUtil.decodeBase64(signature),\n naclUtil.decodeBase64(publicKey)\n )\n}\n\nexport const signTransactionHash = (\n txHash: string,\n privateKey: string\n): string => {\n const decodedKey = naclUtil.decodeBase64(privateKey)\n\n return naclUtil.encodeBase64(\n nacl.sign.detached(naclUtil.decodeBase64(txHash), decodedKey)\n )\n}\n\nexport const signMessage = (message: string, privateKey: string): string => {\n const msgBytes = new TextEncoder().encode(message)\n const decodedKey = naclUtil.decodeBase64(privateKey)\n return naclUtil.encodeBase64(nacl.sign.detached(msgBytes, decodedKey))\n}\n\nexport const getPublicKeyFromPrivate = (privateKeyBase64: string): string => {\n const secretKey = naclUtil.decodeBase64(privateKeyBase64)\n const keyPair = nacl.sign.keyPair.fromSecretKey(secretKey)\n return naclUtil.encodeBase64(keyPair.publicKey)\n}\n\nexport const createKeyPair = (): KeyPair => {\n const key = nacl.sign.keyPair()\n const publicKey = naclUtil.encodeBase64(key.publicKey)\n const privateKey = naclUtil.encodeBase64(key.secretKey)\n\n return { publicKey, privateKey }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["z","nacl","naclUtil"],"sources":["../src/config/schema.ts","../src/rpc-gen/index.ts","../src/index.ts"],"sourcesContent":["// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { z } from 'zod'\n\nexport enum SigningProvider {\n WALLET_KERNEL = 'wallet-kernel',\n PARTICIPANT = 'participant',\n FIREBLOCKS = 'fireblocks',\n BLOCKDAEMON = 'blockdaemon',\n DFNS = 'dfns',\n SECUROSYS = 'securosys',\n BITGO = 'bitgo',\n}\n\nexport const SIGN_MESSAGE_CAPABLE_SIGNING_PROVIDERS: readonly SigningProvider[] =\n [\n SigningProvider.WALLET_KERNEL,\n SigningProvider.DFNS,\n SigningProvider.FIREBLOCKS,\n SigningProvider.SECUROSYS,\n ]\n\n// Generic signing driver configuration schema\nexport const signingDriverConfigSchema = z.object({\n provider: z.nativeEnum(SigningProvider),\n properties: z.record(z.string(), z.any()).optional(),\n})\n\n// Top-level Signing Configuration Schema - array of driver configs\nexport const signingConfigSchema = z.object({\n drivers: z.array(signingDriverConfigSchema).optional(),\n})\n\n// Type exports\nexport type SigningDriverAppConfig = z.infer<typeof signingDriverConfigSchema>\nexport type SigningConfig = z.infer<typeof signingConfigSchema>\n","// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n// Code generated by rpc-generator DO NOT EDIT!!\n\nimport type { SignTransaction } from './typings.js'\nimport type { SignMessage } from './typings.js'\nimport type { GetTransaction } from './typings.js'\nimport type { GetTransactions } from './typings.js'\nimport type { GetKeys } from './typings.js'\nimport type { CreateKey } from './typings.js'\nimport type { GetConfiguration } from './typings.js'\nimport type { SetConfiguration } from './typings.js'\nimport type { SubscribeTransactions } from './typings.js'\n\nexport type Methods = {\n signTransaction: SignTransaction\n signMessage: SignMessage\n getTransaction: GetTransaction\n getTransactions: GetTransactions\n getKeys: GetKeys\n createKey: CreateKey\n getConfiguration: GetConfiguration\n setConfiguration: SetConfiguration\n subscribeTransactions: SubscribeTransactions\n}\n\nfunction buildController(methods: Methods) {\n return {\n signTransaction: methods.signTransaction,\n signMessage: methods.signMessage,\n getTransaction: methods.getTransaction,\n getTransactions: methods.getTransactions,\n getKeys: methods.getKeys,\n createKey: methods.createKey,\n getConfiguration: methods.getConfiguration,\n setConfiguration: methods.setConfiguration,\n subscribeTransactions: methods.subscribeTransactions,\n }\n}\n\nexport default buildController\n","// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { AuthContext } from '@canton-network/core-wallet-auth'\nimport type { Methods } from './rpc-gen/index.js'\nimport type { Error as RpcError } from './rpc-gen/typings.js'\nimport nacl from 'tweetnacl'\nimport naclUtil from 'tweetnacl-util'\nimport { SigningProvider } from './config/schema.js'\n\n// Re-export SigningProvider from config schema\nexport { SigningProvider }\n\nexport { default as buildController, type Methods } from './rpc-gen/index.js'\nexport * from './rpc-gen/typings.js'\nexport * from './SigningDriverStore.js'\nexport * from './config/schema.js'\n\nexport const CC_COIN_TYPE = 6767\n\nexport function isRpcError<T>(value: T | RpcError): value is RpcError {\n return (value as RpcError).error_description !== undefined\n}\n\nexport enum PartyMode {\n INTERNAL = 'internal',\n EXTERNAL = 'external',\n}\n\nexport type PublicKey = string\nexport type PrivateKey = string\n\nexport interface KeyPair {\n publicKey: PublicKey\n privateKey: PrivateKey\n}\n\nexport interface SigningDriverInterface {\n partyMode: PartyMode\n signingProvider: SigningProvider\n controller: (userId: AuthContext['userId'] | undefined) => Methods\n}\n\nexport const verifySignedTxHash = (\n txHash: string,\n publicKey: string,\n signature: string\n): boolean => {\n return nacl.sign.detached.verify(\n naclUtil.decodeBase64(txHash),\n naclUtil.decodeBase64(signature),\n naclUtil.decodeBase64(publicKey)\n )\n}\n\nexport const signTransactionHash = (\n txHash: string,\n privateKey: string\n): string => {\n const decodedKey = naclUtil.decodeBase64(privateKey)\n\n return naclUtil.encodeBase64(\n nacl.sign.detached(naclUtil.decodeBase64(txHash), decodedKey)\n )\n}\n\nexport const signMessage = (message: string, privateKey: string): string => {\n const msgBytes = new TextEncoder().encode(message)\n const decodedKey = naclUtil.decodeBase64(privateKey)\n return naclUtil.encodeBase64(nacl.sign.detached(msgBytes, decodedKey))\n}\n\nexport const getPublicKeyFromPrivate = (privateKeyBase64: string): string => {\n const secretKey = naclUtil.decodeBase64(privateKeyBase64)\n const keyPair = nacl.sign.keyPair.fromSecretKey(secretKey)\n return naclUtil.encodeBase64(keyPair.publicKey)\n}\n\nexport const createKeyPair = (): KeyPair => {\n const key = nacl.sign.keyPair()\n const publicKey = naclUtil.encodeBase64(key.publicKey)\n const privateKey = naclUtil.encodeBase64(key.secretKey)\n\n return { publicKey, privateKey }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAY,kBAAL,yBAAA,iBAAA;CACH,gBAAA,mBAAA;CACA,gBAAA,iBAAA;CACA,gBAAA,gBAAA;CACA,gBAAA,iBAAA;CACA,gBAAA,UAAA;CACA,gBAAA,eAAA;CACA,gBAAA,WAAA;;AACJ,EAAA,CAAA,CAAA;AAEA,MAAa,yCACT;;;;;AAKA;AAGJ,MAAa,4BAA4BA,IAAAA,EAAE,OAAO;CAC9C,UAAUA,IAAAA,EAAE,WAAW,eAAe;CACtC,YAAYA,IAAAA,EAAE,OAAOA,IAAAA,EAAE,OAAO,GAAGA,IAAAA,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS;AACvD,CAAC;AAGD,MAAa,sBAAsBA,IAAAA,EAAE,OAAO,EACxC,SAASA,IAAAA,EAAE,MAAM,yBAAyB,CAAC,CAAC,SAAS,EACzD,CAAC;;ACLD,SAAS,gBAAgB,SAAkB;CACvC,OAAO;EACH,iBAAiB,QAAQ;EACzB,aAAa,QAAQ;EACrB,gBAAgB,QAAQ;EACxB,iBAAiB,QAAQ;EACzB,SAAS,QAAQ;EACjB,WAAW,QAAQ;EACnB,kBAAkB,QAAQ;EAC1B,kBAAkB,QAAQ;EAC1B,uBAAuB,QAAQ;CACnC;AACJ;;ACrBA,MAAa,eAAe;AAE5B,SAAgB,WAAc,OAAwC;CAClE,OAAQ,MAAmB,sBAAsB,KAAA;AACrD;AAEA,IAAY,YAAL,yBAAA,WAAA;CACH,UAAA,cAAA;CACA,UAAA,cAAA;;AACJ,EAAA,CAAA,CAAA;AAgBA,MAAa,sBACT,QACA,WACA,cACU;CACV,OAAOC,UAAAA,QAAK,KAAK,SAAS,OACtBC,eAAAA,QAAS,aAAa,MAAM,GAC5BA,eAAAA,QAAS,aAAa,SAAS,GAC/BA,eAAAA,QAAS,aAAa,SAAS,CACnC;AACJ;AAEA,MAAa,uBACT,QACA,eACS;CACT,MAAM,aAAaA,eAAAA,QAAS,aAAa,UAAU;CAEnD,OAAOA,eAAAA,QAAS,aACZD,UAAAA,QAAK,KAAK,SAASC,eAAAA,QAAS,aAAa,MAAM,GAAG,UAAU,CAChE;AACJ;AAEA,MAAa,eAAe,SAAiB,eAA+B;CACxE,MAAM,WAAW,IAAI,YAAY,CAAC,CAAC,OAAO,OAAO;CACjD,MAAM,aAAaA,eAAAA,QAAS,aAAa,UAAU;CACnD,OAAOA,eAAAA,QAAS,aAAaD,UAAAA,QAAK,KAAK,SAAS,UAAU,UAAU,CAAC;AACzE;AAEA,MAAa,2BAA2B,qBAAqC;CACzE,MAAM,YAAYC,eAAAA,QAAS,aAAa,gBAAgB;CACxD,MAAM,UAAUD,UAAAA,QAAK,KAAK,QAAQ,cAAc,SAAS;CACzD,OAAOC,eAAAA,QAAS,aAAa,QAAQ,SAAS;AAClD;AAEA,MAAa,sBAA+B;CACxC,MAAM,MAAMD,UAAAA,QAAK,KAAK,QAAQ;CAI9B,OAAO;EAAE,WAHSC,eAAAA,QAAS,aAAa,IAAI,SAG3B;EAAG,YAFDA,eAAAA,QAAS,aAAa,IAAI,SAEhB;CAAE;AACnC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import nacl from "tweetnacl";
|
|
2
2
|
import naclUtil from "tweetnacl-util";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
|
|
4
|
+
// src/config/schema.ts
|
|
5
5
|
let SigningProvider = /* @__PURE__ */ function(SigningProvider) {
|
|
6
6
|
SigningProvider["WALLET_KERNEL"] = "wallet-kernel";
|
|
7
7
|
SigningProvider["PARTICIPANT"] = "participant";
|
|
@@ -23,8 +23,7 @@ const signingDriverConfigSchema = z.object({
|
|
|
23
23
|
properties: z.record(z.string(), z.any()).optional()
|
|
24
24
|
});
|
|
25
25
|
const signingConfigSchema = z.object({ drivers: z.array(signingDriverConfigSchema).optional() });
|
|
26
|
-
|
|
27
|
-
//#region src/rpc-gen/index.ts
|
|
26
|
+
// src/rpc-gen/index.ts
|
|
28
27
|
function buildController(methods) {
|
|
29
28
|
return {
|
|
30
29
|
signTransaction: methods.signTransaction,
|
|
@@ -38,8 +37,7 @@ function buildController(methods) {
|
|
|
38
37
|
subscribeTransactions: methods.subscribeTransactions
|
|
39
38
|
};
|
|
40
39
|
}
|
|
41
|
-
|
|
42
|
-
//#region src/index.ts
|
|
40
|
+
// src/index.ts
|
|
43
41
|
const CC_COIN_TYPE = 6767;
|
|
44
42
|
function isRpcError(value) {
|
|
45
43
|
return value.error_description !== void 0;
|
|
@@ -73,7 +71,6 @@ const createKeyPair = () => {
|
|
|
73
71
|
privateKey: naclUtil.encodeBase64(key.secretKey)
|
|
74
72
|
};
|
|
75
73
|
};
|
|
76
|
-
//#endregion
|
|
77
74
|
export { CC_COIN_TYPE, PartyMode, SIGN_MESSAGE_CAPABLE_SIGNING_PROVIDERS, SigningProvider, buildController, createKeyPair, getPublicKeyFromPrivate, isRpcError, signMessage, signTransactionHash, signingConfigSchema, signingDriverConfigSchema, verifySignedTxHash };
|
|
78
75
|
|
|
79
76
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/config/schema.ts","../src/rpc-gen/index.ts","../src/index.ts"],"sourcesContent":["// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { z } from 'zod'\n\nexport enum SigningProvider {\n WALLET_KERNEL = 'wallet-kernel',\n PARTICIPANT = 'participant',\n FIREBLOCKS = 'fireblocks',\n BLOCKDAEMON = 'blockdaemon',\n DFNS = 'dfns',\n SECUROSYS = 'securosys',\n BITGO = 'bitgo',\n}\n\nexport const SIGN_MESSAGE_CAPABLE_SIGNING_PROVIDERS: readonly SigningProvider[] =\n [\n SigningProvider.WALLET_KERNEL,\n SigningProvider.DFNS,\n SigningProvider.FIREBLOCKS,\n SigningProvider.SECUROSYS,\n ]\n\n// Generic signing driver configuration schema\nexport const signingDriverConfigSchema = z.object({\n provider: z.nativeEnum(SigningProvider),\n properties: z.record(z.string(), z.any()).optional(),\n})\n\n// Top-level Signing Configuration Schema - array of driver configs\nexport const signingConfigSchema = z.object({\n drivers: z.array(signingDriverConfigSchema).optional(),\n})\n\n// Type exports\nexport type SigningDriverAppConfig = z.infer<typeof signingDriverConfigSchema>\nexport type SigningConfig = z.infer<typeof signingConfigSchema>\n","// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n// Code generated by rpc-generator DO NOT EDIT!!\n\nimport type { SignTransaction } from './typings.js'\nimport type { SignMessage } from './typings.js'\nimport type { GetTransaction } from './typings.js'\nimport type { GetTransactions } from './typings.js'\nimport type { GetKeys } from './typings.js'\nimport type { CreateKey } from './typings.js'\nimport type { GetConfiguration } from './typings.js'\nimport type { SetConfiguration } from './typings.js'\nimport type { SubscribeTransactions } from './typings.js'\n\nexport type Methods = {\n signTransaction: SignTransaction\n signMessage: SignMessage\n getTransaction: GetTransaction\n getTransactions: GetTransactions\n getKeys: GetKeys\n createKey: CreateKey\n getConfiguration: GetConfiguration\n setConfiguration: SetConfiguration\n subscribeTransactions: SubscribeTransactions\n}\n\nfunction buildController(methods: Methods) {\n return {\n signTransaction: methods.signTransaction,\n signMessage: methods.signMessage,\n getTransaction: methods.getTransaction,\n getTransactions: methods.getTransactions,\n getKeys: methods.getKeys,\n createKey: methods.createKey,\n getConfiguration: methods.getConfiguration,\n setConfiguration: methods.setConfiguration,\n subscribeTransactions: methods.subscribeTransactions,\n }\n}\n\nexport default buildController\n","// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { AuthContext } from '@canton-network/core-wallet-auth'\nimport type { Methods } from './rpc-gen/index.js'\nimport type { Error as RpcError } from './rpc-gen/typings.js'\nimport nacl from 'tweetnacl'\nimport naclUtil from 'tweetnacl-util'\nimport { SigningProvider } from './config/schema.js'\n\n// Re-export SigningProvider from config schema\nexport { SigningProvider }\n\nexport { default as buildController, type Methods } from './rpc-gen/index.js'\nexport * from './rpc-gen/typings.js'\nexport * from './SigningDriverStore.js'\nexport * from './config/schema.js'\n\nexport const CC_COIN_TYPE = 6767\n\nexport function isRpcError<T>(value: T | RpcError): value is RpcError {\n return (value as RpcError).error_description !== undefined\n}\n\nexport enum PartyMode {\n INTERNAL = 'internal',\n EXTERNAL = 'external',\n}\n\nexport type PublicKey = string\nexport type PrivateKey = string\n\nexport interface KeyPair {\n publicKey: PublicKey\n privateKey: PrivateKey\n}\n\nexport interface SigningDriverInterface {\n partyMode: PartyMode\n signingProvider: SigningProvider\n controller: (userId: AuthContext['userId'] | undefined) => Methods\n}\n\nexport const verifySignedTxHash = (\n txHash: string,\n publicKey: string,\n signature: string\n): boolean => {\n return nacl.sign.detached.verify(\n naclUtil.decodeBase64(txHash),\n naclUtil.decodeBase64(signature),\n naclUtil.decodeBase64(publicKey)\n )\n}\n\nexport const signTransactionHash = (\n txHash: string,\n privateKey: string\n): string => {\n const decodedKey = naclUtil.decodeBase64(privateKey)\n\n return naclUtil.encodeBase64(\n nacl.sign.detached(naclUtil.decodeBase64(txHash), decodedKey)\n )\n}\n\nexport const signMessage = (message: string, privateKey: string): string => {\n const msgBytes = new TextEncoder().encode(message)\n const decodedKey = naclUtil.decodeBase64(privateKey)\n return naclUtil.encodeBase64(nacl.sign.detached(msgBytes, decodedKey))\n}\n\nexport const getPublicKeyFromPrivate = (privateKeyBase64: string): string => {\n const secretKey = naclUtil.decodeBase64(privateKeyBase64)\n const keyPair = nacl.sign.keyPair.fromSecretKey(secretKey)\n return naclUtil.encodeBase64(keyPair.publicKey)\n}\n\nexport const createKeyPair = (): KeyPair => {\n const key = nacl.sign.keyPair()\n const publicKey = naclUtil.encodeBase64(key.publicKey)\n const privateKey = naclUtil.encodeBase64(key.secretKey)\n\n return { publicKey, privateKey }\n}\n"],"mappings":";;;;AAKA,IAAY,kBAAL,yBAAA,iBAAA;CACH,gBAAA,mBAAA;CACA,gBAAA,iBAAA;CACA,gBAAA,gBAAA;CACA,gBAAA,iBAAA;CACA,gBAAA,UAAA;CACA,gBAAA,eAAA;CACA,gBAAA,WAAA;;AACJ,EAAA,CAAA,CAAA;AAEA,MAAa,yCACT;;;;;AAKA;AAGJ,MAAa,4BAA4B,EAAE,OAAO;CAC9C,UAAU,EAAE,WAAW,eAAe;CACtC,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS;AACvD,CAAC;AAGD,MAAa,sBAAsB,EAAE,OAAO,EACxC,SAAS,EAAE,MAAM,yBAAyB,CAAC,CAAC,SAAS,EACzD,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/config/schema.ts","../src/rpc-gen/index.ts","../src/index.ts"],"sourcesContent":["// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { z } from 'zod'\n\nexport enum SigningProvider {\n WALLET_KERNEL = 'wallet-kernel',\n PARTICIPANT = 'participant',\n FIREBLOCKS = 'fireblocks',\n BLOCKDAEMON = 'blockdaemon',\n DFNS = 'dfns',\n SECUROSYS = 'securosys',\n BITGO = 'bitgo',\n}\n\nexport const SIGN_MESSAGE_CAPABLE_SIGNING_PROVIDERS: readonly SigningProvider[] =\n [\n SigningProvider.WALLET_KERNEL,\n SigningProvider.DFNS,\n SigningProvider.FIREBLOCKS,\n SigningProvider.SECUROSYS,\n ]\n\n// Generic signing driver configuration schema\nexport const signingDriverConfigSchema = z.object({\n provider: z.nativeEnum(SigningProvider),\n properties: z.record(z.string(), z.any()).optional(),\n})\n\n// Top-level Signing Configuration Schema - array of driver configs\nexport const signingConfigSchema = z.object({\n drivers: z.array(signingDriverConfigSchema).optional(),\n})\n\n// Type exports\nexport type SigningDriverAppConfig = z.infer<typeof signingDriverConfigSchema>\nexport type SigningConfig = z.infer<typeof signingConfigSchema>\n","// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n// Code generated by rpc-generator DO NOT EDIT!!\n\nimport type { SignTransaction } from './typings.js'\nimport type { SignMessage } from './typings.js'\nimport type { GetTransaction } from './typings.js'\nimport type { GetTransactions } from './typings.js'\nimport type { GetKeys } from './typings.js'\nimport type { CreateKey } from './typings.js'\nimport type { GetConfiguration } from './typings.js'\nimport type { SetConfiguration } from './typings.js'\nimport type { SubscribeTransactions } from './typings.js'\n\nexport type Methods = {\n signTransaction: SignTransaction\n signMessage: SignMessage\n getTransaction: GetTransaction\n getTransactions: GetTransactions\n getKeys: GetKeys\n createKey: CreateKey\n getConfiguration: GetConfiguration\n setConfiguration: SetConfiguration\n subscribeTransactions: SubscribeTransactions\n}\n\nfunction buildController(methods: Methods) {\n return {\n signTransaction: methods.signTransaction,\n signMessage: methods.signMessage,\n getTransaction: methods.getTransaction,\n getTransactions: methods.getTransactions,\n getKeys: methods.getKeys,\n createKey: methods.createKey,\n getConfiguration: methods.getConfiguration,\n setConfiguration: methods.setConfiguration,\n subscribeTransactions: methods.subscribeTransactions,\n }\n}\n\nexport default buildController\n","// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { AuthContext } from '@canton-network/core-wallet-auth'\nimport type { Methods } from './rpc-gen/index.js'\nimport type { Error as RpcError } from './rpc-gen/typings.js'\nimport nacl from 'tweetnacl'\nimport naclUtil from 'tweetnacl-util'\nimport { SigningProvider } from './config/schema.js'\n\n// Re-export SigningProvider from config schema\nexport { SigningProvider }\n\nexport { default as buildController, type Methods } from './rpc-gen/index.js'\nexport * from './rpc-gen/typings.js'\nexport * from './SigningDriverStore.js'\nexport * from './config/schema.js'\n\nexport const CC_COIN_TYPE = 6767\n\nexport function isRpcError<T>(value: T | RpcError): value is RpcError {\n return (value as RpcError).error_description !== undefined\n}\n\nexport enum PartyMode {\n INTERNAL = 'internal',\n EXTERNAL = 'external',\n}\n\nexport type PublicKey = string\nexport type PrivateKey = string\n\nexport interface KeyPair {\n publicKey: PublicKey\n privateKey: PrivateKey\n}\n\nexport interface SigningDriverInterface {\n partyMode: PartyMode\n signingProvider: SigningProvider\n controller: (userId: AuthContext['userId'] | undefined) => Methods\n}\n\nexport const verifySignedTxHash = (\n txHash: string,\n publicKey: string,\n signature: string\n): boolean => {\n return nacl.sign.detached.verify(\n naclUtil.decodeBase64(txHash),\n naclUtil.decodeBase64(signature),\n naclUtil.decodeBase64(publicKey)\n )\n}\n\nexport const signTransactionHash = (\n txHash: string,\n privateKey: string\n): string => {\n const decodedKey = naclUtil.decodeBase64(privateKey)\n\n return naclUtil.encodeBase64(\n nacl.sign.detached(naclUtil.decodeBase64(txHash), decodedKey)\n )\n}\n\nexport const signMessage = (message: string, privateKey: string): string => {\n const msgBytes = new TextEncoder().encode(message)\n const decodedKey = naclUtil.decodeBase64(privateKey)\n return naclUtil.encodeBase64(nacl.sign.detached(msgBytes, decodedKey))\n}\n\nexport const getPublicKeyFromPrivate = (privateKeyBase64: string): string => {\n const secretKey = naclUtil.decodeBase64(privateKeyBase64)\n const keyPair = nacl.sign.keyPair.fromSecretKey(secretKey)\n return naclUtil.encodeBase64(keyPair.publicKey)\n}\n\nexport const createKeyPair = (): KeyPair => {\n const key = nacl.sign.keyPair()\n const publicKey = naclUtil.encodeBase64(key.publicKey)\n const privateKey = naclUtil.encodeBase64(key.secretKey)\n\n return { publicKey, privateKey }\n}\n"],"mappings":";;;;AAKA,IAAY,kBAAL,yBAAA,iBAAA;CACH,gBAAA,mBAAA;CACA,gBAAA,iBAAA;CACA,gBAAA,gBAAA;CACA,gBAAA,iBAAA;CACA,gBAAA,UAAA;CACA,gBAAA,eAAA;CACA,gBAAA,WAAA;;AACJ,EAAA,CAAA,CAAA;AAEA,MAAa,yCACT;;;;;AAKA;AAGJ,MAAa,4BAA4B,EAAE,OAAO;CAC9C,UAAU,EAAE,WAAW,eAAe;CACtC,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS;AACvD,CAAC;AAGD,MAAa,sBAAsB,EAAE,OAAO,EACxC,SAAS,EAAE,MAAM,yBAAyB,CAAC,CAAC,SAAS,EACzD,CAAC;;ACLD,SAAS,gBAAgB,SAAkB;CACvC,OAAO;EACH,iBAAiB,QAAQ;EACzB,aAAa,QAAQ;EACrB,gBAAgB,QAAQ;EACxB,iBAAiB,QAAQ;EACzB,SAAS,QAAQ;EACjB,WAAW,QAAQ;EACnB,kBAAkB,QAAQ;EAC1B,kBAAkB,QAAQ;EAC1B,uBAAuB,QAAQ;CACnC;AACJ;;ACrBA,MAAa,eAAe;AAE5B,SAAgB,WAAc,OAAwC;CAClE,OAAQ,MAAmB,sBAAsB,KAAA;AACrD;AAEA,IAAY,YAAL,yBAAA,WAAA;CACH,UAAA,cAAA;CACA,UAAA,cAAA;;AACJ,EAAA,CAAA,CAAA;AAgBA,MAAa,sBACT,QACA,WACA,cACU;CACV,OAAO,KAAK,KAAK,SAAS,OACtB,SAAS,aAAa,MAAM,GAC5B,SAAS,aAAa,SAAS,GAC/B,SAAS,aAAa,SAAS,CACnC;AACJ;AAEA,MAAa,uBACT,QACA,eACS;CACT,MAAM,aAAa,SAAS,aAAa,UAAU;CAEnD,OAAO,SAAS,aACZ,KAAK,KAAK,SAAS,SAAS,aAAa,MAAM,GAAG,UAAU,CAChE;AACJ;AAEA,MAAa,eAAe,SAAiB,eAA+B;CACxE,MAAM,WAAW,IAAI,YAAY,CAAC,CAAC,OAAO,OAAO;CACjD,MAAM,aAAa,SAAS,aAAa,UAAU;CACnD,OAAO,SAAS,aAAa,KAAK,KAAK,SAAS,UAAU,UAAU,CAAC;AACzE;AAEA,MAAa,2BAA2B,qBAAqC;CACzE,MAAM,YAAY,SAAS,aAAa,gBAAgB;CACxD,MAAM,UAAU,KAAK,KAAK,QAAQ,cAAc,SAAS;CACzD,OAAO,SAAS,aAAa,QAAQ,SAAS;AAClD;AAEA,MAAa,sBAA+B;CACxC,MAAM,MAAM,KAAK,KAAK,QAAQ;CAI9B,OAAO;EAAE,WAHS,SAAS,aAAa,IAAI,SAG3B;EAAG,YAFD,SAAS,aAAa,IAAI,SAEhB;CAAE;AACnC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canton-network/core-signing-lib",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core library for signing driver implementations",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -17,17 +17,15 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@canton-network/core-wallet-auth": "2.
|
|
21
|
-
"lodash": "^4.18.1",
|
|
20
|
+
"@canton-network/core-wallet-auth": "2.2.0",
|
|
22
21
|
"tweetnacl": "^1.0.3",
|
|
23
22
|
"tweetnacl-util": "^0.15.1",
|
|
24
23
|
"zod": "^4.6.7"
|
|
25
24
|
},
|
|
26
25
|
"devDependencies": {
|
|
27
|
-
"@types/lodash": "^4.17.26",
|
|
28
26
|
"@types/node": "^25.9.9",
|
|
29
27
|
"@vitest/coverage-v8": "^5.0.5",
|
|
30
|
-
"tsdown": "^0.23.
|
|
28
|
+
"tsdown": "^0.23.2",
|
|
31
29
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
32
30
|
"vitest": "^5.0.5"
|
|
33
31
|
},
|