@donezone/client 0.1.46 → 0.1.49
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/envelope.d.ts +5 -0
- package/dist/envelope.d.ts.map +1 -1
- package/dist/envelope.js +15 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/envelope.d.ts
CHANGED
|
@@ -24,6 +24,11 @@ export declare function toSignDoc(envelope: AuthEnvelope | EnvelopeDraft): AuthE
|
|
|
24
24
|
export declare function buildEnvelope(draft: EnvelopeDraft): AuthEnvelope;
|
|
25
25
|
export declare function signDocBytes(signDoc: AuthEnvelopeSignDoc): Uint8Array;
|
|
26
26
|
export declare function signDocDigest(signDoc: AuthEnvelopeSignDoc): Uint8Array;
|
|
27
|
+
export interface DevEnvelopeBuilderOptions {
|
|
28
|
+
userId?: string;
|
|
29
|
+
ttlSeconds?: number;
|
|
30
|
+
}
|
|
31
|
+
export declare function createDevEnvelopeBuilder(options?: DevEnvelopeBuilderOptions): import("./types").EnvelopeBuilder;
|
|
27
32
|
export declare function encodeSignature(signature: Uint8Array): string;
|
|
28
33
|
export declare function decodeSignature(signature: string): Uint8Array;
|
|
29
34
|
//# sourceMappingURL=envelope.d.ts.map
|
package/dist/envelope.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../src/envelope.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,IAAI,EACJ,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,M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ify(value) {
|
|
|
73
73
|
return val;
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
+
export function createDevEnvelopeBuilder(options = {}) {
|
|
77
|
+
const userId = options.userId ?? "dev";
|
|
78
|
+
const ttlSeconds = options.ttlSeconds ?? 300;
|
|
79
|
+
return (ctx) => {
|
|
80
|
+
const envelope = buildEnvelope({
|
|
81
|
+
user_id: userId,
|
|
82
|
+
msgs: [ctx.msg],
|
|
83
|
+
nonce: Date.now(),
|
|
84
|
+
expires_at: Math.floor(Date.now() / 1000) + ttlSeconds,
|
|
85
|
+
role: "Passkey",
|
|
86
|
+
signatures: {},
|
|
87
|
+
});
|
|
88
|
+
return { envelope };
|
|
89
|
+
};
|
|
90
|
+
}
|
|
76
91
|
export function encodeSignature(signature) {
|
|
77
92
|
const nodeBuffer = globalThis.Buffer;
|
|
78
93
|
if (nodeBuffer) {
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ export type { TransactionOptions, QueryOptions } from "./client";
|
|
|
5
5
|
export { Done, DoneContractClient } from "./done";
|
|
6
6
|
export { DoneRequest } from "./done";
|
|
7
7
|
export { createPasskeyEnvelopeBuilder, createSessionEnvelopeBuilder, type PasskeyEnvelopeBuilderOptions, type SessionEnvelopeBuilderOptions, } from "./auth";
|
|
8
|
-
export { CURRENT_ENVELOPE_VERSION, buildEnvelope, decodeSignature, encodeSignature, signDocBytes, signDocDigest, toSignDoc, } from "./envelope";
|
|
8
|
+
export { CURRENT_ENVELOPE_VERSION, buildEnvelope, createDevEnvelopeBuilder, type DevEnvelopeBuilderOptions, decodeSignature, encodeSignature, signDocBytes, signDocDigest, toSignDoc, } from "./envelope";
|
|
9
9
|
export { buildQueryMessage, buildTransactionMessage } from "./messages";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA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,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,5 +2,5 @@ export { DoneBackendClient } from "./client";
|
|
|
2
2
|
export { Done, DoneContractClient } from "./done";
|
|
3
3
|
export { DoneRequest } from "./done";
|
|
4
4
|
export { createPasskeyEnvelopeBuilder, createSessionEnvelopeBuilder, } from "./auth";
|
|
5
|
-
export { CURRENT_ENVELOPE_VERSION, buildEnvelope, decodeSignature, encodeSignature, signDocBytes, signDocDigest, toSignDoc, } from "./envelope";
|
|
5
|
+
export { CURRENT_ENVELOPE_VERSION, buildEnvelope, createDevEnvelopeBuilder, decodeSignature, encodeSignature, signDocBytes, signDocDigest, toSignDoc, } from "./envelope";
|
|
6
6
|
export { buildQueryMessage, buildTransactionMessage } from "./messages";
|