@novasamatech/host-papp 0.8.11 → 0.9.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.
Files changed (38) hide show
  1. package/README.md +84 -69
  2. package/dist/crypto.js +8 -11
  3. package/dist/crypto.spec.d.ts +1 -0
  4. package/dist/crypto.spec.js +31 -0
  5. package/dist/helpers/createAsyncTaskPool.spec.js +11 -11
  6. package/dist/index.d.ts +3 -0
  7. package/dist/papp.js +3 -1
  8. package/dist/sso/allowance/repository.js +2 -1
  9. package/dist/sso/auth/scale/handshakeV2.d.ts +5 -5
  10. package/dist/sso/auth/scale/handshakeV2.js +11 -10
  11. package/dist/sso/auth/v2/envelope.d.ts +6 -6
  12. package/dist/sso/auth/v2/envelope.js +9 -9
  13. package/dist/sso/auth/v2/state.d.ts +2 -2
  14. package/dist/sso/auth/v2/topic.d.ts +1 -1
  15. package/dist/sso/auth/v2/topic.js +1 -1
  16. package/dist/sso/deviceIdentityStore.js +2 -1
  17. package/dist/sso/sessionManager/impl.d.ts +3 -1
  18. package/dist/sso/sessionManager/impl.js +6 -4
  19. package/dist/sso/sessionManager/scale/createTransaction.d.ts +9 -3
  20. package/dist/sso/sessionManager/scale/createTransaction.js +2 -2
  21. package/dist/sso/sessionManager/scale/productSubtree.d.ts +12 -0
  22. package/dist/sso/sessionManager/scale/productSubtree.js +22 -0
  23. package/dist/sso/sessionManager/scale/remoteMessage.d.ts +100 -24
  24. package/dist/sso/sessionManager/scale/remoteMessage.js +11 -1
  25. package/dist/sso/sessionManager/scale/resourceAllocation.d.ts +14 -5
  26. package/dist/sso/sessionManager/scale/resourceAllocation.js +8 -3
  27. package/dist/sso/sessionManager/scale/ringVrf.d.ts +18 -29
  28. package/dist/sso/sessionManager/scale/ringVrf.js +5 -13
  29. package/dist/sso/sessionManager/scale/signVrf.d.ts +62 -0
  30. package/dist/sso/sessionManager/scale/signVrf.js +18 -0
  31. package/dist/sso/sessionManager/scale/signing.d.ts +39 -15
  32. package/dist/sso/sessionManager/scale/signing.js +2 -2
  33. package/dist/sso/sessionManager/userSession.d.ts +19 -2
  34. package/dist/sso/sessionManager/userSession.js +45 -2
  35. package/dist/sso/userSecretRepository.js +2 -1
  36. package/dist/sso/userSessionRepository.js +13 -8
  37. package/dist/sso/userSessionRepository.spec.js +4 -4
  38. package/package.json +8 -8
@@ -4,7 +4,7 @@ import { emitHostPappDebugMessage } from '../../debugBus.js';
4
4
  import { createState } from '../../helpers/state.js';
5
5
  import { createSsoStatementProver } from '../ssoSessionProver.js';
6
6
  import { createUserSession } from './userSession.js';
