@novasamatech/host-papp 0.6.9 → 0.6.10

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/index.d.ts CHANGED
@@ -8,3 +8,4 @@ export type { StoredUserSession } from './sso/userSessionRepository.js';
8
8
  export type { Identity } from './identity/types.js';
9
9
  export type { SigningPayloadRequest, SigningRawRequest, SigningRequest, } from './sso/sessionManager/scale/signingRequest.js';
10
10
  export type { SigningPayloadResponse } from './sso/sessionManager/scale/signingResponse.js';
11
+ export type { RingVrfAliasRequest, RingVrfAliasResponse } from './sso/sessionManager/scale/ringVrf.js';
@@ -51,6 +51,21 @@ export declare const RemoteMessageCodec: import("scale-ts").Codec<{
51
51
  signedTransaction: Uint8Array<ArrayBufferLike> | undefined;
52
52
  }, string>;
53
53
  };
54
+ } | {
55
+ tag: "RingVrfAliasRequest";
56
+ value: {
57
+ productAccountId: [string, number];
58
+ productId: string;
59
+ };
60
+ } | {
61
+ tag: "RingVrfAliasResponse";
62
+ value: {
63
+ respondingTo: string;
64
+ payload: import("scale-ts").ResultPayload<{
65
+ context: Uint8Array<ArrayBufferLike>;
66
+ alias: Uint8Array<ArrayBufferLike>;
67
+ }, string>;
68
+ };
54
69
  };
55
70
  };
56
71
  }>;
@@ -1,4 +1,5 @@
1
1
  import { Enum, Struct, _void, str } from 'scale-ts';
2
+ import { RingVrfAliasRequestCodec, RingVrfAliasResponseCodec } from './ringVrf.js';
2
3
  import { SigningRequestCodec } from './signingRequest.js';
3
4
  import { SigningResponseCodec } from './signingResponse.js';
4
5
  export const RemoteMessageCodec = Struct({
@@ -8,6 +9,8 @@ export const RemoteMessageCodec = Struct({
8
9
  Disconnected: _void,
9
10
  SignRequest: SigningRequestCodec,
10
11
  SignResponse: SigningResponseCodec,
12
+ RingVrfAliasRequest: RingVrfAliasRequestCodec,
13
+ RingVrfAliasResponse: RingVrfAliasResponseCodec,
11
14
  }),
12
15
  }),
13
16
  });
@@ -0,0 +1,14 @@
1
+ import type { CodecType } from 'scale-ts';
2
+ export type RingVrfAliasRequest = CodecType<typeof RingVrfAliasRequestCodec>;
3
+ export declare const RingVrfAliasRequestCodec: import("scale-ts").Codec<{
4
+ productAccountId: [string, number];
5
+ productId: string;
6
+ }>;
7
+ export type RingVrfAliasResponse = CodecType<typeof RingVrfAliasResponseCodec>;
8
+ export declare const RingVrfAliasResponseCodec: import("scale-ts").Codec<{
9
+ respondingTo: string;
10
+ payload: import("scale-ts").ResultPayload<{
11
+ context: Uint8Array<ArrayBufferLike>;
12
+ alias: Uint8Array<ArrayBufferLike>;
13
+ }, string>;
14
+ }>;
@@ -0,0 +1,10 @@
1
+ import { ContextualAlias, ProductAccountId } from '@novasamatech/host-api';
2
+ import { Result, Struct, str } from 'scale-ts';
3
+ export const RingVrfAliasRequestCodec = Struct({
4
+ productAccountId: ProductAccountId,
5
+ productId: str,
6
+ });
7
+ export const RingVrfAliasResponseCodec = Struct({
8
+ respondingTo: str,
9
+ payload: Result(ContextualAlias, str),
10
+ });
@@ -1,3 +1,4 @@
1
+ import { ContextualAlias, ProductAccountId } from '@novasamatech/host-api';
1
2
  import type { Encryption, StatementProver, StatementStoreAdapter } from '@novasamatech/statement-store';
2
3
  import type { StorageAdapter } from '@novasamatech/storage-adapter';
3
4
  import { ResultAsync } from 'neverthrow';
@@ -11,6 +12,7 @@ export type UserSession = StoredUserSession & {
11
12
  sendDisconnectMessage(): ResultAsync<void, Error>;
12
13
  signPayload(payload: SigningPayloadRequest): ResultAsync<SigningPayloadResponseData, Error>;
13
14
  signRaw(payload: SigningRawRequest): ResultAsync<SigningPayloadResponseData, Error>;
15
+ getRingVrfAlias(productAccountId: CodecType<typeof ProductAccountId>, productId: string): ResultAsync<CodecType<typeof ContextualAlias>, Error>;
14
16
  subscribe(callback: Callback<CodecType<typeof RemoteMessageCodec>, ResultAsync<boolean, Error>>): VoidFunction;
15
17
  dispose(): void;
16
18
  };
@@ -1,3 +1,4 @@
1
+ import { ContextualAlias, ProductAccountId } from '@novasamatech/host-api';
1
2
  import { enumValue, toHex } from '@novasamatech/scale';
2
3
  import { createSession } from '@novasamatech/statement-store';
3
4
  import { fieldListView } from '@novasamatech/storage-adapter';
@@ -133,6 +134,26 @@ export function createUserSession({ userSession, statementStore, encryption, sto
133
134
  });
134
135
  });
135
136
  },
137
+ getRingVrfAlias(productAccountId, productId) {
138
+ const messageId = nanoid();
139
+ const request = session.request(RemoteMessageCodec, {
140
+ messageId,
141
+ data: enumValue('v1', enumValue('RingVrfAliasRequest', {
142
+ productAccountId,
143
+ productId,
144
+ })),
145
+ });
146
+ const responseFilter = (message) => {
147
+ if (message.data.tag === 'v1' &&
148
+ message.data.value.tag === 'RingVrfAliasResponse' &&
149
+ message.data.value.value.respondingTo === messageId) {
150
+ return message.data.value.value.payload;
151
+ }
152
+ };
153
+ return request
154
+ .andThen(() => session.waitForRequestMessage(RemoteMessageCodec, responseFilter))
155
+ .andThen(result => (result.success ? ok(result.value) : err(new Error(result.value))));
156
+ },
136
157
  dispose() {
137
158
  return session.dispose();
138
159
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@novasamatech/host-papp",
3
3
  "type": "module",
4
- "version": "0.6.9",
4
+ "version": "0.6.10",
5
5
  "description": "Polkadot app integration",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -29,10 +29,10 @@
29
29
  "@noble/ciphers": "2.1.1",
30
30
  "@noble/curves": "2.0.1",
31
31
  "@noble/hashes": "2.0.1",
32
- "@novasamatech/host-api": "0.6.9",
33
- "@novasamatech/scale": "0.6.9",
34
- "@novasamatech/statement-store": "0.6.9",
35
- "@novasamatech/storage-adapter": "0.6.9",
32
+ "@novasamatech/host-api": "0.6.10",
33
+ "@novasamatech/scale": "0.6.10",
34
+ "@novasamatech/statement-store": "0.6.10",
35
+ "@novasamatech/storage-adapter": "0.6.10",
36
36
  "@polkadot-api/utils": "0.2.0",
37
37
  "@polkadot-api/substrate-bindings": "^0.17.0",
38
38
  "@polkadot-labs/hdkd-helpers": "^0.0.28",