@signet-auth/core 0.1.0 → 0.2.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/src/index.d.ts +16 -0
- package/dist/src/index.js +9 -2
- package/dist/tests/core.test.js +1 -1
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -26,3 +26,19 @@ export interface SignetReceipt {
|
|
|
26
26
|
export declare function generateKeypair(): SignetKeypair;
|
|
27
27
|
export declare function sign(secretKey: string, action: SignetAction, signerName: string, signerOwner: string): SignetReceipt;
|
|
28
28
|
export declare function verify(receipt: SignetReceipt, publicKey: string): boolean;
|
|
29
|
+
export interface SignetResponse {
|
|
30
|
+
content_hash: string;
|
|
31
|
+
}
|
|
32
|
+
export interface CompoundReceipt {
|
|
33
|
+
v: number;
|
|
34
|
+
id: string;
|
|
35
|
+
action: SignetAction;
|
|
36
|
+
response: SignetResponse;
|
|
37
|
+
signer: SignetSigner;
|
|
38
|
+
ts_request: string;
|
|
39
|
+
ts_response: string;
|
|
40
|
+
nonce: string;
|
|
41
|
+
sig: string;
|
|
42
|
+
}
|
|
43
|
+
export declare function signCompound(secretKey: string, action: SignetAction, responseContent: unknown, signerName: string, signerOwner: string, tsRequest: string, tsResponse: string): CompoundReceipt;
|
|
44
|
+
export declare function verifyAny(receiptJson: string, publicKey: string): boolean;
|
package/dist/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// @signet/core — TypeScript wrapper for signet WASM
|
|
2
|
-
import { wasm_generate_keypair, wasm_sign, wasm_verify } from '../wasm/signet_wasm.js';
|
|
1
|
+
// @signet-auth/core — TypeScript wrapper for signet WASM
|
|
2
|
+
import { wasm_generate_keypair, wasm_sign, wasm_verify, wasm_sign_compound, wasm_verify_any } from '../wasm/signet_wasm.js';
|
|
3
3
|
export function generateKeypair() {
|
|
4
4
|
const json = wasm_generate_keypair();
|
|
5
5
|
const result = JSON.parse(json);
|
|
@@ -16,3 +16,10 @@ export function sign(secretKey, action, signerName, signerOwner) {
|
|
|
16
16
|
export function verify(receipt, publicKey) {
|
|
17
17
|
return wasm_verify(JSON.stringify(receipt), publicKey);
|
|
18
18
|
}
|
|
19
|
+
export function signCompound(secretKey, action, responseContent, signerName, signerOwner, tsRequest, tsResponse) {
|
|
20
|
+
const json = wasm_sign_compound(secretKey, JSON.stringify(action), JSON.stringify(responseContent), signerName, signerOwner, tsRequest, tsResponse);
|
|
21
|
+
return JSON.parse(json);
|
|
22
|
+
}
|
|
23
|
+
export function verifyAny(receiptJson, publicKey) {
|
|
24
|
+
return wasm_verify_any(receiptJson, publicKey);
|
|
25
|
+
}
|
package/dist/tests/core.test.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, it } from 'node:test';
|
|
2
2
|
import assert from 'node:assert';
|
|
3
3
|
import { generateKeypair, sign, verify } from '../src/index.js';
|
|
4
|
-
describe('@signet/core', () => {
|
|
4
|
+
describe('@signet-auth/core', () => {
|
|
5
5
|
const testAction = {
|
|
6
6
|
tool: 'github_create_issue',
|
|
7
7
|
params: { title: 'fix bug', body: 'details' },
|