Skip to main content

LensStudio:Spk

Module

Toolkit for packaging and distributing Lens Studio projects.

Example

// The LensStudio:Spk module provides packaging utilities used when
// exporting a Lens Studio project as a signed .spk package. The module
// exposes ensureDebugKey(), which creates (or returns the existing) debug
// signing key inside a project directory — this is the first step in
// packaging a lens for local testing.
const { ensureDebugKey } = await import('LensStudio:Spk');

// Resolve the current project directory via IModel.
const model = this.pluginSystem.findInterface(
Editor.Model.IModel.interfaceId
) as unknown as Editor.Model.IModel;

if (Editor.isNull(model)) {
console.log('IModel not available — cannot package');
return;
}

const projectDir = model.project.projectDirectory;
console.log('Packaging from:', projectDir.toString());

// ensureDebugKey() writes (or reuses) a debug signing key under the
// project directory and returns its path. The returned key path is what
// the packaging pipeline (SpkPacker) would sign the built .spk with.
const keyPath = ensureDebugKey(projectDir);
console.log('Debug signing key ready at:', keyPath.toString());