@mysten/enoki 1.1.1 → 1.2.1
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/CHANGELOG.md +13 -0
- package/dist/EnokiKeypair.d.mts +3 -8
- package/dist/EnokiKeypair.d.mts.map +1 -1
- package/dist/EnokiKeypair.mjs +10 -39
- package/dist/EnokiKeypair.mjs.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @mysten/enoki
|
|
2
2
|
|
|
3
|
+
## 1.2.1
|
|
4
|
+
|
|
5
|
+
## 1.2.0
|
|
6
|
+
|
|
7
|
+
### Minor Changes
|
|
8
|
+
|
|
9
|
+
- 7452835: `EnokiKeypair` now extends the shared `ZkLoginSigner` from `@mysten/sui/zklogin`,
|
|
10
|
+
removing duplicated signature-wrapping logic. `signTransaction` / `signPersonalMessage` /
|
|
11
|
+
`getPublicKey` are unchanged. Two behaviors are corrected to match `ZkLoginSigner`:
|
|
12
|
+
`getKeyScheme()` now returns `'ZkLogin'` (previously the ephemeral key's scheme), and `sign()` now
|
|
13
|
+
throws instead of returning a bare ephemeral signature (which was never valid for the zkLogin
|
|
14
|
+
address).
|
|
15
|
+
|
|
3
16
|
## 1.1.1
|
|
4
17
|
|
|
5
18
|
## 1.1.0
|
package/dist/EnokiKeypair.d.mts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { ZkLoginPublicIdentifier, ZkLoginSignatureInputs } from "@mysten/sui/zklogin";
|
|
1
|
+
import { Signer } from "@mysten/sui/cryptography";
|
|
2
|
+
import { ZkLoginPublicIdentifier, ZkLoginSignatureInputs, ZkLoginSigner } from "@mysten/sui/zklogin";
|
|
4
3
|
|
|
5
4
|
//#region src/EnokiKeypair.d.ts
|
|
6
5
|
declare class EnokiPublicKey extends ZkLoginPublicIdentifier {}
|
|
7
|
-
declare class EnokiKeypair extends
|
|
6
|
+
declare class EnokiKeypair extends ZkLoginSigner {
|
|
8
7
|
#private;
|
|
9
8
|
constructor(input: {
|
|
10
9
|
address: string;
|
|
@@ -12,10 +11,6 @@ declare class EnokiKeypair extends Signer {
|
|
|
12
11
|
proof: ZkLoginSignatureInputs;
|
|
13
12
|
ephemeralKeypair: Signer;
|
|
14
13
|
});
|
|
15
|
-
sign(data: Uint8Array): Promise<Uint8Array<ArrayBuffer>>;
|
|
16
|
-
signPersonalMessage(bytes: Uint8Array): Promise<SignatureWithBytes>;
|
|
17
|
-
signTransaction(bytes: Uint8Array): Promise<SignatureWithBytes>;
|
|
18
|
-
getKeyScheme(): _mysten_sui_cryptography0.SignatureScheme;
|
|
19
14
|
getPublicKey(): EnokiPublicKey;
|
|
20
15
|
}
|
|
21
16
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnokiKeypair.d.mts","names":[],"sources":["../src/EnokiKeypair.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EnokiKeypair.d.mts","names":[],"sources":["../src/EnokiKeypair.ts"],"mappings":";;;;cAOa,cAAA,SAAuB,uBAAA;AAAA,cAEvB,YAAA,SAAqB,aAAA;EAAA;cAGrB,KAAA;IACX,OAAA;IACA,QAAA;IACA,KAAA,EAAO,sBAAA;IACP,gBAAA,EAAkB,MAAA;EAAA;EAcV,YAAA,CAAA,GAAgB,cAAA;AAAA"}
|
package/dist/EnokiKeypair.mjs
CHANGED
|
@@ -1,47 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ZkLoginPublicIdentifier, getZkLoginSignature } from "@mysten/sui/zklogin";
|
|
1
|
+
import { ZkLoginPublicIdentifier, ZkLoginSigner } from "@mysten/sui/zklogin";
|
|
3
2
|
|
|
4
3
|
//#region src/EnokiKeypair.ts
|
|
5
4
|
var EnokiPublicKey = class extends ZkLoginPublicIdentifier {};
|
|
6
|
-
var EnokiKeypair = class extends
|
|
7
|
-
#proof;
|
|
8
|
-
#maxEpoch;
|
|
9
|
-
#ephemeralKeypair;
|
|
5
|
+
var EnokiKeypair = class extends ZkLoginSigner {
|
|
10
6
|
#publicKey;
|
|
11
7
|
constructor(input) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
async signPersonalMessage(bytes) {
|
|
22
|
-
const { bytes: signedBytes, signature: userSignature } = await this.#ephemeralKeypair.signPersonalMessage(bytes);
|
|
23
|
-
return {
|
|
24
|
-
bytes: signedBytes,
|
|
25
|
-
signature: getZkLoginSignature({
|
|
26
|
-
inputs: this.#proof,
|
|
27
|
-
maxEpoch: this.#maxEpoch,
|
|
28
|
-
userSignature
|
|
29
|
-
})
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
async signTransaction(bytes) {
|
|
33
|
-
const { bytes: signedBytes, signature: userSignature } = await this.#ephemeralKeypair.signTransaction(bytes);
|
|
34
|
-
return {
|
|
35
|
-
bytes: signedBytes,
|
|
36
|
-
signature: getZkLoginSignature({
|
|
37
|
-
inputs: this.#proof,
|
|
38
|
-
maxEpoch: this.#maxEpoch,
|
|
39
|
-
userSignature
|
|
40
|
-
})
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
getKeyScheme() {
|
|
44
|
-
return this.#ephemeralKeypair.getKeyScheme();
|
|
8
|
+
const publicKey = EnokiPublicKey.fromProof(input.address, input.proof);
|
|
9
|
+
super({
|
|
10
|
+
ephemeralSigner: input.ephemeralKeypair,
|
|
11
|
+
maxEpoch: input.maxEpoch,
|
|
12
|
+
inputs: input.proof,
|
|
13
|
+
legacyAddress: publicKey.legacyAddress
|
|
14
|
+
});
|
|
15
|
+
this.#publicKey = publicKey;
|
|
45
16
|
}
|
|
46
17
|
getPublicKey() {
|
|
47
18
|
return this.#publicKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnokiKeypair.mjs","names":["#
|
|
1
|
+
{"version":3,"file":"EnokiKeypair.mjs","names":["#publicKey"],"sources":["../src/EnokiKeypair.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Signer } from '@mysten/sui/cryptography';\nimport type { ZkLoginSignatureInputs } from '@mysten/sui/zklogin';\nimport { ZkLoginPublicIdentifier, ZkLoginSigner } from '@mysten/sui/zklogin';\n\nexport class EnokiPublicKey extends ZkLoginPublicIdentifier {}\n\nexport class EnokiKeypair extends ZkLoginSigner {\n\t#publicKey: EnokiPublicKey;\n\n\tconstructor(input: {\n\t\taddress: string;\n\t\tmaxEpoch: number;\n\t\tproof: ZkLoginSignatureInputs;\n\t\tephemeralKeypair: Signer;\n\t}) {\n\t\t// Resolve the public key exactly as before — `fromProof` matches the proof against the\n\t\t// supplied address and validates it — then bridge that to the base's `legacyAddress` flag.\n\t\tconst publicKey = EnokiPublicKey.fromProof(input.address, input.proof);\n\t\tsuper({\n\t\t\tephemeralSigner: input.ephemeralKeypair,\n\t\t\tmaxEpoch: input.maxEpoch,\n\t\t\tinputs: input.proof,\n\t\t\tlegacyAddress: publicKey.legacyAddress,\n\t\t});\n\t\tthis.#publicKey = publicKey;\n\t}\n\n\toverride getPublicKey(): EnokiPublicKey {\n\t\treturn this.#publicKey;\n\t}\n}\n"],"mappings":";;;AAOA,IAAa,iBAAb,cAAoC,wBAAwB;AAE5D,IAAa,eAAb,cAAkC,cAAc;CAC/C;CAEA,YAAY,OAKT;EAGF,MAAM,YAAY,eAAe,UAAU,MAAM,SAAS,MAAM,MAAM;AACtE,QAAM;GACL,iBAAiB,MAAM;GACvB,UAAU,MAAM;GAChB,QAAQ,MAAM;GACd,eAAe,UAAU;GACzB,CAAC;AACF,QAAKA,YAAa;;CAGnB,AAAS,eAA+B;AACvC,SAAO,MAAKA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mysten/enoki",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "zkLogin authentication and sponsored transactions",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Mysten Labs <build@mystenlabs.com>",
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"@wallet-standard/ui": "^1.0.3",
|
|
46
46
|
"idb-keyval": "^6.2.5",
|
|
47
47
|
"nanostores": "^1.3.0",
|
|
48
|
-
"@mysten/
|
|
49
|
-
"@mysten/
|
|
50
|
-
"@mysten/
|
|
48
|
+
"@mysten/utils": "^0.4.0",
|
|
49
|
+
"@mysten/wallet-standard": "^0.21.3",
|
|
50
|
+
"@mysten/webcrypto-signer": "^0.2.3"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@types/react": ">=17.0.0",
|
|
54
54
|
"react": ">=17.0.0",
|
|
55
|
-
"@mysten/sui": "^2.
|
|
55
|
+
"@mysten/sui": "^2.20.1"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"react": {
|