7
- export function createSsoSessionManager({ ssoSessionRepository, userSecretRepository, allowanceRepository, statementStore, storage, }) {
7
+ export function createSsoSessionManager({ ssoSessionRepository, userSecretRepository, allowanceRepository, identityRepository, statementStore, storage, }) {
8
8
  const localSessions = createState({});
9
9
  const sessionUnsubscribes = new Map();
10
10
  const releaseSession = (id) => {
@@ -22,7 +22,7 @@ export function createSsoSessionManager({ ssoSessionRepository, userSecretReposi
22
22
  toRemove.delete(userSession.id);
23
23
  if (userSession.id in activeSessions)
24
24
  continue;
25
- const session = createSession(userSession, statementStore, storage, userSecretRepository);
25
+ const session = createSession(userSession, statementStore, storage, userSecretRepository, allowanceRepository, identityRepository);
26
26
  toAdd.add(session);
27
27
  emitHostPappDebugMessage({
28
28
  layer: 'session',
@@ -73,7 +73,7 @@ export function createSsoSessionManager({ ssoSessionRepository, userSecretReposi
73
73
  subscribe: (callback) => localSessions.subscribe(sessions => callback(Object.values(sessions))),
74
74
  },
75
75
  disconnect(userSession) {
76
- const session = createSession(userSession, statementStore, storage, userSecretRepository);
76
+ const session = createSession(userSession, statementStore, storage, userSecretRepository, allowanceRepository, identityRepository);
77
77
  return session
78
78
  .sendDisconnectMessage()
79
79
  .andThen(() => disconnect(userSession))
@@ -88,7 +88,7 @@ export function createSsoSessionManager({ ssoSessionRepository, userSecretReposi
88
88
  },
89
89
  };
90
90
  }
91
- function createSession(userSession, statementStore, storage, userSecretRepository) {
91
+ function createSession(userSession, statementStore, storage, userSecretRepository, allowanceRepository, identityRepository) {
92
92
  const encryption = createEncryption(userSession.remoteAccount.publicKey);
93
93
  const prover = createSsoStatementProver(userSession, userSecretRepository);
94
94
  return createUserSession({
@@ -97,5 +97,7 @@ function createSession(userSession, statementStore, storage, userSecretRepositor
97
97
  encryption,
98
98
  storage,
99
99
  prover,
100
+ allowanceRepository,
101
+ identityRepository,
100
102
  });
101
103
  }
@@ -4,8 +4,14 @@ export declare const CreateTransactionRequestCodec: import("scale-ts").Codec<{
4
4
  payload: {
5
5
  tag: "v1";
6
6
  value: {
7
- signer: [string, number];
8
- genesisHash: Uint8Array<ArrayBufferLike>;
7
+ signer: [string, {
8
+ tag: "Index";
9
+ value: number;
10
+ } | {
11
+ tag: "Raw";
12
+ value: Uint8Array<ArrayBufferLike>;
13
+ }];
14
+ genesisHash: `0x${string}`;
9
15
  callData: Uint8Array<ArrayBufferLike>;
10
16
  extensions: {
11
17
  id: string;
@@ -22,7 +28,7 @@ export declare const CreateTransactionLegacyRequestCodec: import("scale-ts").Cod
22
28
  tag: "v1";
23
29
  value: {
24
30
  signer: Uint8Array<ArrayBufferLike>;
25
- genesisHash: Uint8Array<ArrayBufferLike>;
31
+ genesisHash: `0x${string}`;
26
32
  callData: Uint8Array<ArrayBufferLike>;
27
33
  extensions: {
28
34
  id: string;
@@ -1,6 +1,6 @@
1
1
  import { LegacyTransaction, ProductAccountTransaction } from '@novasamatech/host-api';
2
- import { Enum } from '@novasamatech/scale';
3
- import { Bytes, Result, Struct, str } from 'scale-ts';
2
+ import { Bytes, Enum } from '@novasamatech/scale';
3
+ import { Result, Struct, str } from 'scale-ts';
4
4
  export const CreateTransactionRequestCodec = Struct({
5
5
  payload: Enum({
6
6
  v1: ProductAccountTransaction,
@@ -0,0 +1,12 @@
1
+ import type { CodecType } from 'scale-ts';
2
+ export type ProductSubtreeRequest = CodecType<typeof ProductSubtreeRequestCodec>;
3
+ export declare const ProductSubtreeRequestCodec: import("scale-ts").Codec<{
4
+ productId: string;
5
+ }>;
6
+ export type ProductSubtreeResponse = CodecType<typeof ProductSubtreeResponseCodec>;
7
+ export declare const ProductSubtreeResponseCodec: import("scale-ts").Codec<{
8
+ respondingTo: string;
9
+ payload: import("scale-ts").ResultPayload<{
10
+ productPublicKey: Uint8Array<ArrayBufferLike>;
11
+ }, string>;
12
+ }>;
@@ -0,0 +1,22 @@
1
+ import { DotNsIdentifier } from '@novasamatech/host-api';
2
+ import { Bytes } from '@novasamatech/scale';
3
+ import { Result, Struct, str } from 'scale-ts';
4
+ // RFC-0022 made `//product//{productId}` a hard junction, so the root public
5
+ // key alone no longer determines product account public keys. This request
6
+ // closes the gap: the Account Holder returns the product-subtree public key,
7
+ // from which the Host soft-derives account public keys locally.
8
+ //
9
+ // Consent-free — the response carries no secret material. Fetch once per
10
+ // product and cache; only `AutoSigning` (secret material) requires consent.
11
+ /** 32-byte sr25519 public key of `//product//{productId}`. */
12
+ const Sr25519PublicKey = Bytes(32);
13
+ export const ProductSubtreeRequestCodec = Struct({
14
+ productId: DotNsIdentifier,
15
+ });
16
+ export const ProductSubtreeResponseCodec = Struct({
17
+ // referencing to RemoteMessage.messageId
18
+ respondingTo: str,
19
+ payload: Result(Struct({
20
+ productPublicKey: Sr25519PublicKey,
21
+ }), str),
22
+ });
@@ -10,9 +10,33 @@ export declare const RemoteMessageCodec: import("scale-ts").Codec<{
10
10
  } | {
11
11
  tag: "SignRequest";
12
12
  value: {
13
+ tag: "Raw";
14
+ value: {
15
+ productAccountId: [string, {
16
+ tag: "Index";
17
+ value: number;
18
+ } | {
19
+ tag: "Raw";
20
+ value: Uint8Array<ArrayBufferLike>;
21
+ }];
22
+ data: {
23
+ tag: "Bytes";
24
+ value: Uint8Array<ArrayBufferLike>;
25
+ } | {
26
+ tag: "Payload";
27
+ value: string;
28
+ };
29
+ };
30
+ } | {
13
31
  tag: "Payload";
14
32
  value: {
15
- productAccountId: [string, number];
33
+ productAccountId: [string, {
34
+ tag: "Index";
35
+ value: number;
36
+ } | {
37
+ tag: "Raw";
38
+ value: Uint8Array<ArrayBufferLike>;
39
+ }];
16
40
  blockHash: `0x${string}`;
17
41
  blockNumber: `0x${string}`;
18
42
  era: `0x${string}`;
@@ -29,18 +53,6 @@ export declare const RemoteMessageCodec: import("scale-ts").Codec<{
29
53
  mode: number | undefined;
30
54
  withSignedTransaction: boolean | void;
31
55
  };
32
- } | {
33
- tag: "Raw";
34
- value: {
35
- productAccountId: [string, number];
36
- data: {
37
- tag: "Bytes";
38
- value: Uint8Array<ArrayBufferLike>;
39
- } | {
40
- tag: "Payload";
41
- value: string;
42
- };
43
- };
44
56
  };
45
57
  } | {
46
58
  tag: "SignResponse";
@@ -55,7 +67,13 @@ export declare const RemoteMessageCodec: import("scale-ts").Codec<{
55
67
  tag: "RingVrfAliasRequest";
56
68
  value: {
57
69
  callingProductId: string;
58
- context: [string, `0x${string}`];
70
+ context: [string, {
71
+ tag: "Index";
72
+ value: number;
73
+ } | {
74
+ tag: "Raw";
75
+ value: Uint8Array<ArrayBufferLike>;
76
+ }];
59
77
  ring: {
60
78
  chainId: `0x${string}`;
61
79
  junctions: ({
@@ -74,9 +92,9 @@ export declare const RemoteMessageCodec: import("scale-ts").Codec<{
74
92
  payload: import("scale-ts").ResultPayload<{
75
93
  context: Uint8Array<ArrayBufferLike>;
76
94
  alias: Uint8Array<ArrayBufferLike>;
77
- }, import("@novasamatech/scale").CodecError<undefined, "RingVrfError::Rejected"> | import("@novasamatech/scale").CodecError<{
95
+ }, import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::Rejected"> | import("@novasamatech/scale").CodecError<{
78
96
  reason: string;
79
- }, "RingVrfError::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "RingVrfError::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "RingVrfError::NotMember">>;
97
+ }, "GetAliasErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::NotMember">>;
80
98
  };
81
99
  } | {
82
100
  tag: "ResourceAllocationRequest";
@@ -87,7 +105,13 @@ export declare const RemoteMessageCodec: import("scale-ts").Codec<{
87
105
  value: undefined;
88
106
  } | {
89
107
  tag: "SmartContractAllowance";
90
- value: number;
108
+ value: {
109
+ tag: "Index";
110
+ value: number;
111
+ } | {
112
+ tag: "Raw";
113
+ value: Uint8Array<ArrayBufferLike>;
114
+ };
91
115
  } | {
92
116
  tag: "AutoSigning";
93
117
  value: undefined;
@@ -117,7 +141,6 @@ export declare const RemoteMessageCodec: import("scale-ts").Codec<{
117
141
  } | {
118
142
  tag: "AutoSigning";
119
143
  value: {
120
- productDerivationSecret: string;
121
144
  productRootPrivateKey: Uint8Array<ArrayBufferLike>;
122
145
  };
123
146
  } | {
@@ -137,8 +160,14 @@ export declare const RemoteMessageCodec: import("scale-ts").Codec<{
137
160
  payload: {
138
161
  tag: "v1";
139
162
  value: {
140
- signer: [string, number];
141
- genesisHash: Uint8Array<ArrayBufferLike>;
163
+ signer: [string, {
164
+ tag: "Index";
165
+ value: number;
166
+ } | {
167
+ tag: "Raw";
168
+ value: Uint8Array<ArrayBufferLike>;
169
+ }];
170
+ genesisHash: `0x${string}`;
142
171
  callData: Uint8Array<ArrayBufferLike>;
143
172
  extensions: {
144
173
  id: string;
@@ -162,7 +191,7 @@ export declare const RemoteMessageCodec: import("scale-ts").Codec<{
162
191
  tag: "v1";
163
192
  value: {
164
193
  signer: Uint8Array<ArrayBufferLike>;
165
- genesisHash: Uint8Array<ArrayBufferLike>;
194
+ genesisHash: `0x${string}`;
166
195
  callData: Uint8Array<ArrayBufferLike>;
167
196
  extensions: {
168
197
  id: string;
@@ -195,7 +224,13 @@ export declare const RemoteMessageCodec: import("scale-ts").Codec<{
195
224
  tag: "RingVrfProofRequest";
196
225
  value: {
197
226
  callingProductId: string;
198
- context: [string, `0x${string}`];
227
+ context: [string, {
228
+ tag: "Index";
229
+ value: number;
230
+ } | {
231
+ tag: "Raw";
232
+ value: Uint8Array<ArrayBufferLike>;
233
+ }];
199
234
  ring: {
200
235
  chainId: `0x${string}`;
201
236
  junctions: ({
@@ -220,9 +255,50 @@ export declare const RemoteMessageCodec: import("scale-ts").Codec<{
220
255
  };
221
256
  ringIndex: number;
222
257
  ringRevision: number;
223
- }, import("@novasamatech/scale").CodecError<undefined, "RingVrfError::Rejected"> | import("@novasamatech/scale").CodecError<{
258
+ }, import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::Rejected"> | import("@novasamatech/scale").CodecError<{
224
259
  reason: string;
225
- }, "RingVrfError::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "RingVrfError::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "RingVrfError::NotMember">>;
260
+ }, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::NotMember">>;
261
+ };
262
+ } | {
263
+ tag: "SignVrfRequest";
264
+ value: {
265
+ productAccountId: [string, {
266
+ tag: "Index";
267
+ value: number;
268
+ } | {
269
+ tag: "Raw";
270
+ value: Uint8Array<ArrayBufferLike>;
271
+ }];
272
+ productId: string;
273
+ transcriptLabel: Uint8Array<ArrayBufferLike>;
274
+ items: {
275
+ label: Uint8Array<ArrayBufferLike>;
276
+ value: Uint8Array<ArrayBufferLike>;
277
+ }[];
278
+ };
279
+ } | {
280
+ tag: "SignVrfResponse";
281
+ value: {
282
+ respondingTo: string;
283
+ payload: import("scale-ts").ResultPayload<{
284
+ preOutput: Uint8Array<ArrayBufferLike>;
285
+ proof: Uint8Array<ArrayBufferLike>;
286
+ }, import("@novasamatech/scale").CodecError<undefined, "SignVrfErr::Rejected"> | import("@novasamatech/scale").CodecError<{
287
+ reason: string;
288
+ }, "SignVrfErr::Unknown">>;
289
+ };
290
+ } | {
291
+ tag: "ProductSubtreeRequest";
292
+ value: {
293
+ productId: string;
294
+ };
295
+ } | {
296
+ tag: "ProductSubtreeResponse";
297
+ value: {
298
+ respondingTo: string;
299
+ payload: import("scale-ts").ResultPayload<{
300
+ productPublicKey: Uint8Array<ArrayBufferLike>;
301
+ }, string>;
226
302
  };
227
303
  };
228
304
  };
@@ -1,11 +1,16 @@
1
- import { Enum, Struct, _void, str } from 'scale-ts';
1
+ import { Enum } from '@novasamatech/scale';
2
+ import { Struct, _void, str } from 'scale-ts';
2
3
  import { CreateTransactionLegacyRequestCodec, CreateTransactionRequestCodec, CreateTransactionResponseCodec, } from './createTransaction.js';
4
+ import { ProductSubtreeRequestCodec, ProductSubtreeResponseCodec } from './productSubtree.js';
3
5
  import { ResourceAllocationRequestCodec, ResourceAllocationResponseCodec } from './resourceAllocation.js';
4
6
  import { RingVrfAliasRequestCodec, RingVrfAliasResponseCodec, RingVrfProofRequestCodec, RingVrfProofResponseCodec, } from './ringVrf.js';
7
+ import { SignVrfRequestCodec, SignVrfResponseCodec } from './signVrf.js';
5
8
  import { SignRawLegacyRequestCodec, SignRawLegacyResponseCodec, SigningRequestCodec, SigningResponseCodec, } from './signing.js';
6
9
  export const RemoteMessageCodec = Struct({
7
10
  messageId: str,
8
11
  data: Enum({
12
+ // Declaration order is the SCALE wire order and must stay in lockstep with the
13
+ // truapi `host_logic::sso::messages::v1::RemoteMessage` enum. Append only.
9
14
  v1: Enum({
10
15
  Disconnected: _void,
11
16
  SignRequest: SigningRequestCodec,
@@ -21,6 +26,11 @@ export const RemoteMessageCodec = Struct({
21
26
  SignRawLegacyResponse: SignRawLegacyResponseCodec,
22
27
  RingVrfProofRequest: RingVrfProofRequestCodec,
23
28
  RingVrfProofResponse: RingVrfProofResponseCodec,
29
+ SignVrfRequest: SignVrfRequestCodec,
30
+ SignVrfResponse: SignVrfResponseCodec,
31
+ // RFC-0022 additions — appended so existing variant indexes stay stable.
32
+ ProductSubtreeRequest: ProductSubtreeRequestCodec,
33
+ ProductSubtreeResponse: ProductSubtreeResponseCodec,
24
34
  }),
25
35
  }),
26
36
  });
@@ -5,7 +5,13 @@ export declare const ApAllocatableResourceCodec: import("scale-ts").Codec<{
5
5
  value: undefined;
6
6
  } | {
7
7
  tag: "SmartContractAllowance";
8
- value: number;
8
+ value: {
9
+ tag: "Index";
10
+ value: number;
11
+ } | {
12
+ tag: "Raw";
13
+ value: Uint8Array<ArrayBufferLike>;
14
+ };
9
15
  } | {
10
16
  tag: "AutoSigning";
11
17
  value: undefined;
@@ -25,7 +31,6 @@ export declare const ApAllocatedResourceCodec: import("scale-ts").Codec<{
25
31
  } | {
26
32
  tag: "AutoSigning";
27
33
  value: {
28
- productDerivationSecret: string;
29
34
  productRootPrivateKey: Uint8Array<ArrayBufferLike>;
30
35
  };
31
36
  } | {
@@ -51,7 +56,6 @@ export declare const ApAllocationOutcomeCodec: import("scale-ts").Codec<{
51
56
  } | {
52
57
  tag: "AutoSigning";
53
58
  value: {
54
- productDerivationSecret: string;
55
59
  productRootPrivateKey: Uint8Array<ArrayBufferLike>;
56
60
  };
57
61
  } | {
@@ -73,7 +77,13 @@ export declare const ResourceAllocationRequestCodec: import("scale-ts").Codec<{
73
77
  value: undefined;
74
78
  } | {
75
79
  tag: "SmartContractAllowance";
76
- value: number;
80
+ value: {
81
+ tag: "Index";
82
+ value: number;
83
+ } | {
84
+ tag: "Raw";
85
+ value: Uint8Array<ArrayBufferLike>;
86
+ };
77
87
  } | {
78
88
  tag: "AutoSigning";
79
89
  value: undefined;
@@ -102,7 +112,6 @@ export declare const ResourceAllocationResponseCodec: import("scale-ts").Codec<{
102
112
  } | {
103
113
  tag: "AutoSigning";
104
114
  value: {
105
- productDerivationSecret: string;
106
115
  productRootPrivateKey: Uint8Array<ArrayBufferLike>;
107
116
  };
108
117
  } | {
@@ -1,9 +1,10 @@
1
1
  import { DerivationIndex, DotNsIdentifier } from '@novasamatech/host-api';
2
- import { Status } from '@novasamatech/scale';
3
- import { Bytes, Enum, Result, Struct, Vector, _void, str } from 'scale-ts';
2
+ import { Bytes, Status } from '@novasamatech/scale';
3
+ import { Enum, Result, Struct, Vector, _void, str } from 'scale-ts';
4
4
  export const ApAllocatableResourceCodec = Enum({
5
5
  StatementStoreAllowance: _void,
6
6
  BulletInAllowance: _void,
7
+ // Account the allowance is granted for, addressed by the RFC-0022 selector.
7
8
  SmartContractAllowance: DerivationIndex,
8
9
  AutoSigning: _void,
9
10
  });
@@ -15,8 +16,12 @@ export const ApAllocatedResourceCodec = Enum({
15
16
  slotAccountKey: Bytes(),
16
17
  }),
17
18
  SmartContractAllowance: _void,
19
+ // RFC-0022: the payload collapsed to the product-subtree secret key alone.
20
+ // `//product//{productId}` is a hard junction, so this key exposes exactly
21
+ // that product's subtree — the secret path component is gone.
18
22
  AutoSigning: Struct({
19
- productDerivationSecret: str,
23
+ // `Sr25519PrivateKey ++ Sr25519Nonce` (64 bytes): the full expanded secret
24
+ // needed to sign and soft-derive `/{index}` below the product root.
20
25
  productRootPrivateKey: Bytes(),
21
26
  }),
22
27
  });
@@ -1,31 +1,14 @@
1
1
  import type { CodecType } from 'scale-ts';
2
- export declare const RingVrfError: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<undefined, "RingVrfError::Rejected"> | import("@novasamatech/scale").CodecError<{
3
- reason: string;
4
- }, "RingVrfError::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "RingVrfError::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "RingVrfError::NotMember">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<undefined, "RingVrfError::Rejected"> | import("@novasamatech/scale").CodecError<{
5
- reason: string;
6
- }, "RingVrfError::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "RingVrfError::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "RingVrfError::NotMember">>] & {
7
- enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<undefined, "RingVrfError::Rejected"> | import("@novasamatech/scale").CodecError<{
8
- reason: string;
9
- }, "RingVrfError::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "RingVrfError::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "RingVrfError::NotMember">>;
10
- dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<undefined, "RingVrfError::Rejected"> | import("@novasamatech/scale").CodecError<{
11
- reason: string;
12
- }, "RingVrfError::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "RingVrfError::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "RingVrfError::NotMember">>;
13
- } & {
14
- readonly RingNotFound: import("@novasamatech/scale").ErrCodec<undefined, "RingVrfError::RingNotFound">;
15
- readonly NotMember: import("@novasamatech/scale").ErrCodec<undefined, "RingVrfError::NotMember">;
16
- readonly Rejected: import("@novasamatech/scale").ErrCodec<undefined, "RingVrfError::Rejected">;
17
- readonly Unknown: import("@novasamatech/scale").ErrCodec<{
18
- reason: string;
19
- }, "RingVrfError::Unknown">;
20
- } & {
21
- [Symbol.hasInstance](v: unknown): v is import("@novasamatech/scale").CodecError<undefined, "RingVrfError::Rejected"> | import("@novasamatech/scale").CodecError<{
22
- reason: string;
23
- }, "RingVrfError::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "RingVrfError::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "RingVrfError::NotMember">;
24
- };
25
2
  export type RingVrfAliasRequest = CodecType<typeof RingVrfAliasRequestCodec>;
26
3
  export declare const RingVrfAliasRequestCodec: import("scale-ts").Codec<{
27
4
  callingProductId: string;
28
- context: [string, `0x${string}`];
5
+ context: [string, {
6
+ tag: "Index";
7
+ value: number;
8
+ } | {
9
+ tag: "Raw";
10
+ value: Uint8Array<ArrayBufferLike>;
11
+ }];
29
12
  ring: {
30
13
  chainId: `0x${string}`;
31
14
  junctions: ({
@@ -43,14 +26,20 @@ export declare const RingVrfAliasResponseCodec: import("scale-ts").Codec<{
43
26
  payload: import("scale-ts").ResultPayload<{
44
27
  context: Uint8Array<ArrayBufferLike>;
45
28
  alias: Uint8Array<ArrayBufferLike>;
46
- }, import("@novasamatech/scale").CodecError<undefined, "RingVrfError::Rejected"> | import("@novasamatech/scale").CodecError<{
29
+ }, import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::Rejected"> | import("@novasamatech/scale").CodecError<{
47
30
  reason: string;
48
- }, "RingVrfError::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "RingVrfError::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "RingVrfError::NotMember">>;
31
+ }, "GetAliasErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::NotMember">>;
49
32
  }>;
50
33
  export type RingVrfProofRequest = CodecType<typeof RingVrfProofRequestCodec>;
51
34
  export declare const RingVrfProofRequestCodec: import("scale-ts").Codec<{
52
35
  callingProductId: string;
53
- context: [string, `0x${string}`];
36
+ context: [string, {
37
+ tag: "Index";
38
+ value: number;
39
+ } | {
40
+ tag: "Raw";
41
+ value: Uint8Array<ArrayBufferLike>;
42
+ }];
54
43
  ring: {
55
44
  chainId: `0x${string}`;
56
45
  junctions: ({
@@ -74,7 +63,7 @@ export declare const RingVrfProofResponseCodec: import("scale-ts").Codec<{
74
63
  };
75
64
  ringIndex: number;
76
65
  ringRevision: number;
77
- }, import("@novasamatech/scale").CodecError<undefined, "RingVrfError::Rejected"> | import("@novasamatech/scale").CodecError<{
66
+ }, import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::Rejected"> | import("@novasamatech/scale").CodecError<{
78
67
  reason: string;
79
- }, "RingVrfError::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "RingVrfError::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "RingVrfError::NotMember">>;
68
+ }, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::NotMember">>;
80
69
  }>;
@@ -1,14 +1,6 @@
1
- import { ContextualAlias, DotNsIdentifier, ProductProofContext, RingLocation, RingVrfProof, } from '@novasamatech/host-api';
2
- import { ErrEnum } from '@novasamatech/scale';
3
- import { Bytes, Result, Struct, _void, str } from 'scale-ts';
4
- // Shared failure set for both alias and proof requests over the SSO channel;
5
- // mirrors the Account Holder's `RingVrfError` (RFC 0004).
6
- export const RingVrfError = ErrEnum('RingVrfError', {
7
- RingNotFound: [_void, 'RingVrf: ring not found'],
8
- NotMember: [_void, 'RingVrf: selected member key is not a member of the ring'],
9
- Rejected: [_void, 'RingVrf: rejected'],
10
- Unknown: [Struct({ reason: str }), 'RingVrf: unknown error'],
11
- });
1
+ import { ContextualAlias, CreateProofErr, DotNsIdentifier, GetAliasErr, ProductProofContext, RingLocation, RingVrfProof, } from '@novasamatech/host-api';
2
+ import { Bytes } from '@novasamatech/scale';
3
+ import { Result, Struct, str } from 'scale-ts';
12
4
  export const RingVrfAliasRequestCodec = Struct({
13
5
  callingProductId: DotNsIdentifier,
14
6
  context: ProductProofContext,
@@ -16,7 +8,7 @@ export const RingVrfAliasRequestCodec = Struct({
16
8
  });
17
9
  export const RingVrfAliasResponseCodec = Struct({
18
10
  respondingTo: str,
19
- payload: Result(ContextualAlias, RingVrfError),
11
+ payload: Result(ContextualAlias, GetAliasErr),
20
12
  });
21
13
  export const RingVrfProofRequestCodec = Struct({
22
14
  callingProductId: DotNsIdentifier,
@@ -26,5 +18,5 @@ export const RingVrfProofRequestCodec = Struct({
26
18
  });
27
19
  export const RingVrfProofResponseCodec = Struct({
28
20
  respondingTo: str,
29
- payload: Result(RingVrfProof, RingVrfError),
21
+ payload: Result(RingVrfProof, CreateProofErr),
30
22
  });
@@ -0,0 +1,62 @@
1
+ import type { CodecType } from 'scale-ts';
2
+ /**
3
+ * Host → Account Holder request for an sr25519 (schnorrkel) VRF signature over a
4
+ * caller-supplied Merlin transcript (RFC-0023, "Accounts Protocol companion").
5
+ *
6
+ * The Account Holder derives `productAccountId`, presents the signing confirmation,
7
+ * replays the transcript verbatim — `Transcript::new(transcriptLabel)` then one
8
+ * `append_message(label, value)` per item, in order — and signs it. It performs no
9
+ * interpretation of labels or values.
10
+ *
11
+ * This is the non-`AutoSigning` path; when `AutoSigning` covers the account the host
12
+ * signs locally and never sends this message.
13
+ */
14
+ export type SignVrfRequest = CodecType<typeof SignVrfRequestCodec>;
15
+ export declare const SignVrfRequestCodec: import("scale-ts").Codec<{
16
+ productAccountId: [string, {
17
+ tag: "Index";
18
+ value: number;
19
+ } | {
20
+ tag: "Raw";
21
+ value: Uint8Array<ArrayBufferLike>;
22
+ }];
23
+ productId: string;
24
+ transcriptLabel: Uint8Array<ArrayBufferLike>;
25
+ items: {
26
+ label: Uint8Array<ArrayBufferLike>;
27
+ value: Uint8Array<ArrayBufferLike>;
28
+ }[];
29
+ }>;
30
+ /** Failure returned by the Account Holder for a VRF signing request. */
31
+ export type SignVrfErr = CodecType<typeof SignVrfErrCodec>;
32
+ export declare const SignVrfErrCodec: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<undefined, "SignVrfErr::Rejected"> | import("@novasamatech/scale").CodecError<{
33
+ reason: string;
34
+ }, "SignVrfErr::Unknown">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<undefined, "SignVrfErr::Rejected"> | import("@novasamatech/scale").CodecError<{
35
+ reason: string;
36
+ }, "SignVrfErr::Unknown">>] & {
37
+ enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<undefined, "SignVrfErr::Rejected"> | import("@novasamatech/scale").CodecError<{
38
+ reason: string;
39
+ }, "SignVrfErr::Unknown">>;
40
+ dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<undefined, "SignVrfErr::Rejected"> | import("@novasamatech/scale").CodecError<{
41
+ reason: string;
42
+ }, "SignVrfErr::Unknown">>;
43
+ } & {
44
+ readonly Rejected: import("@novasamatech/scale").ErrCodec<undefined, "SignVrfErr::Rejected">;
45
+ readonly Unknown: import("@novasamatech/scale").ErrCodec<{
46
+ reason: string;
47
+ }, "SignVrfErr::Unknown">;
48
+ } & {
49
+ [Symbol.hasInstance](v: unknown): v is import("@novasamatech/scale").CodecError<undefined, "SignVrfErr::Rejected"> | import("@novasamatech/scale").CodecError<{
50
+ reason: string;
51
+ }, "SignVrfErr::Unknown">;
52
+ };
53
+ export type SignVrfResponse = CodecType<typeof SignVrfResponseCodec>;
54
+ export declare const SignVrfResponseCodec: import("scale-ts").Codec<{
55
+ respondingTo: string;
56
+ payload: import("scale-ts").ResultPayload<{
57
+ preOutput: Uint8Array<ArrayBufferLike>;
58
+ proof: Uint8Array<ArrayBufferLike>;
59
+ }, import("@novasamatech/scale").CodecError<undefined, "SignVrfErr::Rejected"> | import("@novasamatech/scale").CodecError<{
60
+ reason: string;
61
+ }, "SignVrfErr::Unknown">>;
62
+ }>;
@@ -0,0 +1,18 @@
1
+ import { ProductAccountId, VrfSignature, VrfTranscriptItem } from '@novasamatech/host-api';
2
+ import { Bytes, ErrEnum } from '@novasamatech/scale';
3
+ import { Result, Struct, Vector, _void, str } from 'scale-ts';
4
+ export const SignVrfRequestCodec = Struct({
5
+ productAccountId: ProductAccountId,
6
+ productId: str,
7
+ transcriptLabel: Bytes(),
8
+ items: Vector(VrfTranscriptItem),
9
+ });
10
+ export const SignVrfErrCodec = ErrEnum('SignVrfErr', {
11
+ Rejected: [_void, 'Rejected'],
12
+ Unknown: [Struct({ reason: str }), ({ reason }) => reason],
13
+ });
14
+ export const SignVrfResponseCodec = Struct({
15
+ // referencing to RemoteMessage.messageId
16
+ respondingTo: str,
17
+ payload: Result(VrfSignature, SignVrfErrCodec),
18
+ });