Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions packages/keyring-api/src/api/account-options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,27 @@ describe('api', () => {
`At path: entropy.type -- Expected the literal \`"mnemonic"\`, but received: "${options.entropy.type}"`,
);
});

it('throws if options.entropy.type is Hardware (not implemented)', () => {
const options = {
entropy: { type: KeyringAccountEntropyTypeOption.Hardware },
};

expect(() => assert(options, KeyringAccountOptionsStruct)).toThrow(
`At path: entropy.type -- Expected the literal \`"mnemonic"\`, but received: "${KeyringAccountEntropyTypeOption.Hardware}"`,
);
});

it('throws if options.entropy.type is Hardware with additional fields', () => {
const options = {
entropy: {
type: KeyringAccountEntropyTypeOption.Hardware,
deviceId: 'some-device-id',
},
};

expect(() => assert(options, KeyringAccountOptionsStruct)).toThrow(
`At path: entropy.type -- Expected the literal \`"mnemonic"\`, but received: "${KeyringAccountEntropyTypeOption.Hardware}"`,
);
});
});
5 changes: 5 additions & 0 deletions packages/keyring-api/src/api/account-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ export enum KeyringAccountEntropyTypeOption {
*/
PrivateKey = 'private-key',

/**
* Indicates that the account was created from a hardware wallet.
*/
Hardware = 'hardware',

/**
* Indicates that the account was created with custom, keyring-specific entropy.
* This is an opaque type where the entropy source is managed internally by the keyring.
Expand Down
Loading