Skip to content

Commit c157de7

Browse files
authored
Merge pull request #386 from bsv-blockchain/feature/originator-checks
Feature/originator checks
2 parents d9ff569 + 9c69da2 commit c157de7

File tree

12 files changed

+237
-141
lines changed

12 files changed

+237
-141
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. The format
55
## Table of Contents
66

77
- [Unreleased](#unreleased)
8+
- [1.9.7 - 2025-11-14](#197---2025-11-14)
89
- [1.9.6 - 2025-11-13](#196---2025-11-13)
910
- [1.9.5 - 2025-11-13](#195---2025-11-13)
1011
- [1.9.3 - 2025-11-11](#193---2025-11-11)
@@ -179,6 +180,15 @@ All notable changes to this project will be documented in this file. The format
179180

180181
---
181182

183+
### [1.9.7] - 2025-11-14
184+
185+
### Added
186+
187+
- Added handling of already spent transactions for the identity client's revoke method.
188+
- Added originator checks for all methods that may try to create a new wallet.
189+
190+
---
191+
182192
### [1.9.6] - 2025-11-13
183193

184194
### Added

docs/reference/identity.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class IdentityClient {
134134
async publiclyRevealAttributes(certificate: WalletCertificate, fieldsToReveal: CertificateFieldNameUnder50Bytes[]): Promise<BroadcastResponse | BroadcastFailure>
135135
async resolveByIdentityKey(args: DiscoverByIdentityKeyArgs, overrideWithContacts = true): Promise<DisplayableIdentity[]>
136136
async resolveByAttributes(args: DiscoverByAttributesArgs, overrideWithContacts = true): Promise<DisplayableIdentity[]>
137-
async revokeCertificateRevelation(serialNumber: Base64String): Promise<BroadcastResponse | BroadcastFailure>
137+
async revokeCertificateRevelation(serialNumber: Base64String): Promise<void>
138138
public async getContacts(identityKey?: PubKeyHex, forceRefresh = false, limit = 1000): Promise<Contact[]>
139139
public async saveContact(contact: DisplayableIdentity, metadata?: Record<string, any>): Promise<void>
140140
public async removeContact(identityKey: PubKeyHex): Promise<void>
@@ -268,9 +268,9 @@ Argument Details
268268
Remove public certificate revelation from overlay services by spending the identity token
269269

270270
```ts
271-
async revokeCertificateRevelation(serialNumber: Base64String): Promise<BroadcastResponse | BroadcastFailure>
271+
async revokeCertificateRevelation(serialNumber: Base64String): Promise<void>
272272
```
273-
See also: [Base64String](./wallet.md#type-base64string), [BroadcastFailure](./transaction.md#interface-broadcastfailure), [BroadcastResponse](./transaction.md#interface-broadcastresponse)
273+
See also: [Base64String](./wallet.md#type-base64string)
274274

275275
Argument Details
276276

docs/reference/overlay-tools.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ export default class OverlayAdminTokenTemplate implements ScriptTemplate {
418418
domain: string;
419419
topicOrService: string;
420420
}
421-
constructor(wallet: WalletInterface)
421+
constructor(wallet: WalletInterface, originator?: OriginatorDomainNameStringUnder250Bytes)
422422
async lock(protocol: "SHIP" | "SLAP", domain: string, topicOrService: string): Promise<LockingScript>
423423
unlock(protocol: "SHIP" | "SLAP"): {
424424
sign: (tx: Transaction, inputIndex: number) => Promise<UnlockingScript>;
@@ -427,16 +427,16 @@ export default class OverlayAdminTokenTemplate implements ScriptTemplate {
427427
}
428428
```
429429

430-
See also: [LockingScript](./script.md#class-lockingscript), [PushDrop](./script.md#class-pushdrop), [ScriptTemplate](./script.md#interface-scripttemplate), [Transaction](./transaction.md#class-transaction), [UnlockingScript](./script.md#class-unlockingscript), [WalletInterface](./wallet.md#interface-walletinterface), [sign](./compat.md#variable-sign)
430+
See also: [LockingScript](./script.md#class-lockingscript), [OriginatorDomainNameStringUnder250Bytes](./wallet.md#type-originatordomainnamestringunder250bytes), [PushDrop](./script.md#class-pushdrop), [ScriptTemplate](./script.md#interface-scripttemplate), [Transaction](./transaction.md#class-transaction), [UnlockingScript](./script.md#class-unlockingscript), [WalletInterface](./wallet.md#interface-walletinterface), [sign](./compat.md#variable-sign)
431431

432432
#### Constructor
433433

434434
Constructs a new Overlay Admin template instance
435435

436436
```ts
437-
constructor(wallet: WalletInterface)
437+
constructor(wallet: WalletInterface, originator?: OriginatorDomainNameStringUnder250Bytes)
438438
```
439-
See also: [WalletInterface](./wallet.md#interface-walletinterface)
439+
See also: [OriginatorDomainNameStringUnder250Bytes](./wallet.md#type-originatordomainnamestringunder250bytes), [WalletInterface](./wallet.md#interface-walletinterface)
440440

441441
Argument Details
442442

docs/reference/registry.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export class RegistryClient {
216216
constructor(private readonly wallet: WalletInterface = new WalletClient(), options: {
217217
acceptDelayedBroadcast?: boolean;
218218
resolver?: LookupResolver;
219-
} = {})
219+
} = {}, private readonly originator?: OriginatorDomainNameStringUnder250Bytes)
220220
async registerDefinition(data: DefinitionData): Promise<BroadcastResponse | BroadcastFailure>
221221
async resolve<T extends DefinitionType>(definitionType: T, query: RegistryQueryMapping[T]): Promise<DefinitionData[]>
222222
async listOwnRegistryEntries(definitionType: DefinitionType): Promise<RegistryRecord[]>
@@ -225,7 +225,7 @@ export class RegistryClient {
225225
}
226226
```
227227

228-
See also: [BroadcastFailure](./transaction.md#interface-broadcastfailure), [BroadcastResponse](./transaction.md#interface-broadcastresponse), [DefinitionData](./registry.md#type-definitiondata), [DefinitionType](./registry.md#type-definitiontype), [LookupResolver](./overlay-tools.md#class-lookupresolver), [RegistryQueryMapping](./registry.md#interface-registryquerymapping), [RegistryRecord](./registry.md#type-registryrecord), [WalletClient](./wallet.md#class-walletclient), [WalletInterface](./wallet.md#interface-walletinterface)
228+
See also: [BroadcastFailure](./transaction.md#interface-broadcastfailure), [BroadcastResponse](./transaction.md#interface-broadcastresponse), [DefinitionData](./registry.md#type-definitiondata), [DefinitionType](./registry.md#type-definitiontype), [LookupResolver](./overlay-tools.md#class-lookupresolver), [OriginatorDomainNameStringUnder250Bytes](./wallet.md#type-originatordomainnamestringunder250bytes), [RegistryQueryMapping](./registry.md#interface-registryquerymapping), [RegistryRecord](./registry.md#type-registryrecord), [WalletClient](./wallet.md#class-walletclient), [WalletInterface](./wallet.md#interface-walletinterface)
229229

230230
#### Method listOwnRegistryEntries
231231

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bsv/sdk",
3-
"version": "1.9.6",
3+
"version": "1.9.7",
44
"type": "module",
55
"description": "BSV Blockchain Software Development Kit",
66
"main": "dist/cjs/mod.js",

src/identity/ContactsManager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export class ContactsManager {
214214
}, this.originator)
215215

216216
// Create locking script for the new contact token
217-
const lockingScript = await new PushDrop(this.wallet).lock(
217+
const lockingScript = await new PushDrop(this.wallet, this.originator).lock(
218218
[ciphertext],
219219
CONTACT_PROTOCOL_ID,
220220
keyID,
@@ -226,7 +226,7 @@ export class ContactsManager {
226226
const [txid, outputIndex] = String(existingOutput.outpoint).split('.')
227227
const prevOutpoint = `${txid}.${outputIndex}` as const
228228

229-
const pushdrop = new PushDrop(this.wallet)
229+
const pushdrop = new PushDrop(this.wallet, this.originator)
230230
const { signableTransaction } = await this.wallet.createAction({
231231
description: 'Update Contact',
232232
inputBEEF: outputs.BEEF as number[],
@@ -339,7 +339,7 @@ export class ContactsManager {
339339
// Found the contact's output, spend it without creating a new one
340340
const prevOutpoint = `${txid}.${outputIndex}` as const
341341

342-
const pushdrop = new PushDrop(this.wallet)
342+
const pushdrop = new PushDrop(this.wallet, this.originator)
343343
const { signableTransaction } = await this.wallet.createAction({
344344
description: 'Delete Contact',
345345
inputBEEF: outputs.BEEF as number[],

0 commit comments

Comments
 (0)