@canton-network/core-signing-lib 0.18.0 → 0.19.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.
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
export interface SigningDriverStore {
|
|
7
7
|
getSigningKey(userId: string, keyId: string): Promise<SigningKey | undefined>;
|
|
8
8
|
getSigningKeyByPublicKey(publicKey: string): Promise<SigningKey | undefined>;
|
|
9
|
+
getSigningKeyByName(userId: string, name: string): Promise<SigningKey | undefined>;
|
|
9
10
|
listSigningTransactionsByTxIdsAndPublicKeys(txIds: string[], publicKeys: string[]): Promise<SigningTransaction[]>;
|
|
10
11
|
setSigningKey(userId: string, key: SigningKey): Promise<void>;
|
|
11
12
|
deleteSigningKey(userId: string, keyId: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SigningDriverStore.d.ts","sourceRoot":"","sources":["../src/SigningDriverStore.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IAE/B,aAAa,CACT,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACd,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAA;IAClC,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAA;IAC5E,2CAA2C,CACvC,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAAE,GACrB,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAA;IAChC,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7D,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9D,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,C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MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC,SAAS,EAAE,IAAI,CAAA;IACf,SAAS,EAAE,IAAI,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,mBAAmB,CAAA;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC,SAAS,EAAE,IAAI,CAAA;IACf,SAAS,EAAE,IAAI,CAAA;IACf,QAAQ,CAAC,EAAE,IAAI,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClC;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAA"}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config/schema.ts","../src/rpc-gen/index.ts","../src/index.ts"],"names":["SigningProvider","z","PartyMode","nacl","naclUtil"],"mappings":";;;;;;;;;;;;AAKO,IAAK,eAAA,qBAAAA,gBAAAA,KAAL;AACH,EAAAA,iBAAA,eAAA,CAAA,GAAgB,eAAA;AAChB,EAAAA,iBAAA,aAAA,CAAA,GAAc,aAAA;AACd,EAAAA,iBAAA,YAAA,CAAA,GAAa,YAAA;AACb,EAAAA,iBAAA,aAAA,CAAA,GAAc,aAAA;AAJN,EAAA,OAAAA,gBAAAA;AAAA,CAAA,EAAA,eAAA,IAAA,EAAA;AAQL,IAAM,yBAAA,GAA4BC,MAAE,MAAA,CA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S,CAAA;AAAA,IAC/BA,yBAAA,CAAS,aAAa,SAAS;AAAA,GACnC;AACJ;AAEO,IAAM,mBAAA,GAAsB,CAC/B,MAAA,EACA,UAAA,KACS;AACT,EAAA,MAAM,UAAA,GAAaA,yBAAA,CAAS,YAAA,CAAa,UAAU,CAAA;AAEnD,EAAA,OAAOA,yBAAA,CAAS,YAAA;AAAA,IACZD,sBAAK,IAAA,CAAK,QAAA,CAASC,0BAAS,YAAA,CAAa,MAAM,GAAG,UAAU;AAAA,GAChE;AACJ;AAEO,IAAM,uBAAA,GAA0B,CAAC,gBAAA,KAAqC;AACzE,EAAA,MAAM,SAAA,GAAYA,yBAAA,CAAS,YAAA,CAAa,gBAAgB,CAAA;AACxD,EAAA,MAAM,OAAA,GAAUD,qBAAA,CAAK,IAAA,CAAK,OAAA,CAAQ,cAAc,SAAS,CAAA;AACzD,EAAA,OAAOC,yBAAA,CAAS,YAAA,CAAa,OAAA,CAAQ,SAAS,CAAA;AAClD;AAEO,IAAM,gBAAgB,MAAe;AACxC,EAAA,MAAM,GAAA,GAAMD,qBAAA,CAAK,IAAA,CAAK,OAAA,EAAQ;AAC9B,EAAA,MAAM,SAAA,GAAYC,yBAAA,CAAS,YAAA,CAAa,GAAA,CAAI,SAAS,CAAA;AACrD,EAAA,MAAM,UAAA,GAAaA,yBAAA,CAAS,YAAA,CAAa,GAAA,CAAI,SAAS,CAAA;AAEtD,EAAA,OAAO,EAAE,WAAW,UAAA,EAAW;AACnC","file":"index.cjs","sourcesContent":["// Copyright (c) 2025 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}\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 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { SignTransaction } from './typings.js'\nimport { GetTransaction } from './typings.js'\nimport { GetTransactions } from './typings.js'\nimport { GetKeys } from './typings.js'\nimport { CreateKey } from './typings.js'\nimport { GetConfiguration } from './typings.js'\nimport { SetConfiguration } from './typings.js'\nimport { SubscribeTransactions } from './typings.js'\n\nexport type Methods = {\n signTransaction: SignTransaction\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 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 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AuthContext } from '@canton-network/core-wallet-auth'\nimport { Methods } from './rpc-gen/index.js'\nimport { 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, 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 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"]}
|
|
1
|
+
{"version":3,"sources":["../src/config/schema.ts","../src/rpc-gen/index.ts","../src/index.ts"],"names":["SigningProvider","z","PartyMode","nacl","naclUtil"],"mappings":";;;;;;;;;;;;AAKO,IAAK,eAAA,qBAAAA,gBAAAA,KAAL;AACH,EAAAA,iBAAA,eAAA,CAAA,GAAgB,eAAA;AAChB,EAAAA,iBAAA,aAAA,CAAA,GAAc,aAAA;AACd,EAAAA,iBAAA,YAAA,CAAA,GAAa,YAAA;AACb,EAAA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U;AACV,EAAA,OAAOC,qBAAA,CAAK,KAAK,QAAA,CAAS,MAAA;AAAA,IACtBC,yBAAA,CAAS,aAAa,MAAM,CAAA;AAAA,IAC5BA,yBAAA,CAAS,aAAa,SAAS,CAAA;AAAA,IAC/BA,yBAAA,CAAS,aAAa,SAAS;AAAA,GACnC;AACJ;AAEO,IAAM,mBAAA,GAAsB,CAC/B,MAAA,EACA,UAAA,KACS;AACT,EAAA,MAAM,UAAA,GAAaA,yBAAA,CAAS,YAAA,CAAa,UAAU,CAAA;AAEnD,EAAA,OAAOA,yBAAA,CAAS,YAAA;AAAA,IACZD,sBAAK,IAAA,CAAK,QAAA,CAASC,0BAAS,YAAA,CAAa,MAAM,GAAG,UAAU;AAAA,GAChE;AACJ;AAEO,IAAM,uBAAA,GAA0B,CAAC,gBAAA,KAAqC;AACzE,EAAA,MAAM,SAAA,GAAYA,yBAAA,CAAS,YAAA,CAAa,gBAAgB,CAAA;AACxD,EAAA,MAAM,OAAA,GAAUD,qBAAA,CAAK,IAAA,CAAK,OAAA,CAAQ,cAAc,SAAS,CAAA;AACzD,EAAA,OAAOC,yBAAA,CAAS,YAAA,CAAa,OAAA,CAAQ,SAAS,CAAA;AAClD;AAEO,IAAM,gBAAgB,MAAe;AACxC,EAAA,MAAM,GAAA,GAAMD,qBAAA,CAAK,IAAA,CAAK,OAAA,EAAQ;AAC9B,EAAA,MAAM,SAAA,GAAYC,yBAAA,CAAS,YAAA,CAAa,GAAA,CAAI,SAAS,CAAA;AACrD,EAAA,MAAM,UAAA,GAAaA,yBAAA,CAAS,YAAA,CAAa,GAAA,CAAI,SAAS,CAAA;AAEtD,EAAA,OAAO,EAAE,WAAW,UAAA,EAAW;AACnC","file":"index.cjs","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}\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\nimport { SignTransaction } from './typings.js'\nimport { GetTransaction } from './typings.js'\nimport { GetTransactions } from './typings.js'\nimport { GetKeys } from './typings.js'\nimport { CreateKey } from './typings.js'\nimport { GetConfiguration } from './typings.js'\nimport { SetConfiguration } from './typings.js'\nimport { SubscribeTransactions } from './typings.js'\n\nexport type Methods = {\n signTransaction: SignTransaction\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 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 { AuthContext } from '@canton-network/core-wallet-auth'\nimport { Methods } from './rpc-gen/index.js'\nimport { 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, 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 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"]}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config/schema.ts","../src/rpc-gen/index.ts","../src/index.ts"],"names":["SigningProvider","PartyMode"],"mappings":";;;;;AAKO,IAAK,e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erland) 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}\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 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { SignTransaction } from './typings.js'\nimport { GetTransaction } from './typings.js'\nimport { GetTransactions } from './typings.js'\nimport { GetKeys } from './typings.js'\nimport { CreateKey } from './typings.js'\nimport { GetConfiguration } from './typings.js'\nimport { SetConfiguration } from './typings.js'\nimport { SubscribeTransactions } from './typings.js'\n\nexport type Methods = {\n signTransaction: SignTransaction\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 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 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AuthContext } from '@canton-network/core-wallet-auth'\nimport { Methods } from './rpc-gen/index.js'\nimport { 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, 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 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"]}
|
|
1
|
+
{"version":3,"sources":["../src/config/schema.ts","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,EAAE,WAAW,UAAA,EAAW;AACnC","file":"index.js","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}\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\nimport { SignTransaction } from './typings.js'\nimport { GetTransaction } from './typings.js'\nimport { GetTransactions } from './typings.js'\nimport { GetKeys } from './typings.js'\nimport { CreateKey } from './typings.js'\nimport { GetConfiguration } from './typings.js'\nimport { SetConfiguration } from './typings.js'\nimport { SubscribeTransactions } from './typings.js'\n\nexport type Methods = {\n signTransaction: SignTransaction\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 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 { AuthContext } from '@canton-network/core-wallet-auth'\nimport { Methods } from './rpc-gen/index.js'\nimport { 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, 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 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"]}
|
|
@@ -16,6 +16,38 @@ export type TxHash = string;
|
|
|
16
16
|
*
|
|
17
17
|
*/
|
|
18
18
|
export type PublicKey = string;
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* Unique identifier for the key
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
export type Id = string;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* Key identifier with publicKey (id is optional).
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
export interface KeyIdentifierWithPublicKey {
|
|
31
|
+
publicKey: PublicKey;
|
|
32
|
+
id?: Id;
|
|
33
|
+
[k: string]: any;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* Key identifier with id (publicKey is optional).
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
export interface KeyIdentifierWithId {
|
|
41
|
+
publicKey?: PublicKey;
|
|
42
|
+
id: Id;
|
|
43
|
+
[k: string]: any;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* Identifier for the key to use for signing. At least one of publicKey or id must be provided.
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
export type KeyIdentifier = KeyIdentifierWithPublicKey | KeyIdentifierWithId;
|
|
19
51
|
/**
|
|
20
52
|
*
|
|
21
53
|
* Internal txId used by the Wallet Gateway to store the transaction.
|
|
@@ -101,12 +133,6 @@ export interface ObjectOfTransactionsUOtaZpXE {
|
|
|
101
133
|
transactions?: Transactions;
|
|
102
134
|
[k: string]: any;
|
|
103
135
|
}
|
|
104
|
-
/**
|
|
105
|
-
*
|
|
106
|
-
* Unique identifier for the key
|
|
107
|
-
*
|
|
108
|
-
*/
|
|
109
|
-
export type Id = string;
|
|
110
136
|
export interface Key {
|
|
111
137
|
id: Id;
|
|
112
138
|
name: Name;
|
|
@@ -122,7 +148,7 @@ export type Keys = Key[];
|
|
|
122
148
|
export interface SignTransactionParams {
|
|
123
149
|
tx: Tx;
|
|
124
150
|
txHash: TxHash;
|
|
125
|
-
|
|
151
|
+
keyIdentifier: KeyIdentifier;
|
|
126
152
|
internalTxId?: InternalTxId;
|
|
127
153
|
[k: string]: any;
|
|
128
154
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typings.d.ts","sourceRoot":"","sources":["../../src/rpc-gen/typings.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,MAAM,MAAM,EAAE,GAAG,MAAM,CAAA;AACvB;;;;GAIG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAA;AAC3B;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAA;AAC9B;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAA;AACjC;;;;GAIG;AACH,MAAM,MAAM,IAAI,GAAG,MAAM,CAAA;AACzB;;;;GAIG;AACH,MAAM,MAAM,KAAK,GAAG,IAAI,EAAE,CAAA;AAC1B;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,EAAE,CAAA;AACpC;;;;GAIG;AACH,MAAM,MAAM,IAAI,GAAG,MAAM,CAAA;AACzB;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAA;AAC9B;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAA;AACrC,MAAM,WAAW,KAAK;IAClB,KAAK,EAAE,SAAS,CAAA;IAChB,iBAAiB,EAAE,gBAAgB,CAAA;IACnC,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB;AACD;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAA;AACxE;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAA;AAC9B;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACrB,CAAC,GAA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|
1
1
|
{
|
|
2
2
|
"name": "@canton-network/core-signing-lib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core library for signing driver implementations",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"clean": "tsc -b --clean && rm -rf ./dist"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@canton-network/core-wallet-auth": "^0.16.
|
|
26
|
+
"@canton-network/core-wallet-auth": "^0.16.1",
|
|
27
27
|
"fs-extra": "^11.3.2",
|
|
28
28
|
"lodash": "^4.17.21",
|
|
29
29
|
"tweetnacl": "^1.0.3",
|