@mysten/enoki
Advanced tools
Comparing version 0.2.7 to 0.2.8
# @mysten/enoki | ||
## 0.2.8 | ||
### Patch Changes | ||
- 7e88f74d66: Add support for signing personal messages | ||
## 0.2.7 | ||
@@ -4,0 +10,0 @@ |
@@ -26,3 +26,3 @@ import type { SignatureWithBytes } from '@mysten/sui.js/cryptography'; | ||
sign(data: Uint8Array): Promise<Uint8Array>; | ||
signPersonalMessage(): never; | ||
signPersonalMessage(bytes: Uint8Array): Promise<SignatureWithBytes>; | ||
signTransactionBlock(bytes: Uint8Array): Promise<SignatureWithBytes>; | ||
@@ -29,0 +29,0 @@ getKeyScheme(): import("@mysten/sui.js/cryptography").SignatureScheme; |
@@ -90,4 +90,13 @@ "use strict"; | ||
} | ||
signPersonalMessage() { | ||
throw new Error("Signing personal messages is not supported"); | ||
async signPersonalMessage(bytes) { | ||
const { bytes: signedBytes, signature: userSignature } = await __privateGet(this, _ephemeralKeypair).signPersonalMessage(bytes); | ||
const zkSignature = (0, import_zklogin.getZkLoginSignature)({ | ||
inputs: __privateGet(this, _proof), | ||
maxEpoch: __privateGet(this, _maxEpoch), | ||
userSignature | ||
}); | ||
return { | ||
bytes: signedBytes, | ||
signature: zkSignature | ||
}; | ||
} | ||
@@ -116,3 +125,3 @@ async signTransactionBlock(bytes) { | ||
getSecretKey() { | ||
throw new Error("EnokiKeypair does not support get secret key"); | ||
throw new Error("EnokiKeypair does not support getting the secret key"); | ||
} | ||
@@ -119,0 +128,0 @@ } |
@@ -26,3 +26,3 @@ import type { SignatureWithBytes } from '@mysten/sui.js/cryptography'; | ||
sign(data: Uint8Array): Promise<Uint8Array>; | ||
signPersonalMessage(): never; | ||
signPersonalMessage(bytes: Uint8Array): Promise<SignatureWithBytes>; | ||
signTransactionBlock(bytes: Uint8Array): Promise<SignatureWithBytes>; | ||
@@ -29,0 +29,0 @@ getKeyScheme(): import("@mysten/sui.js/cryptography").SignatureScheme; |
@@ -66,4 +66,13 @@ var __accessCheck = (obj, member, msg) => { | ||
} | ||
signPersonalMessage() { | ||
throw new Error("Signing personal messages is not supported"); | ||
async signPersonalMessage(bytes) { | ||
const { bytes: signedBytes, signature: userSignature } = await __privateGet(this, _ephemeralKeypair).signPersonalMessage(bytes); | ||
const zkSignature = getZkLoginSignature({ | ||
inputs: __privateGet(this, _proof), | ||
maxEpoch: __privateGet(this, _maxEpoch), | ||
userSignature | ||
}); | ||
return { | ||
bytes: signedBytes, | ||
signature: zkSignature | ||
}; | ||
} | ||
@@ -92,3 +101,3 @@ async signTransactionBlock(bytes) { | ||
getSecretKey() { | ||
throw new Error("EnokiKeypair does not support get secret key"); | ||
throw new Error("EnokiKeypair does not support getting the secret key"); | ||
} | ||
@@ -95,0 +104,0 @@ } |
{ | ||
"name": "@mysten/enoki", | ||
"version": "0.2.7", | ||
"version": "0.2.8", | ||
"description": "TODO: Description", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
312700
2162