-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Print a new key pair. Does not change your current signing key. Bring the feature from [`ucan-key`](https://github.com/olizilla/ucan-key) into w3cli ```shell $ w3 key create # did:key:z6Mkne1JnNWCvUgxsdo552FW8jRN78uxbpCnBmDiPmf1koYc MgCZ5ftHm9e0FnNtFXA2sMZgcf97GO4vTaybGEfkBp/KR5+0BeZ44TKEOwUjbLqvFFs2hpFxD++IAEEL+3ySROyDsSRk= $ w3 key create --json | jq { "did": "did:key:z6Mkt7urpgJKK38cEyB1uMGBzfdn6sZN2daB5pr75DZbgahZ", "key": "MgCYj0pKJn5uf+4yr2DApB8idYtDY+9yhEYH64Po0uaj+R+0Byw7B8cSYrO4//5PqgWodYq8PMI/fSWZ1xdvdw15bmAw=" } ``` see: #154 (comment) License: MIT --------- Signed-off-by: Oli Evans <[email protected]> Co-authored-by: Alan Shaw <[email protected]>
- Loading branch information
Showing
4 changed files
with
127 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -400,7 +400,9 @@ export const testSpace = { | |
}), | ||
|
||
'w3 space use': test(async (assert, context) => { | ||
const spaceDID = await loginAndCreateSpace(context, { env: context.env.alice }) | ||
const spaceDID = await loginAndCreateSpace(context, { | ||
env: context.env.alice, | ||
}) | ||
|
||
const listDefault = await w3 | ||
.args(['space', 'ls']) | ||
|
@@ -1168,6 +1170,14 @@ export const testPlan = { | |
}), | ||
} | ||
|
||
export const testKey = { | ||
'w3 key create': test(async (assert) => { | ||
const res = await w3.args(['key', 'create', '--json']).join() | ||
const key = ED25519.parse(JSON.parse(res.output).key) | ||
assert.ok(key.did().startsWith('did:key')) | ||
}), | ||
} | ||
|
||
/** | ||
* @param {Test.Context} context | ||
* @param {object} options | ||
|
@@ -1217,11 +1227,7 @@ export const selectPlan = async ( | |
*/ | ||
export const createSpace = async ( | ||
context, | ||
{ | ||
customer = '[email protected]', | ||
name = 'home', | ||
env = context.env.alice | ||
} = {} | ||
{ customer = '[email protected]', name = 'home', env = context.env.alice } = {} | ||
) => { | ||
const { output } = await w3 | ||
.args([ | ||
|
@@ -1256,7 +1262,7 @@ export const loginAndCreateSpace = async ( | |
customer = email, | ||
name = 'home', | ||
plan = 'did:web:free.web3.storage', | ||
env = context.env.alice | ||
env = context.env.alice, | ||
} = {} | ||
) => { | ||
await login(context, { email, env }) | ||
|