create-blocklet 0.9.9 → 0.9.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/package.json +1 -1
- package/templates/did-connect-dapp/api/routes/auth/request-digest-signature.js +9 -7
- package/templates/did-connect-dapp/api/routes/auth/request-multiple-claims.js +22 -20
- package/templates/did-connect-dapp/api/routes/auth/request-multiple-steps.js +19 -17
- package/templates/did-connect-dapp/api/routes/auth/request-nft.js +17 -15
- package/templates/did-connect-dapp/api/routes/auth/request-payment.js +23 -21
- package/templates/did-connect-dapp/api/routes/auth/request-profile.js +7 -5
- package/templates/did-connect-dapp/api/routes/auth/request-text-signature.js +11 -9
- package/templates/did-connect-dapp/api/routes/auth/request-transaction-signature.js +29 -27
- package/templates/did-connect-dapp/package.json +1 -1
- package/templates/did-wallet-dapp/package.json +1 -1
- package/templates/react-dapp/package.json +1 -1
- package/templates/react-dapp-ts/package.json +1 -1
- package/templates/react-gun-dapp/package.json +1 -1
- package/templates/react-static/package.json +1 -1
- package/templates/solidjs-dapp/package.json +1 -1
- package/templates/solidjs-static/package.json +1 -1
- package/templates/svelte-dapp/package.json +1 -1
- package/templates/svelte-static/package.json +1 -1
- package/templates/todo-list-example/package.json +1 -1
- package/templates/vue-dapp/package.json +1 -1
- package/templates/vue-static/package.json +1 -1
- package/templates/vue-ts-static/package.json +1 -1
- package/templates/vue2-dapp/package.json +1 -1
- package/templates/vue2-static/package.json +1 -1
package/package.json
CHANGED
|
@@ -12,13 +12,15 @@ const action = 'request-digest-signature';
|
|
|
12
12
|
|
|
13
13
|
module.exports = {
|
|
14
14
|
action,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
onConnect() {
|
|
16
|
+
return {
|
|
17
|
+
signature: () => {
|
|
18
|
+
return {
|
|
19
|
+
description: 'Please sign the digest',
|
|
20
|
+
digest: toBase58(hasher(data, 1)),
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
};
|
|
22
24
|
},
|
|
23
25
|
|
|
24
26
|
onAuth: ({ userDid, userPk, claims, updateSession }) => {
|
|
@@ -11,26 +11,28 @@ const action = 'request-multiple-claims';
|
|
|
11
11
|
|
|
12
12
|
module.exports = {
|
|
13
13
|
action,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
14
|
+
onConnect() {
|
|
15
|
+
return {
|
|
16
|
+
signText: [
|
|
17
|
+
'signature',
|
|
18
|
+
() => {
|
|
19
|
+
return {
|
|
20
|
+
type: 'mime:text/plain',
|
|
21
|
+
data: getRandomMessage(),
|
|
22
|
+
description: 'Please sign the text',
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
signDigest: [
|
|
27
|
+
'signature',
|
|
28
|
+
() => {
|
|
29
|
+
return {
|
|
30
|
+
description: 'Please sign the digest',
|
|
31
|
+
digest: toBase58(hasher(data, 1)),
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
};
|
|
34
36
|
},
|
|
35
37
|
|
|
36
38
|
onAuth: ({ userDid, userPk, claims, updateSession }) => {
|
|
@@ -11,25 +11,27 @@ const action = 'request-multiple-steps';
|
|
|
11
11
|
|
|
12
12
|
module.exports = {
|
|
13
13
|
action,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
onConnect() {
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
signature: () => {
|
|
18
|
+
return {
|
|
19
|
+
type: 'mime:text/plain',
|
|
20
|
+
data: getRandomMessage(),
|
|
21
|
+
description: 'Please sign the text',
|
|
22
|
+
};
|
|
23
|
+
},
|
|
22
24
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
25
|
+
{
|
|
26
|
+
signature: () => {
|
|
27
|
+
return {
|
|
28
|
+
description: 'Please sign the digest',
|
|
29
|
+
digest: toBase58(hasher(data, 1)),
|
|
30
|
+
};
|
|
31
|
+
},
|
|
30
32
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
];
|
|
34
|
+
},
|
|
33
35
|
|
|
34
36
|
onAuth: ({ userDid, userPk, claims, step, req, updateSession }) => {
|
|
35
37
|
logger.info(`${action}.onAuth`, { step, userPk, userDid, claims });
|
|
@@ -46,21 +46,23 @@ const action = 'request-nft';
|
|
|
46
46
|
|
|
47
47
|
module.exports = {
|
|
48
48
|
action,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
49
|
+
onConnect() {
|
|
50
|
+
return {
|
|
51
|
+
assetOrVC: () => {
|
|
52
|
+
return {
|
|
53
|
+
description: 'Please provide NFT or VC to continue',
|
|
54
|
+
filters: [
|
|
55
|
+
{
|
|
56
|
+
type: ['NFTBadge', 'NFTCertificate'],
|
|
57
|
+
trustedIssuers: [
|
|
58
|
+
// wallet.address,
|
|
59
|
+
'zNKXAEjKYXEnf2hf18NjTQsa1JajA9gJ3haY',
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
};
|
|
64
66
|
},
|
|
65
67
|
onAuth: async ({ claims, challenge, updateSession }) => {
|
|
66
68
|
const asset = claims.find((x) => x.type === 'asset');
|
|
@@ -10,29 +10,31 @@ const logger = require('../../libs/logger');
|
|
|
10
10
|
const action = 'request-payment';
|
|
11
11
|
module.exports = {
|
|
12
12
|
action,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
onConnect() {
|
|
14
|
+
return {
|
|
15
|
+
signature: async ({ userDid, userPk }) => {
|
|
16
|
+
const amount = 1;
|
|
17
|
+
const token = await getTokenInfo();
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
return {
|
|
20
|
+
type: 'TransferV2Tx',
|
|
21
|
+
data: {
|
|
22
|
+
from: userDid,
|
|
23
|
+
pk: userPk,
|
|
24
|
+
itx: {
|
|
25
|
+
to: wallet.address,
|
|
26
|
+
tokens: [
|
|
27
|
+
{
|
|
28
|
+
address: env.localTokenId,
|
|
29
|
+
value: fromTokenToUnit(amount, token.decimal).toString(),
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
31
33
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
}
|
|
34
|
+
description: `Please pay ${amount} ${token.symbol} to application`,
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
};
|
|
36
38
|
},
|
|
37
39
|
onAuth: async ({ req, claims, userDid, updateSession }) => {
|
|
38
40
|
try {
|
|
@@ -4,11 +4,13 @@ const logger = require('../../libs/logger');
|
|
|
4
4
|
const action = 'request-profile';
|
|
5
5
|
module.exports = {
|
|
6
6
|
action,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
onConnect() {
|
|
8
|
+
return {
|
|
9
|
+
profile: () => ({
|
|
10
|
+
description: 'Please provide your full profile',
|
|
11
|
+
fields: ['fullName', 'email', 'phone', 'signature', 'avatar', 'birthday'],
|
|
12
|
+
}),
|
|
13
|
+
};
|
|
12
14
|
},
|
|
13
15
|
|
|
14
16
|
onAuth: ({ userDid, userPk, claims, updateSession }) => {
|
|
@@ -9,16 +9,18 @@ const { getRandomMessage } = require('../../libs/utils');
|
|
|
9
9
|
const action = 'request-text-signature';
|
|
10
10
|
module.exports = {
|
|
11
11
|
action,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
onConnect() {
|
|
13
|
+
return {
|
|
14
|
+
signature: () => {
|
|
15
|
+
const data = getRandomMessage();
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
return {
|
|
18
|
+
description: 'Please sign the text',
|
|
19
|
+
type: 'mime:text/plain',
|
|
20
|
+
data,
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
};
|
|
22
24
|
},
|
|
23
25
|
|
|
24
26
|
onAuth: ({ userDid, userPk, claims, updateSession }) => {
|
|
@@ -12,34 +12,36 @@ const action = 'request-transaction-signature';
|
|
|
12
12
|
|
|
13
13
|
module.exports = {
|
|
14
14
|
action,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
onConnect() {
|
|
16
|
+
return {
|
|
17
|
+
signature: async ({ userPk, userDid }) => {
|
|
18
|
+
const value = await client.fromTokenToUnit(1);
|
|
19
|
+
const type = toTypeInfo(userDid);
|
|
20
|
+
|
|
21
|
+
const encoded = await client.encodeTransferV2Tx({
|
|
22
|
+
tx: {
|
|
23
|
+
itx: {
|
|
24
|
+
to: wallet.address,
|
|
25
|
+
tokens: [
|
|
26
|
+
{
|
|
27
|
+
address: env.localTokenId,
|
|
28
|
+
value: value.toString(),
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
30
32
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
}
|
|
33
|
+
wallet: fromPublicKey(userPk, type),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const origin = toBase58(encoded.buffer);
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
description: 'Please sign the transaction',
|
|
40
|
+
type: 'fg:t:transaction',
|
|
41
|
+
data: origin,
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
};
|
|
43
45
|
},
|
|
44
46
|
|
|
45
47
|
onAuth: ({ userDid, userPk, claims, updateSession }) => {
|