@novasamatech/host-papp 0.5.0-4 → 0.5.0-6
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/constants.js +1 -1
- package/dist/modules/signIn.js +3 -7
- package/package.json +1 -1
- package/dist/adapters/transport/rpc.d.ts +0 -3
- package/dist/adapters/transport/rpc.js +0 -51
- package/dist/adapters/transport/types.d.ts +0 -6
- package/dist/adapters/transport/types.js +0 -1
- package/dist/helpers.d.ts +0 -1
- package/dist/helpers.js +0 -3
- package/dist/modules/accounts.d.ts +0 -1
- package/dist/modules/accounts.js +0 -2
package/dist/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SS_ENDPOINTS = ['wss://
|
|
1
|
+
export const SS_ENDPOINTS = ['wss://pop3-testnet.parity-lab.parity.io/7910'];
|
package/dist/modules/signIn.js
CHANGED
|
@@ -2,7 +2,7 @@ import { toHex } from '@polkadot-api/utils';
|
|
|
2
2
|
import { createNanoEvents } from 'nanoevents';
|
|
3
3
|
import { Bytes, Enum, Tuple, str } from 'scale-ts';
|
|
4
4
|
import { isAbortError } from '../helpers/utils.js';
|
|
5
|
-
import { ENCR_SECRET_SEED_SIZE, EncrPubKey, SS_SECRET_SEED_SIZE, SsPubKey, createEncrSecret, createSharedSecret, createSsSecret,
|
|
5
|
+
import { ENCR_SECRET_SEED_SIZE, EncrPubKey, SS_SECRET_SEED_SIZE, SsPubKey, createEncrSecret, createRandomSeed, createSharedSecret, createSsSecret, createSymmetricKey, decrypt, getEncrPub, getSsPub, khash, mergeBytes, stringToBytes, } from './crypto.js';
|
|
6
6
|
import { createSecretStorage } from './secretStorage.js';
|
|
7
7
|
import { createSession } from './statementStore.js';
|
|
8
8
|
// codecs
|
|
@@ -150,17 +150,13 @@ function retrieveSessionTopic({ payload, encrSecret, ssPublicKey, }) {
|
|
|
150
150
|
async function getSecretKeys(appId, secretStorage) {
|
|
151
151
|
let ssSecret = await secretStorage.readSsSecret();
|
|
152
152
|
if (!ssSecret) {
|
|
153
|
-
|
|
154
|
-
// For testing purpose only
|
|
155
|
-
const seed = createStableSeed(appId, SS_SECRET_SEED_SIZE);
|
|
153
|
+
const seed = createRandomSeed(appId, SS_SECRET_SEED_SIZE);
|
|
156
154
|
ssSecret = createSsSecret(seed);
|
|
157
155
|
await secretStorage.writeSsSecret(ssSecret);
|
|
158
156
|
}
|
|
159
157
|
let encrSecret = await secretStorage.readEncrSecret();
|
|
160
158
|
if (!encrSecret) {
|
|
161
|
-
|
|
162
|
-
// For testing purpose only
|
|
163
|
-
const seed = createStableSeed(appId, ENCR_SECRET_SEED_SIZE);
|
|
159
|
+
const seed = createRandomSeed(appId, ENCR_SECRET_SEED_SIZE);
|
|
164
160
|
encrSecret = createEncrSecret(seed);
|
|
165
161
|
await secretStorage.writeEncrSecret(encrSecret);
|
|
166
162
|
}
|
package/package.json
CHANGED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { createClient } from '@polkadot-api/raw-client';
|
|
2
|
-
import { createStatementSdk } from '@polkadot-api/sdk-statement';
|
|
3
|
-
import { FixedSizeBinary } from '@polkadot-api/substrate-bindings';
|
|
4
|
-
export function createRpcTransport(rpcProvider) {
|
|
5
|
-
const POLLING_INTERVAL = 1000;
|
|
6
|
-
const client = createClient(rpcProvider);
|
|
7
|
-
const sdk = createStatementSdk((method, params) => {
|
|
8
|
-
return new Promise((resolve, reject) => {
|
|
9
|
-
client.request(method, params, {
|
|
10
|
-
onSuccess: resolve,
|
|
11
|
-
onError: reject,
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
const transportProvider = {
|
|
16
|
-
getStatements(topics) {
|
|
17
|
-
// @ts-expect-error lib versions mismatch
|
|
18
|
-
return sdk.getStatements({ topics: topics.map(topic => new FixedSizeBinary(topic)) });
|
|
19
|
-
},
|
|
20
|
-
subscribeStatements(topics, callback) {
|
|
21
|
-
return polling(POLLING_INTERVAL, () => transportProvider.getStatements(topics), callback);
|
|
22
|
-
},
|
|
23
|
-
submitStatement(statement) {
|
|
24
|
-
return sdk.submit(statement);
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
return transportProvider;
|
|
28
|
-
}
|
|
29
|
-
function polling(interval, request, callback) {
|
|
30
|
-
let active = true;
|
|
31
|
-
let tm = null;
|
|
32
|
-
function createCycle() {
|
|
33
|
-
tm = setTimeout(() => {
|
|
34
|
-
if (!active) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
request()
|
|
38
|
-
.then(callback)
|
|
39
|
-
.finally(() => {
|
|
40
|
-
createCycle();
|
|
41
|
-
});
|
|
42
|
-
}, interval);
|
|
43
|
-
}
|
|
44
|
-
createCycle();
|
|
45
|
-
return () => {
|
|
46
|
-
active = false;
|
|
47
|
-
if (tm !== null) {
|
|
48
|
-
clearTimeout(tm);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { SignedStatement, Statement } from '@polkadot-api/sdk-statement';
|
|
2
|
-
export type Transport = {
|
|
3
|
-
getStatements(topics: Uint8Array[]): Promise<Statement[]>;
|
|
4
|
-
subscribeStatements(topics: Uint8Array[], callback: (response: Statement[]) => unknown): VoidFunction;
|
|
5
|
-
submitStatement(statement: SignedStatement): Promise<void>;
|
|
6
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/helpers.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isAbortError(err: object): boolean;
|
package/dist/helpers.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getAccountsFlow(): void;
|
package/dist/modules/accounts.js
DELETED