diff --git a/packages/snaps-execution-environments/src/common/endowments/commonEndowmentFactory.ts b/packages/snaps-execution-environments/src/common/endowments/commonEndowmentFactory.ts index b05678de65..6efa59ae19 100644 --- a/packages/snaps-execution-environments/src/common/endowments/commonEndowmentFactory.ts +++ b/packages/snaps-execution-environments/src/common/endowments/commonEndowmentFactory.ts @@ -42,6 +42,7 @@ const commonEndowments: CommonEndowmentSpecification[] = [ { endowment: Int8Array, name: 'Int8Array' }, { endowment: Int16Array, name: 'Int16Array' }, { endowment: Int32Array, name: 'Int32Array' }, + { endowment: globalThis.isSecureContext, name: 'isSecureContext' }, { endowment: Uint8Array, name: 'Uint8Array' }, { endowment: Uint8ClampedArray, name: 'Uint8ClampedArray' }, { endowment: Uint16Array, name: 'Uint16Array' }, diff --git a/packages/snaps-execution-environments/src/common/endowments/endowments.test.browser.ts b/packages/snaps-execution-environments/src/common/endowments/endowments.test.browser.ts index 501f054545..3268506f5f 100644 --- a/packages/snaps-execution-environments/src/common/endowments/endowments.test.browser.ts +++ b/packages/snaps-execution-environments/src/common/endowments/endowments.test.browser.ts @@ -177,6 +177,12 @@ describe('endowments', () => { factory: () => WebAssembly, }, + // Properties + isSecureContext: { + endowments: { isSecureContext: globalThis.isSecureContext }, + factory: () => globalThis.isSecureContext, + }, + // Functions. atob: { endowments: { atob }, @@ -358,6 +364,10 @@ describe('endowments', () => { factory: expect.any(Function), names: ['Int32Array'], }, + { + factory: expect.any(Function), + names: ['isSecureContext'], + }, { factory: expect.any(Function), names: ['Uint8Array'], diff --git a/packages/snaps-simulation/src/methods/specifications.test.ts b/packages/snaps-simulation/src/methods/specifications.test.ts index 0e3f7ea897..487eda7235 100644 --- a/packages/snaps-simulation/src/methods/specifications.test.ts +++ b/packages/snaps-simulation/src/methods/specifications.test.ts @@ -333,6 +333,7 @@ describe('getEndowments', () => { "Int16Array", "Uint16Array", "Int32Array", + "isSecureContext", "Uint32Array", "Float32Array", "Float64Array", diff --git a/packages/snaps-utils/src/default-endowments.ts b/packages/snaps-utils/src/default-endowments.ts index 0908fd5885..eb471e977a 100644 --- a/packages/snaps-utils/src/default-endowments.ts +++ b/packages/snaps-utils/src/default-endowments.ts @@ -23,6 +23,7 @@ export const DEFAULT_ENDOWMENTS: readonly string[] = Object.freeze([ 'Int16Array', 'Uint16Array', 'Int32Array', + 'isSecureContext', 'Uint32Array', 'Float32Array', 'Float64Array',